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

Manik Surtani manik at jboss.org
Tue Jul 17 13:22:13 EDT 2007


  User: msurtani
  Date: 07/07/17 13:22:13

  Modified:    src/org/jboss/cache/loader/tcp   TcpCacheServer.java
  Added:       src/org/jboss/cache/loader/tcp   TcpCacheOperations.java
  Log:
  JBCACHE-1134
  
  Revision  Changes    Path
  1.30      +22 -23    JBossCache/src/org/jboss/cache/loader/tcp/TcpCacheServer.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TcpCacheServer.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/tcp/TcpCacheServer.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -b -r1.29 -r1.30
  --- TcpCacheServer.java	22 May 2007 20:12:40 -0000	1.29
  +++ TcpCacheServer.java	17 Jul 2007 17:22:13 -0000	1.30
  @@ -11,7 +11,6 @@
   import org.jboss.cache.Node;
   import org.jboss.cache.NodeSPI;
   import org.jboss.cache.jmx.CacheJmxWrapperMBean;
  -import org.jboss.cache.loader.DelegatingCacheLoader;
   
   import java.io.BufferedInputStream;
   import java.io.BufferedOutputStream;
  @@ -36,7 +35,7 @@
    *
    * @author Bela Ban
    * @author Brian Stansberry
  - * @version $Id: TcpCacheServer.java,v 1.29 2007/05/22 20:12:40 bstansberry Exp $
  + * @version $Id: TcpCacheServer.java,v 1.30 2007/07/17 17:22:13 msurtani Exp $
    */
   public class TcpCacheServer implements TcpCacheServerMBean
   {
  @@ -181,7 +180,7 @@
      public void stop()
      {
         running = false;
  -      synchronized(conns)
  +      synchronized (conns)
         {
            // Connection.close() removes conn from the list,
            // so copy off the list first to avoid ConcurrentModificationException
  @@ -210,7 +209,7 @@
   
      public String getConnections()
      {
  -      synchronized(conns)
  +      synchronized (conns)
         {
            StringBuffer sb = new StringBuffer();
            sb.append(conns.size()).append(" connections:\n");
  @@ -304,7 +303,7 @@
            {
               try
               {
  -               op = input.readInt();
  +               op = input.readByte();
               }
               catch (IOException e)
               {
  @@ -318,19 +317,19 @@
                  output.reset();
                  switch (op)
                  {
  -                  case DelegatingCacheLoader.delegateGetChildrenNames:
  +                  case TcpCacheOperations.GET_CHILDREN_NAMES:
                        fqn = (Fqn) input.readObject();
                        Node node = c.getRoot().getChild(fqn);
                        Set<Object> children = node == null ? Collections.emptySet() : node.getChildrenNames();
                        output.writeObject(children);
                        break;
  -                  case DelegatingCacheLoader.delegateGetKey:
  +                  case TcpCacheOperations.GET_KEY:
                        fqn = (Fqn) input.readObject();
                        key = input.readObject();
                        retval = c.get(fqn, key);
                        output.writeObject(retval);
                        break;
  -                  case DelegatingCacheLoader.delegateGet:
  +                  case TcpCacheOperations.GET:
                        fqn = (Fqn) input.readObject();
                        n = (NodeSPI) c.getRoot().getChild(fqn);
                        if (n == null)
  @@ -342,26 +341,26 @@
                        if (map == null) map = new HashMap();
                        output.writeObject(map);
                        break;
  -                  case DelegatingCacheLoader.delegateExists:
  +                  case TcpCacheOperations.EXISTS:
                        fqn = (Fqn) input.readObject();
                        flag = c.getRoot().hasChild(fqn);
                        output.writeObject(flag);
                        break;
  -                  case DelegatingCacheLoader.delegatePutKeyVal:
  +                  case TcpCacheOperations.PUT_KEY_VAL:
                        fqn = (Fqn) input.readObject();
                        key = input.readObject();
                        val = input.readObject();
                        retval = c.put(fqn, key, val);
                        output.writeObject(retval);
                        break;
  -                  case DelegatingCacheLoader.delegatePut:
  +                  case TcpCacheOperations.PUT:
                        fqn = (Fqn) input.readObject();
                        map = (Map) input.readObject();
                        c.put(fqn, map);
                        output.writeObject(Boolean.TRUE);
                        break;
   
  -                  case DelegatingCacheLoader.putList:
  +                  case TcpCacheOperations.PUT_LIST:
                        int length = input.readInt();
                        retval = Boolean.TRUE;
                        if (length > 0)
  @@ -385,18 +384,18 @@
                        }
                        output.writeObject(retval);
                        break;
  -                  case DelegatingCacheLoader.delegateRemoveKey:
  +                  case TcpCacheOperations.REMOVE_KEY:
                        fqn = (Fqn) input.readObject();
                        key = input.readObject();
                        retval = c.remove(fqn, key);
                        output.writeObject(retval);
                        break;
  -                  case DelegatingCacheLoader.delegateRemove:
  +                  case TcpCacheOperations.REMOVE:
                        fqn = (Fqn) input.readObject();
                        c.removeNode(fqn);
                        output.writeObject(Boolean.TRUE);
                        break;
  -                  case DelegatingCacheLoader.delegateRemoveData:
  +                  case TcpCacheOperations.REMOVE_DATA:
                        fqn = (Fqn) input.readObject();
                        node = c.getRoot().getChild(fqn);
                        if (node != null)
  @@ -410,7 +409,7 @@
                        }
   
                        break;
  -                  case DelegatingCacheLoader.delegateLoadEntireState:
  +                  case TcpCacheOperations.LOAD_ENTIRE_STATE:
                        ObjectOutputStream os = (ObjectOutputStream) input.readObject();
   
                        if (c.getCacheLoaderManager() != null)
  @@ -419,7 +418,7 @@
                        }
                        output.writeObject(Boolean.TRUE);
                        break;
  -                  case DelegatingCacheLoader.delegateStoreEntireState:
  +                  case TcpCacheOperations.STORE_ENTIRE_STATE:
                        ObjectInputStream is = (ObjectInputStream) input.readObject();
                        if (c.getCacheLoaderManager() != null)
                        {
  
  
  
  1.1      date: 2007/07/17 17:22:13;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/loader/tcp/TcpCacheOperations.java
  
  Index: TcpCacheOperations.java
  ===================================================================
  package org.jboss.cache.loader.tcp;
  
  /**
   * Statics that used to exist in the DelegatingCacheLoader class.
   *
   * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
   * @since 2.0.0
   */
  public interface TcpCacheOperations
  {
     int GET_CHILDREN_NAMES = 1;
     int GET_KEY = 2;
     int GET = 3;
     int EXISTS = 4;
     int PUT_KEY_VAL = 5;
     int PUT = 6;
     int REMOVE_KEY = 7;
     int REMOVE = 8;
     int REMOVE_DATA = 9;
     int LOAD_ENTIRE_STATE = 10;
     int STORE_ENTIRE_STATE = 11;
     int PUT_LIST = 12;
  }
  
  
  



More information about the jboss-cvs-commits mailing list