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

Vladmir Blagojevic vladimir.blagojevic at jboss.com
Mon Jul 30 10:53:08 EDT 2007


  User: vblagojevic
  Date: 07/07/30 10:53:08

  Modified:    src/org/jboss/cache  CacheImpl.java
  Log:
  block dispatcher during FLUSH
  
  Revision  Changes    Path
  1.108     +18 -2     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.107
  retrieving revision 1.108
  diff -u -b -r1.107 -r1.108
  --- CacheImpl.java	27 Jul 2007 15:38:58 -0000	1.107
  +++ CacheImpl.java	30 Jul 2007 14:53:08 -0000	1.108
  @@ -44,6 +44,7 @@
   import org.jboss.cache.transaction.TransactionManagerLookup;
   import org.jboss.cache.transaction.TransactionTable;
   import org.jboss.cache.util.ExposedByteArrayOutputStream;
  +import org.jboss.cache.util.ThreadGate;
   import org.jboss.cache.util.concurrent.ConcurrentHashSet;
   import org.jboss.util.stream.MarshalledValueInputStream;
   import org.jboss.util.stream.MarshalledValueOutputStream;
  @@ -108,6 +109,11 @@
      private Log log = LogFactory.getLog(CacheImpl.class);
   
      /**
  +    * Thread gate used to block Dispatcher during JGroups FLUSH protocol 
  +    */
  +   private final ThreadGate flushBlockGate = new ThreadGate();
  +
  +   /**
       * Root node.
       */
      private NodeSPI<K, V> root;
  @@ -2021,7 +2027,7 @@
      public List callRemoteMethods(List<Address> mbrs, MethodCall method_call, int mode, boolean exclude_self, long timeout)
              throws Exception
      {
  -      RspList rsps;
  +      RspList rsps = null;
         Rsp rsp;
         List retval;
         Vector<Address> validMembers;
  @@ -2064,7 +2070,15 @@
            log.trace("callRemoteMethods(): valid members are " + validMembers + " methods: " + method_call.getArgs()[0]);
         }
   
  +      if(channel.flushSupported())
  +      {
  +          flushBlockGate.await(configuration.getSyncReplTimeout());
         rsps = disp.callRemoteMethods(validMembers, method_call, mode, timeout, buddyManager != null && buddyManager.isEnabled());
  +      }
  +      else
  +      {
  +          rsps = disp.callRemoteMethods(validMembers, method_call, mode, timeout, buddyManager != null && buddyManager.isEnabled());
  +      }
   
         // a null response is 99% likely to be due to a marshalling problem - we throw a NSE, this needs to be changed when
         // JGroups supports http://jira.jboss.com/jira/browse/JGRP-193
  @@ -3710,6 +3724,7 @@
          */
         public void block()
         {
  +         flushBlockGate.close(); 
            if (log.isDebugEnabled())
            {
               log.debug("Block received at " + getLocalAddress());
  @@ -3739,6 +3754,7 @@
            {
               log.debug("UnBlock processed at " + getLocalAddress());
            }
  +         flushBlockGate.open();
         }
   
      }
  
  
  



More information about the jboss-cvs-commits mailing list