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

Manik Surtani msurtani at jboss.com
Thu Nov 16 12:21:11 EST 2006


  User: msurtani
  Date: 06/11/16 12:21:11

  Modified:    src/org/jboss/cache  TreeCache.java
  Log:
  Better handling of marshalling exceptions when regions are inactive
  
  Revision  Changes    Path
  1.276     +58 -71    JBossCache/src/org/jboss/cache/TreeCache.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCache.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCache.java,v
  retrieving revision 1.275
  retrieving revision 1.276
  diff -u -b -r1.275 -r1.276
  --- TreeCache.java	16 Nov 2006 16:51:53 -0000	1.275
  +++ TreeCache.java	16 Nov 2006 17:21:11 -0000	1.276
  @@ -30,13 +30,13 @@
   import org.jboss.cache.lock.LockUtil;
   import org.jboss.cache.lock.LockingException;
   import org.jboss.cache.lock.TimeoutException;
  +import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
   import org.jboss.cache.marshall.MethodCall;
   import org.jboss.cache.marshall.MethodCallFactory;
   import org.jboss.cache.marshall.MethodDeclarations;
   import org.jboss.cache.marshall.RegionNameConflictException;
   import org.jboss.cache.marshall.RegionNotFoundException;
   import org.jboss.cache.marshall.VersionAwareMarshaller;
  -import org.jboss.cache.marshall.InactiveRegionException;
   import org.jboss.cache.notifications.Notifier;
   import org.jboss.cache.optimistic.DataVersion;
   import org.jboss.cache.statetransfer.StateTransferManager;
  @@ -95,7 +95,7 @@
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    * @author Brian Stansberry
    * @author Daniel Huang (dhuang at jboss.org)
  - * @version $Id: TreeCache.java,v 1.275 2006/11/16 16:51:53 msurtani Exp $
  + * @version $Id: TreeCache.java,v 1.276 2006/11/16 17:21:11 msurtani Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  @@ -543,29 +543,30 @@
         }
      }
   
  -   public void fetchPartialState(Object sources [], Fqn sourceTarget, Fqn integrationTarget) throws Exception
  +   public void fetchPartialState(Object sources[], Fqn sourceTarget, Fqn integrationTarget) throws Exception
      {
         String encodedStateId = sourceTarget + StateTransferManager.PARTIAL_STATE_DELIMETER + integrationTarget;
  -      fetchPartialState(sources,encodedStateId);
  +      fetchPartialState(sources, encodedStateId);
      }
   
  -   public void fetchPartialState(Object sources [], Fqn subtree) throws Exception
  +   public void fetchPartialState(Object sources[], Fqn subtree) throws Exception
      {
  -      if(subtree == null && subtree.isRoot())
  +      if (subtree == null && subtree.isRoot())
         {
            throw new IllegalArgumentException("Cannot fetch partial state. Invalid subtree " + subtree);
         }
  -      fetchPartialState(sources,subtree.toString());
  +      fetchPartialState(sources, subtree.toString());
      }
   
  -   private void fetchPartialState(Object sources [], String stateId) throws Exception
  +   private void fetchPartialState(Object sources[], String stateId) throws Exception
      {
  -      if (sources == null || sources.length<1 || stateId == null)
  +      if (sources == null || sources.length < 1 || stateId == null)
         {
            // should this really be throwing an exception?  Are there valid use cases where partial state may not be available? - Manik
            // Yes -- cache is configured LOCAL but app doesn't know it -- Brian
            //throw new IllegalArgumentException("Cannot fetch partial state, targets are " + sources + " and stateId is " + stateId);
  -         if (log.isWarnEnabled()) log.warn("Cannot fetch partial state, targets are " + sources + " and stateId is " + stateId);
  +         if (log.isWarnEnabled())
  +            log.warn("Cannot fetch partial state, targets are " + sources + " and stateId is " + stateId);
            return;
         }
   
  @@ -583,15 +584,15 @@
   
         log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from members " + targets);
         boolean successfulTransfer = false;
  -      for (Iterator iter = targets.iterator(); iter.hasNext()&&!successfulTransfer;)
  +      for (Iterator iter = targets.iterator(); iter.hasNext() && !successfulTransfer;)
         {
            Address target = (Address) iter.next();
            log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target);
            successfulTransfer = channel.getState(target, stateId, stateFetchTimeout);
  -         log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target  +(successfulTransfer?" successful": " failed"));
  +         log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target + (successfulTransfer ? " successful" : " failed"));
         }
   
  -      if(!successfulTransfer)
  +      if (!successfulTransfer)
         {
            log.debug("Node " + getLocalAddress() + " could not fetch partial state " + stateId + " from any member " + targets);
         }
  @@ -704,21 +705,7 @@
               MBeanServer server=(MBeanServer)servers.get(0);
               JmxConfigurator.registerChannel(channel, server, "JGroups:channel=" + channel.getChannelName() , true);
   */
  -            disp = new RpcDispatcher(channel, ml, this, this)
  -            {
  -               public Object handle(Message m)
  -               {
  -                  Object retVal = null;
  -                  retVal = super.handle(m);
  -                  if (retVal instanceof InactiveRegionException)
  -                  {
  -                     log.warn("Attempt to call a method on an inactive region is being ignored.");
  -                     return null;
  -                  }
  -
  -                  return retVal;
  -               }
  -            };
  +            disp = new InactiveRegionAwareRpcDispatcher(channel, ml, this, this);
               disp.setMarshaller(getMarshaller());
   
               setBuddyReplicationConfig(configuration.getBuddyReplicationConfig());
  @@ -3413,8 +3400,8 @@
         public byte[] getState(String state_id)
         {
            String sourceRoot = state_id;
  -         boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER)>0;                        
  -         if(hasDifferentSourceAndIntegrationRoots)
  +         boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER) > 0;
  +         if (hasDifferentSourceAndIntegrationRoots)
            {
               sourceRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMETER)[0];
            }                 
  @@ -3452,8 +3439,8 @@
         public void getState(String state_id, OutputStream ostream)
         {
            String sourceRoot = state_id;
  -         boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER)>0;        
  -         if(hasDifferentSourceAndIntegrationRoots)
  +         boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER) > 0;
  +         if (hasDifferentSourceAndIntegrationRoots)
            {
               sourceRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMETER)[0];
            }       
  @@ -3508,8 +3495,8 @@
         public void setState(String state_id, byte[] state)
         {
            String targetRoot = state_id;
  -         boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER)>0;               
  -         if(hasDifferentSourceAndIntegrationRoots)
  +         boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER) > 0;
  +         if (hasDifferentSourceAndIntegrationRoots)
            {
               targetRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMETER)[1];
            }              
  @@ -3518,11 +3505,11 @@
   
               if (state != null)            
               {
  -               my_log.debug("Setting received partial state for subroot " +state_id);
  +               my_log.debug("Setting received partial state for subroot " + state_id);
                  Fqn subroot = Fqn.fromString(targetRoot);
  -               Region region = regionManager.getRegion(subroot,false);                              
  +               Region region = regionManager.getRegion(subroot, false);
                  ClassLoader cl = null;
  -               if(region!= null)
  +               if (region != null)
                  {
                  // If a classloader is registered for the node's region, use it
                     cl = region.getClassLoader();
  @@ -3556,8 +3543,8 @@
         public void setState(String state_id, InputStream istream)
         {
            String targetRoot = state_id;
  -         boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER)>0;                 
  -         if(hasDifferentSourceAndIntegrationRoots)
  +         boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER) > 0;
  +         if (hasDifferentSourceAndIntegrationRoots)
            {
               targetRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMETER)[1];
            }
  @@ -3579,7 +3566,7 @@
                  {
                     my_log.debug("Setting received partial state for subroot " + state_id);
                     Fqn subroot = Fqn.fromString(targetRoot);
  -                  Region region = regionManager.getRegion(subroot,false);
  +               Region region = regionManager.getRegion(subroot, false);
                     ClassLoader cl = null;
                     if (region != null)
                     {
  
  
  



More information about the jboss-cvs-commits mailing list