3 Replies Latest reply on Apr 7, 2006 12:27 AM by genman

    loader behavior : TreeCache.get(Fqn fqn) v (Fqn fqn, Object

    genman


      Sorry to be annoying, but I've been working on cleaning up the cache loading to act more like I expect, thrash less, etc. There is one strange case I don't understand:

       public void testRemoveInTransactionCommit() throws Exception
      ...
       cache.getTransactionManager().begin();
      
       cache.remove(fqn);
      
      - cache.get(fqn); // forces the node to be loaded from cache loader again
      + cache.get(fqn, key); // forces the node to be loaded from cache loader again
       cache.getTransactionManager().commit();
      
       // expect the cache and the loader to be null here.
       assertNull(cache.get(fqn, key));
      


      If I replace the - line with the +, the test fails. This is because CacheLoader does not load the node attributes with Cache.get(Fqn n). This is contrary to what the comments say in this test. Why wouldn't you want to load all attributes for this action?

      It also seems like cache.get(...) shouldn't have the annoying side-effect of interfering with the remove() in the transaction.

      I suspect there is some documentation somewhere on this, but I haven't found it.