[jboss-cvs] JBossCache/src/org/jboss/cache/loader ...

Manik Surtani manik at jboss.org
Wed Jun 6 11:33:11 EDT 2007


  User: msurtani
  Date: 07/06/06 11:33:11

  Modified:    src/org/jboss/cache/loader  ClusteredCacheLoader.java
  Log:
  JBCACHE-1093
  
  Revision  Changes    Path
  1.22      +32 -7     JBossCache/src/org/jboss/cache/loader/ClusteredCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClusteredCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/ClusteredCacheLoader.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -b -r1.21 -r1.22
  --- ClusteredCacheLoader.java	30 Dec 2006 19:48:44 -0000	1.21
  +++ ClusteredCacheLoader.java	6 Jun 2007 15:33:11 -0000	1.22
  @@ -10,6 +10,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
  +import org.jboss.cache.NodeSPI;
   import org.jboss.cache.RegionManager;
   import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
   import org.jboss.cache.marshall.MethodCall;
  @@ -119,8 +120,7 @@
      {
         MethodCall call = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, name);
         Object resp = callRemote(call);
  -      Map m = (Map) resp;
  -      return m;
  +      return (Map) resp;
      }
   
      public boolean exists(Fqn name) throws Exception
  @@ -135,12 +135,20 @@
      {
         if (cache.getInvocationContext().isOriginLocal())
         {
  -         Object o[] = {name, key, true};
  -         MethodCall call = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, o);
  +         NodeSPI n = cache.peek(name, false);
  +         if (n == null)
  +         {
  +            MethodCall call = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, name, key, true);
            return callRemote(call);
         }
         else
         {
  +            // dont bother with a remote call
  +            return n.getDirect(key);
  +         }
  +      }
  +      else
  +      {
            log.trace("Call originated remotely.  Not bothering to try and do a clustered get() for this put().  Returning null.");
            return null;
         }
  @@ -166,8 +174,25 @@
       */
      public Object remove(Fqn name, Object key) throws Exception
      {
  -      Map map = get(name);
  -      return map == null ? null : map.get(key);
  +      if (cache.getInvocationContext().isOriginLocal())
  +      {
  +         NodeSPI n = cache.peek(name, true);
  +         if (n == null)
  +         {
  +            MethodCall call = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, name, key, true);
  +            return callRemote(call);
  +         }
  +         else
  +         {
  +            // dont bother with a remote call
  +            return n.getDirect(key);
  +         }
  +      }
  +      else
  +      {
  +         log.trace("Call originated remotely.  Not bothering to try and do a clustered get() for this remove().  Returning null.");
  +         return null;
  +      }
      }
   
      /**
  
  
  



More information about the jboss-cvs-commits mailing list