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

Manik Surtani msurtani at jboss.com
Sat Dec 30 14:48:48 EST 2006


  User: msurtani
  Date: 06/12/30 14:48:48

  Modified:    src/org/jboss/cache/loader/tcp  TcpCacheServer.java
  Log:
  Genericised, autoboxed
  
  Revision  Changes    Path
  1.23      +13 -18    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.22
  retrieving revision 1.23
  diff -u -b -r1.22 -r1.23
  --- TcpCacheServer.java	30 Dec 2006 17:50:01 -0000	1.22
  +++ TcpCacheServer.java	30 Dec 2006 19:48:48 -0000	1.23
  @@ -27,7 +27,6 @@
   import java.net.UnknownHostException;
   import java.util.ArrayList;
   import java.util.HashMap;
  -import java.util.Iterator;
   import java.util.LinkedList;
   import java.util.List;
   import java.util.Map;
  @@ -37,7 +36,7 @@
    * TCP-IP based CacheServer, configure TcpDelegatingCacheLoader with host and port of this server
    *
    * @author Bela Ban
  - * @version $Id: TcpCacheServer.java,v 1.22 2006/12/30 17:50:01 msurtani Exp $
  + * @version $Id: TcpCacheServer.java,v 1.23 2006/12/30 19:48:48 msurtani Exp $
    */
   public class TcpCacheServer implements TcpCacheServerMBean
   {
  @@ -49,7 +48,7 @@
      ObjectName cache_name;
      String config;
      boolean running = true;
  -   final List conns = new LinkedList();
  +   final List<Connection> conns = new LinkedList<Connection>();
      String agendId;
      Thread serverThread;
      /**
  @@ -130,9 +129,6 @@
   
      public void start() throws Exception
      {
  -      Socket client_sock;
  -      Connection conn;
  -
         if (cache == null)
         {
            MBeanServer server = JmxUtil.getMBeanServer();
  @@ -208,9 +204,8 @@
      public void stop()
      {
         running = false;
  -      for (Iterator it = conns.iterator(); it.hasNext();)
  +      for (Connection conn : conns)
         {
  -         Connection conn = (Connection) it.next();
            conn.close();
         }
         conns.clear();
  @@ -224,6 +219,7 @@
            }
            catch (IOException e)
            {
  +            // nada
            }
         }
      }
  @@ -232,10 +228,9 @@
      public String getConnections()
      {
         StringBuffer sb = new StringBuffer();
  -      sb.append(conns.size() + " connections:\n");
  -      for (Iterator it = conns.iterator(); it.hasNext();)
  +      sb.append(conns.size()).append(" connections:\n");
  +      for (Connection c : conns)
         {
  -         Connection c = (Connection) it.next();
            sb.append(c).append("\n");
         }
         return sb.toString();
  @@ -288,6 +283,7 @@
            }
            catch (Throwable th)
            {
  +            // nada
            }
            try
            {
  @@ -295,6 +291,7 @@
            }
            catch (Throwable th)
            {
  +            // nada
            }
            try
            {
  @@ -302,6 +299,7 @@
            }
            catch (Throwable th)
            {
  +            // nada
            }
   
            // remove self from connections list
  @@ -313,10 +311,8 @@
            int op;
            Fqn fqn;
            Object key, val, retval;
  -         Map map;
            Node n;
            boolean flag;
  -         byte[] state;
   
            while (t != null && Thread.currentThread().equals(t))
            {
  @@ -355,7 +351,7 @@
                           output.writeObject(n);
                           break;
                        }
  -                     map = n.getData();
  +                     Map map = n.getData();
                        if (map == null) map = new HashMap();
                        output.writeObject(map);
                        break;
  @@ -384,7 +380,7 @@
                        if (length > 0)
                        {
                           Modification mod;
  -                        List mods = new ArrayList(length);
  +                        List<Modification> mods = new ArrayList<Modification>(length);
                           for (int i = 0; i < length; i++)
                           {
                              mod = new Modification();
  @@ -466,12 +462,11 @@
            return sb.toString();
         }
   
  -      protected void handleModifications(List modifications) throws CacheException
  +      protected void handleModifications(List<Modification> modifications) throws CacheException
         {
   
  -         for (Iterator it = modifications.iterator(); it.hasNext();)
  +         for (Modification m : modifications)
            {
  -            Modification m = (Modification) it.next();
               switch (m.getType())
               {
                  case PUT_DATA:
  
  
  



More information about the jboss-cvs-commits mailing list