7 Replies Latest reply on Apr 4, 2006 10:16 AM by Jerry Gauthier

    Working my way up the stack

    Elias Ross Master

      1. ./src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java

      in invoke():

      Why does TreeCache.putDataEraseMethodLocal and TreeCache.putDataMethodLocal and removeDataLocal have to load the attributes? There are no values returned from these operations.

      2. src/org/jboss/cache/interceptors/TxInterceptor.java

       private GlobalTransaction registerTransaction(Transaction tx) throws Exception
       if (!transactions.containsKey(tx) && isValid(tx))
       {
       gtx = cache.getCurrentTransaction(tx);
       if (gtx.isRemote())
       {
       // should be no need to register a handler since this a remotely initiated gtx
       if (log.isTraceEnabled());
       }
       else
       {
       if (log.isTraceEnabled());
       LocalSynchronizationHandler myHandler = new ...
       }
       transactions.put(tx,NULL);
      


      Seems like a race condition between the "contains" and "put". Too bad there's no "putIfAbsent" operation in the ConcurrentReaderHashMap. This should work:
       if (isValid(tx) && transactions.put(tx, NULL) == null)
       {
      


      3. src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java

      line 340 and 260
       List list=new LinkedList(entry.getLocks());
       for(int i=list.size() - 1; i >= 0; i--) {
       IdentityLock lock=(IdentityLock)list.get(i);

      seems a bit odd, why not an ArrayList or a Reverse ListIterator? (See above)

      Also,
      Thread.currentThread()
      isn't free, if you use it more than once, store it in a local.

      4. src/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
       private int m_seq = 0;
       private int m_listeners = 0;
      

      should these be locked? (E.g. SynchronizedInt ?)