[jbosscache-commits] JBoss Cache SVN: r7745 - core/support-branches/1.4.1.SP8_JBCACHE-1247_JBCACHE-1483/src/org/jboss/cache.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Sun Feb 22 16:36:35 EST 2009


Author: jiwils
Date: 2009-02-22 16:36:35 -0500 (Sun, 22 Feb 2009)
New Revision: 7745

Modified:
   core/support-branches/1.4.1.SP8_JBCACHE-1247_JBCACHE-1483/src/org/jboss/cache/TreeCache.java
Log:
Fix for JBCACHE-1483.  findNode now handles null returned from findInternal.


Modified: core/support-branches/1.4.1.SP8_JBCACHE-1247_JBCACHE-1483/src/org/jboss/cache/TreeCache.java
===================================================================
--- core/support-branches/1.4.1.SP8_JBCACHE-1247_JBCACHE-1483/src/org/jboss/cache/TreeCache.java	2009-02-22 21:33:55 UTC (rev 7744)
+++ core/support-branches/1.4.1.SP8_JBCACHE-1247_JBCACHE-1483/src/org/jboss/cache/TreeCache.java	2009-02-22 21:36:35 UTC (rev 7745)
@@ -112,8 +112,8 @@
    private static final String JGROUPS_JMX_DOMAIN = "jboss.jgroups";
    private static final String CHANNEL_JMX_ATTRIBUTES = "type=channel,cluster=";
    private static final String PROTOCOL_JMX_ATTRIBUTES = "type=protocol,cluster=";
-   
-   
+
+
    private boolean forceAnycast = false;
    /**
     * Default replication version, from {@link Version#getVersionShort}.
@@ -284,7 +284,7 @@
     * Require write locks on parents before adding or removing children.  Default false.
     */
    protected boolean lockParentForChildInsertRemove = false;
-   
+
    /**
     * This ThreadLocal contains an {@see InvocationContext} object, which holds
     * invocation-specific details.
@@ -435,15 +435,15 @@
     * will be ignored by _getState().
     */
    protected final Set activationChangeNodes = new HashSet();
-   
+
    /**
-    * The JGroups 2.4.1 or higher "callRemoteMethods" overload that 
+    * The JGroups 2.4.1 or higher "callRemoteMethods" overload that
     * provides Anycast support.
     */
    protected Method anycastMethod;
-   
+
    /** Did we register our channel in JMX ourself? */
-   protected boolean channelRegistered;   
+   protected boolean channelRegistered;
    /** Did we register our channel's protocols in JMX ourself? */
    protected boolean protocolsRegistered;
 
@@ -1125,7 +1125,7 @@
    public IsolationLevel getIsolationLevelClass()
    {
       return isolationLevel;
-   }  
+   }
 
    /**
     * Gets whether inserting or removing a node requires a write lock
@@ -1474,7 +1474,7 @@
                channel = new JChannel(cluster_props);
                // JBCACHE-1048 Hack to register the channel
                registerChannelInJmx();
-               
+
                // Only set GET_STATE_EVENTS if the JGroups version is < 2.3
                int jgVer= org.jgroups.Version.version;
                while (jgVer >= 100)
@@ -1497,7 +1497,7 @@
 */
             disp = new RpcDispatcher(channel, ml, this, this);
             disp.setMarshaller(getMarshaller());
