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

Vladmir Blagojevic vladimir.blagojevic at jboss.com
Thu Aug 24 18:05:34 EDT 2006


  User: vblagojevic
  Date: 06/08/24 18:05:34

  Modified:    src/org/jboss/cache  TreeCache.java
  Log:
  streaming state transfer integration (work in progress)
  
  Revision  Changes    Path
  1.227     +84 -2     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.226
  retrieving revision 1.227
  diff -u -b -r1.226 -r1.227
  --- TreeCache.java	24 Aug 2006 16:30:10 -0000	1.226
  +++ TreeCache.java	24 Aug 2006 22:05:34 -0000	1.227
  @@ -60,7 +60,9 @@
   import javax.transaction.TransactionManager;
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
  +import java.io.InputStream;
   import java.io.NotSerializableException;
  +import java.io.OutputStream;
   import java.lang.reflect.Method;
   import java.util.*;
   
  @@ -74,7 +76,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.226 2006/08/24 16:30:10 msurtani Exp $
  + * @version $Id: TreeCache.java,v 1.227 2006/08/24 22:05:34 vblagojevic Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  @@ -1453,6 +1455,11 @@
         return getStateTransferManager().getState(fqn, timeout, force, suppressErrors);
      }
   
  +   public void _getState(OutputStream os, Fqn fqn, long timeout, boolean force, boolean suppressErrors) throws Throwable
  +   {
  +      getStateTransferManager().getState(os,fqn, timeout, force, suppressErrors);      
  +   }
  +
      private void removeLocksForDeadMembers(DataNode node,
                                             Vector deadMembers)
      {
  @@ -3595,7 +3602,11 @@
           invocationContextContainer.set(ctx);
       }
   
  -    /*-------------------- MessageListener ----------------------*/
  +    /*
  +     * vladimir 24/08/06 Will change to ExtendedMessageListener 
  +     * after JGroups 2.4 CR2 is released
  +     * 
  +     * -------------------- MessageListener ----------------------*/
   
      class MessageListenerAdaptor implements MessageListener
      {
  @@ -3678,6 +3689,77 @@
            }
         }
   
  +      public byte[] getState(String state_id)
  +      {
  +         // TODO Auto-generated method stub
  +         return null;
  +      }
  +
  +      public void getState(OutputStream ostream)
  +      {
  +         try
  +         {
  +            _getState(ostream,Fqn.ROOT, configuration.getInitialStateRetrievalTimeout(), true, true);
  +         }
  +         catch (Throwable t)
  +         {
  +            // This shouldn't happen as we set "suppressErrors" to true,
  +            // but we have to catch the Throwable declared in the method sig
  +            my_log.error("Caught " + t.getClass().getName() +
  +               " while responding to initial state transfer request;" +
  +               " returning null", t);            
  +         }
  +      }
  +
  +      public void getState(String state_id, OutputStream ostream)
  +      {
  +         // TODO Auto-generated method stub
  +         
  +      }
  +
  +      public void setState(InputStream istream)
  +      {
  +         try
  +         {
  +
  +            if (istream == null)
  +               my_log.debug("stream is null (may be first member in cluster)");
  +            else
  +               getStateTransferManager().setState(istream, Fqn.ROOT, null);
  +
  +            isStateSet = true;
  +         }
  +         catch (Throwable t)
  +         {
  +            my_log.error("failed setting state", t);
  +            if (t instanceof Exception)
  +               setStateException = (Exception) t;
  +            else
  +               setStateException = new Exception(t);
  +         }
  +         finally
  +         {
  +            synchronized (stateLock)
  +            {
  +               // Notify wait that state has been set.
  +               stateLock.notifyAll();               
  +            }            
  +         }
  +         
  +      }
  +
  +      public void setState(String state_id, byte[] state)
  +      {
  +         // TODO Auto-generated method stub
  +         
  +      }
  +
  +      public void setState(String state_id, InputStream istream)
  +      {
  +         // TODO Auto-generated method stub
  +         
  +      }
  +
      }
   
      /*-------------------- End of MessageListener ----------------------*/
  
  
  



More information about the jboss-cvs-commits mailing list