[jbosscache-commits] JBoss Cache SVN: r4840 - in core/trunk/src/main/java/org/jboss/cache: interceptors and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Dec 11 13:09:55 EST 2007


Author: manik.surtani at jboss.com
Date: 2007-12-11 13:09:55 -0500 (Tue, 11 Dec 2007)
New Revision: 4840

Modified:
   core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
Log:
Migrated to new arch

Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2007-12-11 17:44:44 UTC (rev 4839)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2007-12-11 18:09:55 UTC (rev 4840)
@@ -800,7 +800,7 @@
       {
          for (Node child : children().values())
          {
-            ((UnversionedNode) child).setValid(valid, recursive);
+            ((NodeSPI) child).setValid(valid, recursive);
          }
       }
    }

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java	2007-12-11 17:44:44 UTC (rev 4839)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java	2007-12-11 18:09:55 UTC (rev 4840)
@@ -36,7 +36,7 @@
       super.setCache(cache);
       buddyManager = cache.getBuddyManager();
       usingBuddyReplication = buddyManager != null;
-      CacheMode mode = cache.getConfiguration().getCacheMode();
+      CacheMode mode = configuration.getCacheMode();
       defaultSynchronous = (mode == CacheMode.REPL_SYNC || mode == CacheMode.INVALIDATION_SYNC);
    }
 
@@ -101,11 +101,11 @@
          if (syncReplTimeout < 0) syncReplTimeout = configuration.getSyncReplTimeout();
 
          List rsps = cache.getRPCManager().callRemoteMethods(callRecipients,
-                 MethodDeclarations.replicateMethod,
-                 new Object[]{call},
-                 sync, // is synchronised?
-                 true, // ignore self?
-                 syncReplTimeout);
+               MethodDeclarations.replicateMethod,
+               new Object[]{call},
+               sync, // is synchronised?
+               true, // ignore self?
+               syncReplTimeout);
          if (log.isTraceEnabled())
          {
             log.trace("responses=" + rsps);

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2007-12-11 17:44:44 UTC (rev 4839)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2007-12-11 18:09:55 UTC (rev 4840)
@@ -9,9 +9,14 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.Region;
+import org.jboss.cache.RegionManager;
 import org.jboss.cache.eviction.EvictedEventNode;
 import org.jboss.cache.eviction.NodeEventType;
+import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
 
@@ -37,17 +42,12 @@
     * <p/>
     * Not to be attempted to be used anywhere else.
     */
+   @Inject
    void setRegionManager(RegionManager regionManager)
    {
       this.regionManager = regionManager;
    }
 
-   public void setCache(CacheSPI cache)
-   {
-      super.setCache(cache);
-      this.regionManager = cache.getRegionManager();
-   }
-
    protected Log getLog()
    {
       return log;
@@ -85,7 +85,7 @@
       Object retVal = nextInterceptor(ctx);
       if (fqn != null && key != null && !canIgnoreEvent(fqn, NodeEventType.ADD_ELEMENT_EVENT))
       {
-         registerEvictionEventToRegionManager( new EvictedEventNode(fqn, NodeEventType.ADD_ELEMENT_EVENT, 1));
+         registerEvictionEventToRegionManager(new EvictedEventNode(fqn, NodeEventType.ADD_ELEMENT_EVENT, 1));
       }
       return retVal;
    }
@@ -173,7 +173,8 @@
          {
             log.trace("No event added. Node does not exist");
          }
-      } else
+      }
+      else
       {
          if (fqn != null && !canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
          {
@@ -228,7 +229,7 @@
          return;
       }
 
-      NodeSPI<?,?> nodeSPI = cache.peek(event.getFqn(), false);
+      NodeSPI<?, ?> nodeSPI = cache.peek(event.getFqn(), false);
       //we do not trigger eviction events for resident nodes
       if (nodeSPI != null && nodeSPI.isResident())
       {

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2007-12-11 17:44:44 UTC (rev 4839)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2007-12-11 18:09:55 UTC (rev 4840)
@@ -51,8 +51,8 @@
  */
 public class PessimisticLockInterceptor extends MethodDispacherInterceptor
 {
-   private TransactionTable tx_table = null;
-
+   private TransactionTable tx_table;
+   private CacheImpl cacheImpl;
    /**
     * Map<Thread, List<NodeLock>>. Keys = threads, values = lists of locks held by that thread
     */
@@ -60,10 +60,11 @@
    private long lock_acquisition_timeout;
 
    @Inject
-   public void injectDependencies(@ComponentName("LockTable")Map<Thread, List<NodeLock>> lockTable, Configuration configuration)
+   public void injectDependencies(@ComponentName("LockTable")Map<Thread, List<NodeLock>> lockTable, Configuration configuration, CacheImpl cacheImpl)
    {
       this.lock_table = lockTable;
       lock_acquisition_timeout = configuration.getLockAcquisitionTimeout();
+      this.cacheImpl = cacheImpl;
    }
 
    public void setCache(CacheSPI cache)
@@ -232,7 +233,7 @@
       Object retVal = nextInterceptor(ctx);
       if (ctx.getGlobalTransaction() == null)
       {
-         ((CacheImpl) cache).realRemove(fqn, true);
+         cacheImpl.realRemove(fqn, true);
          NodeSPI n = cache.peek(fqn, true);
          if (n != null)
          {




More information about the jbosscache-commits mailing list