-            
+
             // See if Anycast is supported
             try
             {
@@ -1505,7 +1505,7 @@
             }
             catch (Throwable ignored)
             {
-               log.debug("JGroups release " + org.jgroups.Version.version + 
+               log.debug("JGroups release " + org.jgroups.Version.version +
                          " does not support anycast; will not use it");
             }
             break;
@@ -1989,13 +1989,13 @@
             {
                // Get the state from each DataOwner and integrate in their
                // respective buddy backup tree
-               List buddies = buddyManager.getBackupDataOwners(); 
+               List buddies = buddyManager.getBackupDataOwners();
                for (Iterator it = buddies.iterator(); it.hasNext();)
                {
                   Address buddy = (Address) it.next();
                   if (getMembers() == null || !getMembers().contains(buddy))
                      continue;
-                  
+
                   Object[] sources = {buddy};
                   Fqn base = new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, BuddyManager.getGroupNameFromAddress(buddy));
                   Fqn buddyRoot = new Fqn(base, fqn);
@@ -3362,7 +3362,7 @@
          // No one provided us with state. We need to find out if that's because
          // we are the coordinator. But we don't know if the viewAccepted() callback
          // has been invoked, so call determineCoordinator(), which will block until
-         // viewAccepted() is called at least once         
+         // viewAccepted() is called at least once
          determineCoordinator();
 
          if (isCoordinator())
@@ -5071,16 +5071,16 @@
     * Internal evict method called by eviction policy provider.
     *
     * @param fqn removes everything assoicated with this FQN
-    * 
-    * @return <code>true</code> if the node has been completely removed, 
+    *
+    * @return <code>true</code> if the node has been completely removed,
     *         <code>false</code> if only the data map was removed, due
     *         to the presence of children
-    *         
+    *
     * @throws CacheException
     */
    public boolean _evict(Fqn fqn) throws CacheException
    {
-      if (!exists(fqn)) 
+      if (!exists(fqn))
          return true;   // node does not exist. Maybe it has been recursively removed.
       // use remove method now if there is a child node. Otherwise, it is removed
       boolean create_undo_ops = false;
@@ -5105,16 +5105,16 @@
     *
     * @param fqn
     * @param version
-    * 
-    * @return <code>true</code> if the node has been completely removed, 
+    *
+    * @return <code>true</code> if the node has been completely removed,
     *         <code>false</code> if only the data map was removed, due
     *         to the presence of children
-    *         
+    *
     * @throws CacheException
     */
    public boolean _evict(Fqn fqn, DataVersion version) throws CacheException
    {
-      if (!exists(fqn)) 
+      if (!exists(fqn))
          return true;  // node does not exist
 
       boolean create_undo_ops = false;
@@ -5745,7 +5745,7 @@
          // Now that we have a view, figure out if we are the coordinator
          coordinator = (members.size() != 0 && members.get(0).equals(getLocalAddress()));
 
-         // now notify listeners - *after* updating the coordinator. - JBCACHE-662 
+         // now notify listeners - *after* updating the coordinator. - JBCACHE-662
          if (needNotification) notifyViewChange(new_view);
 
          // Wake up any threads that are waiting to know who the members
@@ -5852,7 +5852,7 @@
          catch (SystemException e)
          {
          }
-         
+
          // JBCACHE-982 -- don't complain if COMMITTED
          if (status != Status.STATUS_COMMITTED)
          {
@@ -5862,7 +5862,7 @@
          {
             log.trace("status is COMMITTED; returning null");
          }
-         
+
          return null;
       }
 
@@ -5999,7 +5999,7 @@
 
       Node toReturn = findInternal(fqn, false);
 
-      if (version != null)
+      if (toReturn != null && version != null)
       {
          // we need to check the version of the data node...
          DataVersion nodeVersion = ((OptimisticTreeNode) toReturn).getVersion();
@@ -6294,7 +6294,7 @@
 
       if (curr == null) return;
       notifyNodeCreated(curr.getFqn());
-      
+
       if ((children = curr.getChildren()) != null)
       {
          for (Iterator it = children.values().iterator(); it.hasNext();)
@@ -6702,7 +6702,7 @@
       return (MBeanServer) servers.get(0);
 
    }
-   
+
    protected void registerChannelInJmx()
    {
       if (server != null)
@@ -6712,7 +6712,7 @@
             String protocolPrefix = JGROUPS_JMX_DOMAIN + ":" + PROTOCOL_JMX_ATTRIBUTES + getClusterName();
             JmxConfigurator.registerProtocols(server, channel, protocolPrefix);
             protocolsRegistered = true;
-            
+
             String name = JGROUPS_JMX_DOMAIN + ":" + CHANNEL_JMX_ATTRIBUTES + getClusterName();
             JmxConfigurator.registerChannel(channel, server, name);
             channelRegistered = true;
@@ -6723,12 +6723,12 @@
          }
       }
    }
-   
+
    protected void unregisterChannelFromJmx()
    {
       ObjectName on = null;
       if (channelRegistered)
-      {          
+      {
          // Unregister the channel itself
          try
          {
@@ -6743,7 +6743,7 @@
                log.error("Caught exception unregistering channel", e);
          }
       }
-      
+
       if (protocolsRegistered)
       {
          // Unregister the protocols




More information about the jbosscache-commits mailing list