3 Replies Latest reply on Nov 11, 2004 10:25 AM by tinachen

    Can't replicate the change in a Hashtable Object

    tinachen

      Hi, All:
      I create a standardalone JBossCache three node cluster, then insert one Hashtable in one node using the method "putObject(aFqn, aHashtable)".
      But I found if I change the content of the aHashtable Object in one node, the change didn't replicate in other node. Could anybody tell me how I can make it work?
      Thank you very much.
      Tina

        • 1. Re: Can't replicate the change in a Hashtable Object

          Tine,

          I take it that you are referring to TreeCacheAop part. Collection classes are handled by proxy implicitly. So you will need to operate on the proxy, e.g.,

          aHashTable = (HashTable)getObject(aFqn);
          aHashTable.put("1", "test");

          etc.

          -Ben

          • 2. Re: Can't replicate the change in a Hashtable Object
            belaban

             

            "tinachen" wrote:
            Hi, All:
            I create a standardalone JBossCache three node cluster, then insert one Hashtable in one node using the method "putObject(aFqn, aHashtable)".
            But I found if I change the content of the aHashtable Object in one node, the change didn't replicate in other node. Could anybody tell me how I can make it work?
            Thank you very much.
            Tina

            On a general note: putting a hashmap as value of an FQN might be replaced by taking the contents of the mashmap and creating a new subtree in JBossCache, e.g.
            Map m;
            TreeCache c;
            Fqn base=Fqn.fromString("/a/b/c");
            for(Iterator it=m.entries().iterator(); it.hasNext();) {
             Map.Entry entry=(Map.Entry)it.next();
             c.put(fqn, entry.getKey(), entry.getValue());
            }


            Bela

            • 3. Re: Can't replicate the change in a Hashtable Object
              tinachen

              Hi, Ben:
              I found the reason for the Hashtable replication. Actually, the function works fine, but the replication latency is huge, much more than the SyncReplTimeout 10000 ms. That's why the thread on other nodes can't pickup the new value.
              Thank you very much.
              Tina