1 Reply Latest reply on Jan 8, 2008 11:17 AM by manik

    Single transaction multiple updates to cache node

    vantzer

      Hi. I am testing a simple system which listen to updates to the cache.

      The updates are trigger upon transaction-commit.

      The code structure is something like below.


      start() {

      cache.addTreeCacheListener();

      Transaction.begin();

      editCache();

      Transaction.commit();

      }

      editCache() {

      //Create an empty map and put in the treecache
      cache.put(fqn, new Map());

      Node node = cache.get(fqn);
      Map map = node.getData();

      map.put(a, A);
      map.put(b, B);
      map.put(c, C);

      }



      The TreeCacheListener will report NodeModify 3 times, when the transaction is committed.

      Is there anyway in which I can monitor changes in the cache where it will only notify one time when a node is edited multiple times in a single transaction. I think currently for every changes made to the node, it will be reported upon replication. i.e. If I update the same node 20 times, upon transaction commit and replication, the listener will receive nodeModify event 20 times.