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

Manik Surtani manik at jboss.org
Wed May 23 11:22:05 EDT 2007


  User: msurtani
  Date: 07/05/23 11:22:05

  Modified:    src/org/jboss/cache     InvocationContext.java
                        UnversionedNode.java CacheImpl.java NodeSPI.java
  Log:
  Performance enhancements, including a new invoke() signature for Interceptor
  
  Revision  Changes    Path
  1.13      +32 -0     JBossCache/src/org/jboss/cache/InvocationContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: InvocationContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/InvocationContext.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- InvocationContext.java	7 Feb 2007 22:06:44 -0000	1.12
  +++ InvocationContext.java	23 May 2007 15:22:05 -0000	1.13
  @@ -30,6 +30,7 @@
      private boolean originLocal = true;
      private boolean txHasMods;
      private boolean localRollbackOnly;
  +   private MethodCall methodCall;
   
      InvocationContext()
      {
  @@ -249,4 +250,35 @@
         result = 29 * result + (localRollbackOnly ? 1 : 0);
         return result;
      }
  +
  +   /**
  +    * @return the method call associated with this invocation
  +    */
  +   public MethodCall getMethodCall()
  +   {
  +      return methodCall;
  +   }
  +
  +   /**
  +    * Sets the method call associated with this invocation.
  +    *
  +    * @param methodCall methodcall to set
  +    */
  +   public void setMethodCall(MethodCall methodCall)
  +   {
  +      this.methodCall = methodCall;
  +   }
  +
  +   /**
  +    * Factory method that creates a context with a given method call.
  +    *
  +    * @param methodCall methodcall to use
  +    * @return invocation context
  +    */
  +   public static InvocationContext fromMethodCall(MethodCall methodCall)
  +   {
  +      InvocationContext ctx = new InvocationContext();
  +      ctx.methodCall = methodCall;
  +      return ctx;
  +   }
   }
  
  
  
  1.28      +3 -3      JBossCache/src/org/jboss/cache/UnversionedNode.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UnversionedNode.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/UnversionedNode.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -b -r1.27 -r1.28
  --- UnversionedNode.java	26 Apr 2007 12:03:07 -0000	1.27
  +++ UnversionedNode.java	23 May 2007 15:22:05 -0000	1.28
  @@ -208,7 +208,6 @@
         return new MapCopy<K, V>(data);
      }
   
  -
      public V put(K key, V value)
      {
         return cache.put(getFqn(), key, value);
  @@ -234,6 +233,7 @@
         }
   
         child = (NodeSPI) children().get(child_name);
  +      InvocationContext ctx = cache.getInvocationContext();
         if (createIfNotExists && child == null)
         {
            // construct the new child outside the synchronized block to avoid
  @@ -251,7 +251,7 @@
               child = (NodeSPI) children().get(child_name);
               if (child == null)
               {
  -               cache.getNotifier().notifyNodeCreated(child_fqn, true, true);
  +               cache.getNotifier().notifyNodeCreated(child_fqn, true, ctx, true);
                  child = newChild;
                  children.put(child_name, child);
                  if (gtx != null)
  @@ -273,7 +273,7 @@
               {
                  log.trace("created child: fqn=" + child_fqn);
               }
  -            cache.getNotifier().notifyNodeCreated(child_fqn, false, true);
  +            cache.getNotifier().notifyNodeCreated(child_fqn, false, ctx, true);
            }
         }
         return child;
  
  
  
  1.74      +140 -128  JBossCache/src/org/jboss/cache/CacheImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheImpl.java,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -b -r1.73 -r1.74
  --- CacheImpl.java	23 May 2007 10:28:58 -0000	1.73
  +++ CacheImpl.java	23 May 2007 15:22:05 -0000	1.74
  @@ -172,7 +172,7 @@
      private Marshaller marshaller_ = null;
   
      /**
  -    * {@link #invokeMethod(MethodCall)} will dispatch to this chain of interceptors.
  +    * {@link #invokeMethod(org.jboss.cache.marshall.MethodCall,boolean)} will dispatch to this chain of interceptors.
       * In the future, this will be replaced with JBossAop. This is a first step towards refactoring JBossCache.
       */
      private Interceptor interceptor_chain = null;
  @@ -757,7 +757,7 @@
               regionManager.startEvictionThread();
            }
   
  -         notifier.notifyCacheStarted(this, true);
  +         notifier.notifyCacheStarted(this, getInvocationContext(), true);
   
            // install a VM shutdown hook
            Thread shutdownHook = new Thread()
  @@ -848,7 +848,7 @@
   
            if (notifier != null)
            {
  -            notifier.notifyCacheStopped(this, true);
  +            notifier.notifyCacheStopped(this, getInvocationContext(), true);
               notifier.removeAllCacheListeners();
               notifier.setEvictionPolicyListener(null);
            }
  @@ -1204,7 +1204,7 @@
      public Node<K, V> get(Fqn fqn) throws CacheException
      {
         MethodCall m = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, fqn);
  -      return (Node<K, V>) invokeMethod(m);
  +      return (Node<K, V>) invokeMethod(m, true);
      }
   
      /**
  @@ -1247,7 +1247,7 @@
      public Set<K> getKeys(Fqn fqn) throws CacheException
      {
         MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeysMethodLocal, fqn);
  -      return (Set<K>) invokeMethod(m);
  +      return (Set<K>) invokeMethod(m, true);
      }
   
   
  @@ -1289,19 +1289,20 @@
   
      public V _get(Fqn fqn, K key, boolean sendNodeEvent) throws CacheException
      {
  +      InvocationContext ctx = getInvocationContext();
         if (log.isTraceEnabled())
         {
            log.trace(new StringBuffer("_get(").append("\"").append(fqn).append("\", \"").append(key).append("\", \"").
                  append(sendNodeEvent).append("\")"));
         }
  -      if (sendNodeEvent) notifier.notifyNodeVisited(fqn, true, true);
  +      if (sendNodeEvent) notifier.notifyNodeVisited(fqn, true, ctx, true);
         NodeSPI<K, V> n = findNode(fqn);
         if (n == null)
         {
            log.trace("node not found");
            return null;
         }
  -      if (sendNodeEvent) notifier.notifyNodeVisited(fqn, false, true);
  +      if (sendNodeEvent) notifier.notifyNodeVisited(fqn, false, ctx, true);
         return n.getDirect(key);
      }
   
  @@ -1309,7 +1310,7 @@
      protected V get(Fqn fqn, K key, boolean sendNodeEvent) throws CacheException
      {
         MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, sendNodeEvent);
  -      return (V) invokeMethod(m);
  +      return (V) invokeMethod(m, true);
      }
   
      /**
  @@ -1434,7 +1435,7 @@
         {
            m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, tx, fqn, data, true);
         }
  -      invokeMethod(m);
  +      invokeMethod(m, true);
      }
   
      /**
  @@ -1466,7 +1467,7 @@
      {
         GlobalTransaction tx = getCurrentTransaction();
         MethodCall m = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, tx, fqn, key, value, true);
  -      return (V) invokeMethod(m);
  +      return (V) invokeMethod(m, true);
      }
   
      /**
  @@ -1492,10 +1493,11 @@
         {
            boolean result = true;
            // we need to preserve options
  -         Option o = getInvocationContext().getOptionOverrides();
  +         InvocationContext ctx = getInvocationContext();
  +         Option o = ctx.getOptionOverrides();
            for (Object childName : _getChildrenNames(fqn))
            {
  -            getInvocationContext().setOptionOverrides(o);
  +            ctx.setOptionOverrides(o);
               result = remove(new Fqn(fqn, childName)) && result;
            }
   
  @@ -1504,7 +1506,7 @@
         else
         {
            MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, tx, fqn, true);
  -         Object retval = invokeMethod(m);
  +         Object retval = invokeMethod(m, true);
            return retval != null && (Boolean) retval;
         }
      }
  @@ -1525,17 +1527,18 @@
         {
            // special treatment for root eviction
            // we need to preserve options
  -         Option o = getInvocationContext().getOptionOverrides();
  +         InvocationContext ctx = getInvocationContext();
  +         Option o = ctx.getOptionOverrides();
            for (Object childName : _getChildrenNames(fqn))
            {
  -            getInvocationContext().setOptionOverrides(o);
  +            ctx.setOptionOverrides(o);
               evict(new Fqn(fqn, childName));
            }
         }
         else
         {
            MethodCall m = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, fqn);
  -         invokeMethod(m);
  +         invokeMethod(m, true);
         }
      }
   
  @@ -1562,7 +1565,7 @@
      {
         GlobalTransaction tx = getCurrentTransaction();
         MethodCall m = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal, tx, fqn, key, true);
  -      return (V) invokeMethod(m);
  +      return (V) invokeMethod(m, true);
      }
   
      /**
  @@ -1580,7 +1583,7 @@
      {
         GlobalTransaction tx = getCurrentTransaction();
         MethodCall m = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, tx, fqn, true);
  -      invokeMethod(m);
  +      invokeMethod(m, true);
      }
   
      /**
  @@ -1625,7 +1628,7 @@
         MethodCall m = MethodCallFactory.create(MethodDeclarations.releaseAllLocksMethodLocal, fqn);
         try
         {
  -         invokeMethod(m);
  +         invokeMethod(m, true);
         }
         catch (CacheException e)
         {
  @@ -1652,7 +1655,7 @@
         Object retval = null;
         try
         {
  -         retval = invokeMethod(m);
  +         retval = invokeMethod(m, true);
         }
         catch (Throwable e)
         {
  @@ -1694,7 +1697,7 @@
      public Set getChildrenNames(Fqn fqn) throws CacheException
      {
         MethodCall m = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal, fqn);
  -      Set retval = (Set) invokeMethod(m);
  +      Set retval = (Set) invokeMethod(m, true);
         return retval == null ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet(retval));
      }
   
  @@ -2139,10 +2142,10 @@
         {
            log.trace("_put(" + tx + ", \"" + fqn + "\", " + data + " undo=" + create_undo_ops + " erase=" + erase_contents + ")");
         }
  -
  +      InvocationContext ctx = getInvocationContext();
         NodeSPI<K, V> n = findNodeCheck(tx, fqn);
         Map<K, V> rawData = n.getDataDirect();
  -      notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.PUT_MAP, rawData, true);
  +      notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.PUT_MAP, rawData, ctx, true);
   
         // create a compensating method call (reverting the effect of
         // this modification) and put it into the TX's undo list.
  @@ -2157,7 +2160,7 @@
            n.clearDataDirect();
         n.putAllDirect(data);
   
  -      notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.PUT_MAP, n.getDataDirect(), true);
  +      notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.PUT_MAP, n.getDataDirect(), ctx, true);
   
      }
   
  @@ -2191,10 +2194,10 @@
         {
            log.warn("using a map as a key in a map, did you mean to do that?");
         }
  -
  +      InvocationContext ctx = getInvocationContext();
         NodeSPI<K, V> n = findNodeCheck(tx, fqn);
         Map<K, V> rawData = n.getDataDirect();
  -      notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.PUT_DATA, rawData, true);
  +      notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.PUT_DATA, rawData, ctx, true);
   
         V old_value = n.putDirect(key, value);
   
  @@ -2216,7 +2219,7 @@
         }
   
         Map<K, V> newData = Collections.singletonMap(key, value);
  -      notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.PUT_DATA, newData, true);
  +      notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.PUT_DATA, newData, ctx, true);
         return old_value;
      }
   
  @@ -2282,7 +2285,7 @@
         {
            log.trace("_remove(" + tx + ", \"" + fqn + "\", undo=" + create_undo_ops + ")");
         }
  -
  +      InvocationContext ctx = getInvocationContext();
         // check if this is triggered by a rollback operation ...
         if (tx != null)
         {
  @@ -2315,11 +2318,11 @@
   
         if (eviction)
         {
  -         notifier.notifyNodeEvicted(fqn, true, true);
  +         notifier.notifyNodeEvicted(fqn, true, ctx, true);
         }
         else
         {
  -         notifier.notifyNodeRemoved(fqn, true, n.getDataDirect(), true);
  +         notifier.notifyNodeRemoved(fqn, true, n.getDataDirect(), ctx, true);
         }
   
         parent_node = n.getParent();
  @@ -2357,11 +2360,11 @@
   
         if (eviction)
         {
  -         notifier.notifyNodeEvicted(fqn, false, true);
  +         notifier.notifyNodeEvicted(fqn, false, ctx, true);
         }
         else
         {
  -         notifier.notifyNodeRemoved(fqn, false, null, true);
  +         notifier.notifyNodeRemoved(fqn, false, null, ctx, true);
         }
   
         return found;
  @@ -2406,8 +2409,8 @@
            log.warn("node " + fqn + " not found");
            return null;
         }
  -
  -      notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.REMOVE_DATA, n.getDataDirect(), true);
  +      InvocationContext ctx = getInvocationContext();
  +      notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.REMOVE_DATA, n.getDataDirect(), ctx, true);
   
         old_value = n.removeDirect(key);
   
  @@ -2421,7 +2424,7 @@
         }
   
         Map<K, V> removedData = Collections.singletonMap(key, old_value);
  -      notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.REMOVE_DATA, removedData, true);
  +      notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.REMOVE_DATA, removedData, ctx, true);
   
         return old_value;
      }
  @@ -2485,7 +2488,7 @@
         }
   
         Map<K, V> data = n.getDataDirect();
  -
  +      InvocationContext ctx = getInvocationContext();
         // create a compensating method call (reverting the effect of
         // this modification) and put it into the TX's undo list.
         if (tx != null && create_undo_ops && !eviction)
  @@ -2499,11 +2502,11 @@
   
         if (eviction)
         {
  -         notifier.notifyNodeEvicted(fqn, true, true);
  +         notifier.notifyNodeEvicted(fqn, true, ctx, true);
         }
         else
         {
  -         notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.REMOVE_DATA, data, true);
  +         notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.REMOVE_DATA, data, ctx, true);
         }
   
         n.clearDataDirect();
  @@ -2514,17 +2517,17 @@
   
         if (sendNodeEvent)
         {
  -         notifier.notifyNodeVisited(fqn, false, true);
  +         notifier.notifyNodeVisited(fqn, false, ctx, true);
         }
         else
         {// FIXME Bela did this so GUI view can refresh the view after node is evicted. But this breaks eviction policy, especially AOP!!!!
            if (eviction)
            {
  -            notifier.notifyNodeEvicted(fqn, false, true);
  +            notifier.notifyNodeEvicted(fqn, false, ctx, true);
            }
            else
            {
  -            notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.REMOVE_DATA, data, true);
  +            notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.REMOVE_DATA, data, ctx, true);
            }
         }
   
  @@ -2641,9 +2644,9 @@
            log.warn("node " + parent_fqn + " not found");
            return;
         }
  -
  +      InvocationContext ctx = getInvocationContext();
         Fqn fqn = new Fqn(parent_fqn, child_name);
  -      notifier.notifyNodeCreated(fqn, true, true);
  +      notifier.notifyNodeCreated(fqn, true, ctx, true);
         parentNode.addChild(child_name, childNode);
   
         childNode.markAsDeleted(false, true);
  @@ -2654,7 +2657,7 @@
            tx_table.addUndoOperation(gtx, MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, gtx, fqn, false));
         }
   
  -      notifier.notifyNodeCreated(fqn, false, true);
  +      notifier.notifyNodeCreated(fqn, false, ctx, true);
      }
   
   
  @@ -2668,10 +2671,7 @@
      {
         try
         {
  -         InvocationContext ctx = getInvocationContext();
  -         ctx.setOriginLocal(false);
  -         setInvocationContext(ctx);
  -         Object retVal = invokeMethod(method_call);
  +         Object retVal = invokeMethod(method_call, false);
            // we only need to return values for a set of remote calls; not every call.
            if (MethodDeclarations.returnValueForRemoteCall(method_call.getMethodId()))
            {
  @@ -2687,12 +2687,6 @@
            log.warn("replication failure with method_call " + method_call + " exception", ex);
            throw ex;
         }
  -      finally
  -      {
  -         InvocationContext ctx = getInvocationContext();
  -         ctx.setOriginLocal(true);
  -         setInvocationContext(ctx);
  -      }
      }
   
      /**
  @@ -2763,10 +2757,10 @@
         // we need to get the state for this Fqn and its sub-nodes.
   
         // for now, perform a very simple series of getData calls.
  -
  +      InvocationContext ctx = getInvocationContext();
         try
         {
  -         getInvocationContext().setOriginLocal(false);
  +         ctx.setOriginLocal(false);
   
            NodeSPI<K, V> actualNode = findNode(fqn);
            Fqn backupNodeFqn = null;
  @@ -2800,12 +2794,11 @@
   
            List<NodeData> list = getNodeData(new LinkedList<NodeData>(), actualNode);
   
  -         GravitateResult gr = GravitateResult.subtreeResult(list, backupNodeFqn);
  -         return gr;
  +         return GravitateResult.subtreeResult(list, backupNodeFqn);
         }
         finally
         {
  -         getInvocationContext().setOriginLocal(true);
  +         ctx.setOriginLocal(true);
         }
      }
   
  @@ -2824,10 +2817,11 @@
   
      public void _remoteAssignToBuddyGroup(BuddyGroup group, Map<Fqn, byte[]> state) throws Exception
      {
  +      InvocationContext ctx = getInvocationContext();
         try
         {
            // these are remote calls and as such, should have their origins marked as remote.
  -         getInvocationContext().setOriginLocal(false);
  +         ctx.setOriginLocal(false);
            if (buddyManager != null)
               buddyManager.handleAssignToBuddyGroup(group, state);
            else if (log.isWarnEnabled())
  @@ -2835,17 +2829,18 @@
         }
         finally
         {
  -         getInvocationContext().setOriginLocal(true);
  +         ctx.setOriginLocal(true);
         }
   
      }
   
      public void _remoteRemoveFromBuddyGroup(String groupName) throws BuddyNotInitException
      {
  +      InvocationContext ctx = getInvocationContext();
         try
         {
            // these are remote calls and as such, should have their origins marked as remote.
  -         getInvocationContext().setOriginLocal(false);
  +         ctx.setOriginLocal(false);
            if (buddyManager != null)
               buddyManager.handleRemoveFromBuddyGroup(groupName);
            else if (log.isWarnEnabled())
  @@ -2853,17 +2848,18 @@
         }
         finally
         {
  -         getInvocationContext().setOriginLocal(true);
  +         ctx.setOriginLocal(true);
         }
   
      }
   
      public void _remoteAnnounceBuddyPoolName(Address address, String buddyPoolName)
      {
  +      InvocationContext ctx = getInvocationContext();
         try
         {
            // these are remote calls and as such, should have their origins marked as remote.
  -         getInvocationContext().setOriginLocal(false);
  +         ctx.setOriginLocal(false);
            if (buddyManager != null)
               buddyManager.handlePoolNameBroadcast(address, buddyPoolName);
            else if (log.isWarnEnabled())
  @@ -2871,7 +2867,7 @@
         }
         finally
         {
  -         getInvocationContext().setOriginLocal(true);
  +         ctx.setOriginLocal(true);
         }
      }
   
  @@ -2893,8 +2889,8 @@
            backupDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, backup);
         }
   
  -      invokeMethod(primaryDataCleanup);
  -      invokeMethod(backupDataCleanup);
  +      invokeMethod(primaryDataCleanup, true);
  +      invokeMethod(backupDataCleanup, true);
      }
   
      // ------------- end: buddy replication specific 'lifecycle' method calls
  @@ -3066,7 +3062,13 @@
   
      public InvocationContext getInvocationContext()
      {
  -      return invocationContextContainer.get();
  +      InvocationContext ctx = invocationContextContainer.get();
  +      if (ctx == null)
  +      {
  +         ctx = new InvocationContext();
  +         invocationContextContainer.set(ctx);
  +      }
  +      return ctx;
      }
   
      public void setInvocationContext(InvocationContext ctx)
  @@ -3083,7 +3085,7 @@
      {
         // this needs to be passed up the interceptor chain
         MethodCall m = MethodCallFactory.create(MethodDeclarations.moveMethodLocal, nodeToMove, newParent);
  -      invokeMethod(m);
  +      invokeMethod(m, true);
      }
   
      /**
  @@ -3116,22 +3118,22 @@
         // first correct the pointers at the pruning point
         oldParent.removeChildDirect(nodeName);
         newParent.addChild(nodeName, node);
  -
  +      InvocationContext ctx = getInvocationContext();
         // parent pointer is calculated on the fly using Fqns.
   
         // notify
  -      notifier.notifyNodeMoved(nodeToMoveFqn, new Fqn(newParentFqn, nodeToMoveFqn.getLastElement()), true, true);
  +      notifier.notifyNodeMoved(nodeToMoveFqn, new Fqn(newParentFqn, nodeToMoveFqn.getLastElement()), true, ctx, true);
   
         // now adjust Fqns of node and all children.
         moveFqns(node, newParent.getFqn());
   
  -      notifier.notifyNodeMoved(nodeToMoveFqn, new Fqn(newParentFqn, nodeToMoveFqn.getLastElement()), false, true);
  +      notifier.notifyNodeMoved(nodeToMoveFqn, new Fqn(newParentFqn, nodeToMoveFqn.getLastElement()), false, ctx, true);
   
         // now register an undo op
  -      if (getInvocationContext().getTransaction() != null)
  +      if (ctx.getTransaction() != null)
         {
            MethodCall undo = MethodCallFactory.create(MethodDeclarations.moveMethodLocal, new Fqn(newParentFqn, nodeToMoveFqn.getLastElement()), oldParent.getFqn());
  -         tx_table.addUndoOperation(getInvocationContext().getGlobalTransaction(), undo);
  +         tx_table.addUndoOperation(ctx.getGlobalTransaction(), undo);
         }
      }
   
  @@ -3534,7 +3536,10 @@
   
               // now notify listeners - *after* updating the coordinator. - JBCACHE-662
               if (needNotification)
  -               notifier.notifyViewChange(new_view, true);
  +            {
  +               InvocationContext ctx = getInvocationContext();
  +               notifier.notifyViewChange(new_view, ctx, true);
  +            }
   
               // Wake up any threads that are waiting to know who the members
               // are so they can figure out who the coordinator is
  @@ -3559,7 +3564,7 @@
               log.debug("Block received at " + getLocalAddress());
            }
            MethodCall m = MethodCallFactory.create(MethodDeclarations.blockChannelLocal);
  -         invokeMethod(m);
  +         invokeMethod(m, true);
            if (log.isDebugEnabled())
            {
               log.debug("Block processed at " + getLocalAddress());
  @@ -3576,7 +3581,7 @@
               log.debug("UnBlock received at " + getLocalAddress());
            }
            MethodCall m = MethodCallFactory.create(MethodDeclarations.unblockChannelLocal);
  -         invokeMethod(m);
  +         invokeMethod(m, true);
            if (log.isDebugEnabled())
            {
               log.debug("UnBlock processed at " + getLocalAddress());
  @@ -3728,13 +3733,16 @@
       * the various use cases, e.g. mode (local, repl_async, repl_sync),
       * transaction (yes or no) and locking (yes or no).
       */
  -   protected Object invokeMethod(MethodCall m) throws CacheException
  +   protected Object invokeMethod(MethodCall m, boolean originLocal) throws CacheException
      {
  -      if (interceptor_chain == null)
  -         throw new NullPointerException("interceptor_chain");
  +      // don't create a new one; get it from ThreadLocal just this once, in case a user has added any overrides.
  +      InvocationContext ctx = getInvocationContext();
  +
         try
         {
  -         return interceptor_chain.invoke(m);
  +         ctx.setMethodCall(m);
  +         ctx.setOriginLocal(originLocal);
  +         return interceptor_chain.invoke(ctx);
         }
         catch (CacheException e)
         {
  @@ -3748,6 +3756,10 @@
         {
            throw new RuntimeException(t);
         }
  +      finally
  +      {
  +         if (!originLocal) ctx.setOriginLocal(true);
  +      }
      }
   
      /**
  @@ -4181,7 +4193,7 @@
            getInvocationContext().getOptionOverrides().setFailSilently(true);
            GlobalTransaction tx = getCurrentTransaction();
            MethodCall m = MethodCallFactory.create(MethodDeclarations.putForExternalReadMethodLocal, tx, fqn, key, value);
  -         invokeMethod(m);
  +         invokeMethod(m, true);
         }
         else
         {
  
  
  
  1.19      +1 -1      JBossCache/src/org/jboss/cache/NodeSPI.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NodeSPI.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/NodeSPI.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- NodeSPI.java	12 Mar 2007 18:13:46 -0000	1.18
  +++ NodeSPI.java	23 May 2007 15:22:05 -0000	1.19
  @@ -352,7 +352,7 @@
       * {@link org.jboss.cache.lock.LockingException} will be thrown.
       * <p/>
       *
  -    * @return map contaiing data
  +    * @return map containing data
       * @see #getData()
       */
      Map<K, V> getDataDirect();
  
  
  



More information about the jboss-cvs-commits mailing list