commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1151575 [3/6] - in /commons/proper/jcs/trunk: ./ src/experimental/org/apache/jcs/engine/memory/arc/ src/java/org/apache/jcs/access/ src/java/org/apache/jcs/access/behavior/ src/java/org/apache/jcs/admin/ src/java/org/apache/jcs/auxiliary/ ...
Date Wed, 27 Jul 2011 18:08:57 GMT
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java Wed Jul 27 18:08:23 2011
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.io.Serializable;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -53,7 +52,7 @@ public class LateralCache
     private final static Log log = LogFactory.getLog( LateralCache.class );
 
     /** generalize this, use another interface */
-    private ILateralCacheAttributes lateralCacheAttribures;
+    private final ILateralCacheAttributes lateralCacheAttribures;
 
     /** The region name */
     final String cacheName;
@@ -96,6 +95,7 @@ public class LateralCache
      * @param ce
      * @throws IOException
      */
+    @Override
     protected void processUpdate( ICacheElement ce )
         throws IOException
     {
@@ -127,6 +127,7 @@ public class LateralCache
      * @return ICacheElement or null
      * @throws IOException
      */
+    @Override
     protected ICacheElement processGet( Serializable key )
         throws IOException
     {
@@ -154,14 +155,15 @@ public class LateralCache
      *         data in cache for any of these keys
      * @throws IOException
      */
-    protected Map processGetMatching( String pattern )
+    @Override
+    protected Map<Serializable, ICacheElement> processGetMatching( String pattern )
         throws IOException
     {
-        Map elements = new HashMap();
+        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
 
         if ( this.lateralCacheAttribures.getPutOnlyMode() )
         {
-            return Collections.EMPTY_MAP;
+            return Collections.emptyMap();
         }
         try
         {
@@ -183,19 +185,16 @@ public class LateralCache
      *         data in cache for any of these keys
      * @throws IOException
      */
-    protected Map processGetMultiple( Set keys )
+    @Override
+    protected Map<Serializable, ICacheElement> processGetMultiple( Set<Serializable> keys )
         throws IOException
     {
-        Map elements = new HashMap();
+        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
 
         if ( keys != null && !keys.isEmpty() )
         {
-            Iterator iterator = keys.iterator();
-
-            while ( iterator.hasNext() )
+            for (Serializable key : keys)
             {
-                Serializable key = (Serializable) iterator.next();
-
                 ICacheElement element = get( key );
 
                 if ( element != null )
@@ -213,7 +212,7 @@ public class LateralCache
      * @return A set of group keys.
      * @throws IOException
      */
-    public Set getGroupKeys( String groupName )
+    public Set<Serializable> getGroupKeys( String groupName )
         throws IOException
     {
         try
@@ -225,7 +224,7 @@ public class LateralCache
             handleException( ex, "Failed to remove groupName [" + groupName + "] from " + lateralCacheAttribures.getCacheName() + "@"
                 + lateralCacheAttribures );
         }
-        return Collections.EMPTY_SET;
+        return Collections.emptySet();
     }
 
     /**
@@ -236,6 +235,7 @@ public class LateralCache
      * @return false always
      * @throws IOException
      */
+    @Override
     protected boolean processRemove( Serializable key )
         throws IOException
     {
@@ -261,6 +261,7 @@ public class LateralCache
      * <p>
      * @throws IOException
      */
+    @Override
     protected void processRemoveAll()
         throws IOException
     {
@@ -279,6 +280,7 @@ public class LateralCache
      * <p>
      * @throws IOException
      */
+    @Override
     protected void processDispose()
         throws IOException
     {
@@ -421,6 +423,7 @@ public class LateralCache
     /**
      * @return debugging data.
      */
+    @Override
     public String toString()
     {
         StringBuffer buf = new StringBuffer();
@@ -433,6 +436,7 @@ public class LateralCache
     /**
      * @return extra data.
      */
+    @Override
     public String getEventLoggingExtraInfo()
     {
         return null;

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java Wed Jul 27 18:08:23 2011
@@ -21,7 +21,6 @@ package org.apache.jcs.auxiliary.lateral
 
 import java.io.IOException;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -59,7 +58,7 @@ public abstract class LateralCacheAbstra
     private final static Log log = LogFactory.getLog( LateralCacheAbstractManager.class );
 
     /** Each manager instance has caches.   */
-    protected final Map caches = new HashMap();
+    protected final Map<String, LateralCacheNoWait> caches = new HashMap<String, LateralCacheNoWait>();
 
     /** Configuration */
     protected ILateralCacheAttributes lca;
@@ -81,7 +80,7 @@ public abstract class LateralCacheAbstra
 
     /** The serializer. */
     protected IElementSerializer elementSerializer;
-    
+
     /**
      * Adds the lateral cache listener to the underlying cache-watch service.
      *
@@ -153,9 +152,8 @@ public abstract class LateralCacheAbstra
             // need to implement an observer for some types of laterals( http and
             // tcp)
             //this.lateralWatch.setCacheWatch(lateralWatch);
-            for ( Iterator en = this.caches.values().iterator(); en.hasNext(); )
+            for (LateralCacheNoWait cache : this.caches.values())
             {
-                LateralCacheNoWait cache = (LateralCacheNoWait) en.next();
                 cache.fixCache( this.lateralService );
             }
         }
@@ -163,9 +161,9 @@ public abstract class LateralCacheAbstra
 
     /**
      * @return Map
-     * 
+     *
      */
-    public Map getCaches()
+    public Map<String, LateralCacheNoWait> getCaches()
     {
         return caches;
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java Wed Jul 27 18:08:23 2011
@@ -19,8 +19,6 @@ package org.apache.jcs.auxiliary.lateral
  * under the License.
  */
 
-import java.util.Iterator;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
@@ -54,7 +52,7 @@ public class LateralCacheMonitor
     private static int mode = ERROR;
 
     /** The manager */
-    private ILateralCacheManager manager;
+    private final ILateralCacheManager manager;
 
     /**
      * Configures the idle period between repairs.
@@ -170,11 +168,9 @@ public class LateralCacheMonitor
             log.info( "LateralCacheManager.instances.size() = " + manager.getInstances().size() );
             //for
             int cnt = 0;
-            Iterator itr = manager.getInstances().values().iterator();
-            while ( itr.hasNext() )
+            for (ILateralCacheManager mgr : manager.getInstances().values())
             {
                 cnt++;
-                ILateralCacheManager mgr = (ILateralCacheManager) itr.next();
                 try
                 {
                     // If any cache is in error, it strongly suggests all caches
@@ -199,11 +195,8 @@ public class LateralCacheMonitor
                         }
                     }
 
-                    Iterator itr2 = mgr.getCaches().values().iterator();
-
-                    while ( itr2.hasNext() )
+                    for (LateralCacheNoWait c : mgr.getCaches().values())
                     {
-                        LateralCacheNoWait c = (LateralCacheNoWait) itr2.next();
                         if ( c.getStatus() == CacheConstants.STATUS_ERROR )
                         {
                             log.info( "found LateralCacheNoWait in error, " + c.toString() );

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java Wed Jul 27 18:08:23 2011
@@ -26,7 +26,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -168,18 +167,14 @@ public class LateralCacheNoWait
      * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
      *         data in cache for any of these keys
      */
-    public Map getMultiple( Set keys )
+    public Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
     {
-        Map elements = new HashMap();
+        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
 
         if ( keys != null && !keys.isEmpty() )
         {
-            Iterator iterator = keys.iterator();
-
-            while ( iterator.hasNext() )
+            for (Serializable key : keys)
             {
-                Serializable key = (Serializable) iterator.next();
-
                 ICacheElement element = get( key );
 
                 if ( element != null )
@@ -198,7 +193,7 @@ public class LateralCacheNoWait
      * @param pattern
      * @return ICacheElement if found, else empty
      */
-    public Map getMatching( String pattern )
+    public Map<Serializable, ICacheElement> getMatching(String pattern)
     {
         getCount++;
         if ( this.getStatus() != CacheConstants.STATUS_ERROR )
@@ -225,14 +220,14 @@ public class LateralCacheNoWait
                 eventQueue.destroy();
             }
         }
-        return Collections.EMPTY_MAP;
+        return Collections.emptyMap();
     }
 
     /**
      * @param groupName
      * @return Set
      */
-    public Set getGroupKeys( String groupName )
+    public Set<Serializable> getGroupKeys(String groupName)
     {
         try
         {
@@ -243,7 +238,7 @@ public class LateralCacheNoWait
             log.error( ex );
             eventQueue.destroy();
         }
-        return Collections.EMPTY_SET;
+        return Collections.emptySet();
     }
 
     /**
@@ -386,6 +381,7 @@ public class LateralCacheNoWait
      * <p>
      * @return String
      */
+    @Override
     public String getEventLoggingExtraInfo()
     {
         return "Lateral Cache No Wait";
@@ -399,7 +395,7 @@ public class LateralCacheNoWait
         IStats stats = new Stats();
         stats.setTypeName( "Lateral Cache No Wait" );
 
-        ArrayList elems = new ArrayList();
+        ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
 
         // IStatElement se = null;
         // no data gathered here
@@ -409,7 +405,7 @@ public class LateralCacheNoWait
         IStats eqStats = this.eventQueue.getStatistics();
 
         IStatElement[] eqSEs = eqStats.getStatElements();
-        List eqL = Arrays.asList( eqSEs );
+        List<IStatElement> eqL = Arrays.asList( eqSEs );
         elems.addAll( eqL );
 
         IStatElement se = null;
@@ -435,7 +431,7 @@ public class LateralCacheNoWait
         elems.add( se );
 
         // get an array and put them in the Stats object
-        IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[elems.size()] );
+        IStatElement[] ses = elems.toArray( new StatElement[elems.size()] );
         stats.setStatElements( ses );
 
         return stats;
@@ -444,6 +440,7 @@ public class LateralCacheNoWait
     /**
      * @return debugging info.
      */
+    @Override
     public String toString()
     {
         StringBuffer buf = new StringBuffer();

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java Wed Jul 27 18:08:23 2011
@@ -25,7 +25,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -62,10 +61,10 @@ public class LateralCacheNoWaitFacade
     public LateralCacheNoWait[] noWaits;
 
     /** The region name */
-    private String cacheName;
+    private final String cacheName;
 
     /** User configurable attributes. */
-    private ILateralCacheAttributes lateralCacheAttributes;
+    private final ILateralCacheAttributes lateralCacheAttributes;
 
     /**
      * Constructs with the given lateral cache, and fires events to any listeners.
@@ -160,7 +159,7 @@ public class LateralCacheNoWaitFacade
                 break;
             }
         }
-        
+
         if ( position == -1 )
         {
             return false;
@@ -240,18 +239,14 @@ public class LateralCacheNoWaitFacade
      * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
      *         data in cache for any of these keys
      */
-    public Map getMultiple( Set keys )
+    public Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
     {
-        Map elements = new HashMap();
+        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
 
         if ( keys != null && !keys.isEmpty() )
         {
-            Iterator iterator = keys.iterator();
-
-            while ( iterator.hasNext() )
+            for (Serializable key : keys)
             {
-                Serializable key = (Serializable) iterator.next();
-
                 ICacheElement element = get( key );
 
                 if ( element != null )
@@ -271,9 +266,9 @@ public class LateralCacheNoWaitFacade
      * @param pattern
      * @return ICacheElement
      */
-    public Map getMatching( String pattern )
+    public Map<Serializable, ICacheElement> getMatching(String pattern)
     {
-        Map elements = new HashMap();
+        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
         for ( int i = 0; i < noWaits.length; i++ )
         {
             try
@@ -292,9 +287,9 @@ public class LateralCacheNoWaitFacade
      * @param group
      * @return Set
      */
-    public Set getGroupKeys( String group )
+    public Set<Serializable> getGroupKeys( String group )
     {
-        HashSet allKeys = new HashSet();
+        HashSet<Serializable> allKeys = new HashSet<Serializable>();
         for ( int i = 0; i < noWaits.length; i++ )
         {
             AuxiliaryCache aux = noWaits[i];
@@ -422,6 +417,7 @@ public class LateralCacheNoWaitFacade
     /**
      * @return "LateralCacheNoWaitFacade: " + cacheName;
      */
+    @Override
     public String toString()
     {
         return "LateralCacheNoWaitFacade: " + cacheName;
@@ -432,6 +428,7 @@ public class LateralCacheNoWaitFacade
      * <p>
      * @return String
      */
+    @Override
     public String getEventLoggingExtraInfo()
     {
         return "Lateral Cache No Wait";
@@ -454,7 +451,7 @@ public class LateralCacheNoWaitFacade
         IStats stats = new Stats();
         stats.setTypeName( "Lateral Cache No Wait Facade" );
 
-        ArrayList elems = new ArrayList();
+        ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
 
         IStatElement se = null;
 
@@ -473,7 +470,7 @@ public class LateralCacheNoWaitFacade
                     // get as array, convert to list, add list to our outer list
                     IStats sStats = noWaits[i].getStatistics();
                     IStatElement[] sSEs = sStats.getStatElements();
-                    List sL = Arrays.asList( sSEs );
+                    List<IStatElement> sL = Arrays.asList( sSEs );
                     elems.addAll( sL );
                 }
             }
@@ -481,7 +478,7 @@ public class LateralCacheNoWaitFacade
         }
 
         // get an array and put them in the Stats object
-        IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[0] );
+        IStatElement[] ses = elems.toArray( new StatElement[0] );
         stats.setStatElements( ses );
 
         return stats;

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java Wed Jul 27 18:08:23 2011
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.Map;
 
 import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
+import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
 
 /**
  * This helps ensure some common behavior among LateraLCacheManagers for things
@@ -39,7 +40,7 @@ public interface ILateralCacheManager
      * <p>
      * @return Map
      */
-    public abstract Map getInstances();
+    public abstract Map<String, ? extends ILateralCacheManager> getInstances();
 
     /**
      * This is a temporary solution that allows the monitor to get caches from an
@@ -47,7 +48,7 @@ public interface ILateralCacheManager
      * <p>
      * @return Map
      */
-    public abstract Map getCaches();
+    public abstract Map<String, LateralCacheNoWait> getCaches();
 
     /**
      * The restore calls this on the manger if a cache if found to be in error.

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java Wed Jul 27 18:08:23 2011
@@ -66,11 +66,12 @@ public class LateralTCPCacheFactory
      * @param elementSerializer
      * @return AuxiliaryCache
      */
+    @Override
     public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr,
                                        ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
         ITCPLateralCacheAttributes lac = (ITCPLateralCacheAttributes) iaca;
-        ArrayList noWaits = new ArrayList();
+        ArrayList<ICache> noWaits = new ArrayList<ICache>();
 
         // pairs up the tcp servers and set the tcpServer value and
         // get the manager and then get the cache
@@ -111,7 +112,7 @@ public class LateralTCPCacheFactory
         createListener( (ILateralCacheAttributes) iaca, cacheMgr );
 
         // create the no wait facade.
-        LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
+        LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( noWaits
             .toArray( new LateralCacheNoWait[0] ), (ILateralCacheAttributes) iaca );
 
         // create udp discovery if available.
@@ -124,6 +125,7 @@ public class LateralTCPCacheFactory
      * @param lac
      * @param cacheMgr
      */
+    @Override
     public void createListener( ILateralCacheAttributes lac, ICompositeCacheManager cacheMgr )
     {
         ITCPLateralCacheAttributes attr = (ITCPLateralCacheAttributes) lac;

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java Wed Jul 27 18:08:23 2011
@@ -67,7 +67,8 @@ public class LateralTCPCacheManager
     private static LateralCacheMonitor monitor;
 
     /** Address to instance map. */
-    protected static Map instances = Collections.synchronizedMap( new HashMap() );
+    protected static Map<String, LateralTCPCacheManager> instances =
+        Collections.synchronizedMap( new HashMap<String, LateralTCPCacheManager>() );
 
     /** ITCPLateralCacheAttributes */
     protected ITCPLateralCacheAttributes lateralCacheAttribures;
@@ -87,7 +88,7 @@ public class LateralTCPCacheManager
     private LateralCacheWatchRepairable lateralWatch;
 
     /** This is set in the constructor. */
-    private ICompositeCacheManager cacheMgr;
+    private final ICompositeCacheManager cacheMgr;
 
     /**
      * Returns an instance of the LateralCacheManager.
@@ -105,12 +106,12 @@ public class LateralTCPCacheManager
         synchronized ( instances )
         {
             String key = lca.getTcpServer();
-            LateralTCPCacheManager ins = (LateralTCPCacheManager) instances.get( key );
+            LateralTCPCacheManager ins = instances.get( key );
             if ( ins == null )
             {
                 log.info( "Instance for [" + key + "] is null, creating" );
 
-                ins = (LateralTCPCacheManager) instances.get( lca.getTcpServer() );
+                ins = instances.get( lca.getTcpServer() );
                 if ( ins == null )
                 {
                     ins = new LateralTCPCacheManager( lca, cacheMgr, cacheEventLogger, elementSerializer );
@@ -213,6 +214,7 @@ public class LateralTCPCacheManager
      * @param listener The feature to be added to the LateralCacheListener attribute
      * @exception IOException
      */
+    @Override
     public void addLateralCacheListener( String cacheName, ILateralCacheListener listener )
         throws IOException
     {
@@ -234,12 +236,13 @@ public class LateralTCPCacheManager
      * @return AuxiliaryCache
      * @param cacheName
      */
+    @Override
     public AuxiliaryCache getCache( String cacheName )
     {
         LateralCacheNoWait lateralNoWait = null;
         synchronized ( caches )
         {
-            lateralNoWait = (LateralCacheNoWait) caches.get( cacheName );
+            lateralNoWait = caches.get( cacheName );
             if ( lateralNoWait == null )
             {
                 LateralCacheAttributes attr = (LateralCacheAttributes) lateralCacheAttribures.copy();
@@ -309,7 +312,7 @@ public class LateralTCPCacheManager
     /**
      * @return Map
      */
-    public Map getInstances()
+    public Map<String, ? extends ILateralCacheManager> getInstances()
     {
         return instances;
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java Wed Jul 27 18:08:23 2011
@@ -4,7 +4,6 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -36,16 +35,18 @@ public class LateralTCPDiscoveryListener
      * Map of no wait facades. these are used to determine which regions are locally configured to
      * use laterals.
      */
-    private Map facades = Collections.synchronizedMap( new HashMap() );
+    private final Map<String, LateralCacheNoWaitFacade> facades =
+        Collections.synchronizedMap( new HashMap<String, LateralCacheNoWaitFacade>() );
 
     /**
      * List of regions that are configured differently here than on another server. We keep track of
      * this to limit the amount of info logging.
      */
-    private Set knownDifferentlyConfiguredRegions = Collections.synchronizedSet( new HashSet() );
+    private final Set<String> knownDifferentlyConfiguredRegions =
+        Collections.synchronizedSet( new HashSet<String>() );
 
     /** The cache manager. */
-    private ICompositeCacheManager cacheMgr;
+    private final ICompositeCacheManager cacheMgr;
 
     /** The event logger. */
     protected ICacheEventLogger cacheEventLogger;
@@ -109,7 +110,7 @@ public class LateralTCPDiscoveryListener
      */
     public boolean containsNoWait( String cacheName, LateralCacheNoWait noWait )
     {
-        LateralCacheNoWaitFacade facade = (LateralCacheNoWaitFacade) facades.get( noWait.getCacheName() );
+        LateralCacheNoWaitFacade facade = facades.get( noWait.getCacheName() );
         if ( facade == null )
         {
             return false;
@@ -132,7 +133,7 @@ public class LateralTCPDiscoveryListener
      */
     protected boolean addNoWait( LateralCacheNoWait noWait )
     {
-        LateralCacheNoWaitFacade facade = (LateralCacheNoWaitFacade) facades.get( noWait.getCacheName() );
+        LateralCacheNoWaitFacade facade = facades.get( noWait.getCacheName() );
         if ( log.isDebugEnabled() )
         {
             log.debug( "addNoWait > Got facade for " + noWait.getCacheName() + " = " + facade );
@@ -171,7 +172,7 @@ public class LateralTCPDiscoveryListener
      */
     protected boolean removeNoWait( LateralCacheNoWait noWait )
     {
-        LateralCacheNoWaitFacade facade = (LateralCacheNoWaitFacade) facades.get( noWait.getCacheName() );
+        LateralCacheNoWaitFacade facade = facades.get( noWait.getCacheName() );
         if ( log.isDebugEnabled() )
         {
             log.debug( "removeNoWait > Got facade for " + noWait.getCacheName() + " = " + facade );
@@ -224,15 +225,12 @@ public class LateralTCPDiscoveryListener
         // we need the listener port from the original config.
         LateralTCPCacheManager lcm = findManagerForServiceEndPoint( service );
 
-        ArrayList regions = service.getCacheNames();
+        ArrayList<String> regions = service.getCacheNames();
         if ( regions != null )
         {
             // for each region get the cache
-            Iterator it = regions.iterator();
-            while ( it.hasNext() )
+            for (String cacheName : regions)
             {
-                String cacheName = (String) it.next();
-
                 try
                 {
                     ICache ic = lcm.getCache( cacheName );
@@ -279,15 +277,12 @@ public class LateralTCPDiscoveryListener
         // we need the listener port from the original config.
         LateralTCPCacheManager lcm = findManagerForServiceEndPoint( service );
 
-        ArrayList regions = service.getCacheNames();
+        ArrayList<String> regions = service.getCacheNames();
         if ( regions != null )
         {
             // for each region get the cache
-            Iterator it = regions.iterator();
-            while ( it.hasNext() )
+            for (String cacheName : regions)
             {
-                String cacheName = (String) it.next();
-
                 try
                 {
                     ICache ic = lcm.getCache( cacheName );

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerManager.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerManager.java Wed Jul 27 18:08:23 2011
@@ -12,17 +12,18 @@ import org.apache.jcs.engine.behavior.IE
 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
 
 /**
- * The factory holds an instance of this maanger. This manager has a map of listeners, keyed to the
+ * The factory holds an instance of this manager. This manager has a map of listeners, keyed to the
  * discovery configuration. I'm not using a static map, because I'm trying to make JCS
  * multi-instance.
  * <p>
  * During configuration, the factory is only created once per auxiliary definition. Two different
- * laterals canot use the same discovery service. We will likey wantt o change this.
+ * laterals cannot use the same discovery service. We will likely want to change this.
  */
 public class LateralTCPDiscoveryListenerManager
 {
     /** Map of available instances, keyed by port. Note, this is not static. */
-    protected Map instances = Collections.synchronizedMap( new HashMap() );
+    protected Map<String, LateralTCPDiscoveryListener> instances =
+        Collections.synchronizedMap( new HashMap<String, LateralTCPDiscoveryListener>() );
 
     /** The logger */
     private final static Log log = LogFactory.getLog( LateralTCPDiscoveryListenerManager.class );
@@ -51,7 +52,7 @@ public class LateralTCPDiscoveryListener
                                                                           IElementSerializer elementSerializer )
     {
         String key = ilca.getUdpDiscoveryAddr() + ":" + ilca.getUdpDiscoveryPort();
-        LateralTCPDiscoveryListener ins = (LateralTCPDiscoveryListener) instances.get( key );
+        LateralTCPDiscoveryListener ins = instances.get( key );
 
         if ( ins == null )
         {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Wed Jul 27 18:08:23 2011
@@ -28,6 +28,9 @@ import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -41,9 +44,6 @@ import org.apache.jcs.engine.behavior.IS
 import org.apache.jcs.engine.control.CompositeCache;
 import org.apache.jcs.engine.control.CompositeCacheManager;
 
-import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
-import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
-
 /**
  * Listens for connections from other TCP lateral caches and handles them. The initialization method
  * starts a listening thread, which creates a socket server. When messages are received they are
@@ -56,7 +56,7 @@ public class LateralTCPListener
     private static final long serialVersionUID = -9107062664967131738L;
 
     /** The logger */
-    private final static Log log = LogFactory.getLog( LateralTCPListener.class );
+    protected final static Log log = LogFactory.getLog( LateralTCPListener.class );
 
     /** How long the server will block on an accept(). 0 is infinite. */
     private final static int acceptTimeOut = 0;
@@ -65,7 +65,8 @@ public class LateralTCPListener
     private transient ICompositeCacheManager cacheManager;
 
     /** Map of available instances, keyed by port */
-    protected final static HashMap instances = new HashMap();
+    protected final static HashMap<String, ILateralCacheListener> instances =
+        new HashMap<String, ILateralCacheListener>();
 
     /** The socket listener */
     private ListenerThread receiver;
@@ -74,10 +75,10 @@ public class LateralTCPListener
     private ITCPLateralCacheAttributes tcpLateralCacheAttributes;
 
     /** Listening port */
-    private int port;
+    protected int port;
 
     /** The processor. We should probably use an event queue here. */
-    private PooledExecutor pooledExecutor;
+    protected ExecutorService pooledExecutor;
 
     /** put count */
     private int putCnt = 0;
@@ -95,7 +96,7 @@ public class LateralTCPListener
     private long listenerId = LateralCacheInfo.listenerId;
 
     /** is this shut down? */
-    private boolean shutdown = false;
+    protected boolean shutdown = false;
 
     /**
      * Gets the instance attribute of the LateralCacheTCPListener class.
@@ -107,7 +108,7 @@ public class LateralTCPListener
     public synchronized static ILateralCacheListener getInstance( ITCPLateralCacheAttributes ilca,
                                                                   ICompositeCacheManager cacheMgr )
     {
-        ILateralCacheListener ins = (ILateralCacheListener) instances.get( String.valueOf( ilca.getTcpListenerPort() ) );
+        ILateralCacheListener ins = instances.get( String.valueOf( ilca.getTcpListenerPort() ) );
 
         if ( ins == null )
         {
@@ -151,8 +152,7 @@ public class LateralTCPListener
             receiver.setDaemon( true );
             receiver.start();
 
-            pooledExecutor = new PooledExecutor();
-            pooledExecutor.setThreadFactory( new MyThreadFactory() );
+            pooledExecutor = Executors.newCachedThreadPool(new MyThreadFactory());
         }
         catch ( Exception ex )
         {
@@ -306,7 +306,7 @@ public class LateralTCPListener
      * @return Map
      * @throws IOException
      */
-    public Map handleGetMatching( String cacheName, String pattern )
+    public Map<Serializable, ICacheElement> handleGetMatching( String cacheName, String pattern )
         throws IOException
     {
         getCnt++;
@@ -434,6 +434,7 @@ public class LateralTCPListener
         extends Thread
     {
         /** Main processing method for the ListenerThread object */
+        @Override
         public void run()
         {
             try
@@ -480,7 +481,7 @@ public class LateralTCPListener
         implements Runnable
     {
         /** The socket connection, passed in via constructor */
-        private Socket socket;
+        private final Socket socket;
 
         /**
          * Construct for a given socket
@@ -622,23 +623,17 @@ public class LateralTCPListener
 
                 ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
 
-                if ( oos != null )
-                {
-                    oos.writeObject( obj );
-                    oos.flush();
-                }
+                oos.writeObject( obj );
+                oos.flush();
             }
             else if ( led.command == LateralElementDescriptor.GET_MATCHING )
             {
-                Map obj = handleGetMatching( cacheName, (String) key );
+                Map<Serializable, ICacheElement> obj = handleGetMatching( cacheName, (String) key );
 
                 ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
 
-                if ( oos != null )
-                {
-                    oos.writeObject( obj );
-                    oos.flush();
-                }
+                oos.writeObject( obj );
+                oos.flush();
             }
         }
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java Wed Jul 27 18:08:23 2011
@@ -25,7 +25,6 @@ import java.io.InputStreamReader;
 import java.io.Serializable;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -272,7 +271,7 @@ public class LateralTCPService
      *         data in cache matching the pattern.
      * @throws IOException
      */
-    public Map getMatching( String cacheName, String pattern )
+    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
         throws IOException
     {
         return getMatching( cacheName, pattern, getListenerId() );
@@ -288,7 +287,7 @@ public class LateralTCPService
      *         data in cache matching the pattern.
      * @throws IOException
      */
-    public Map getMatching( String cacheName, String pattern, long requesterId )
+    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
         throws IOException
     {
         // if get is not allowed return
@@ -302,9 +301,9 @@ public class LateralTCPService
             Object response = sender.sendAndReceive( led );
             if ( response != null )
             {
-                return (Map) response;
+                return (Map<Serializable, ICacheElement>) response;
             }
-            return Collections.EMPTY_MAP;
+            return Collections.emptyMap();
         }
         else
         {
@@ -322,7 +321,7 @@ public class LateralTCPService
      *         data in cache for any of these keys
      * @throws IOException
      */
-    public Map getMultiple( String cacheName, Set keys )
+    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
         throws IOException
     {
         return getMultiple( cacheName, keys, getListenerId() );
@@ -340,19 +339,15 @@ public class LateralTCPService
      *         data in cache for any of these keys
      * @throws IOException
      */
-    public Map getMultiple( String cacheName, Set keys, long requesterId )
+    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
         throws IOException
     {
-        Map elements = new HashMap();
+        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
 
         if ( keys != null && !keys.isEmpty() )
         {
-            Iterator iterator = keys.iterator();
-
-            while ( iterator.hasNext() )
+            for (Serializable key : keys)
             {
-                Serializable key = (Serializable) iterator.next();
-
                 ICacheElement element = get( cacheName, key );
 
                 if ( element != null )
@@ -371,7 +366,7 @@ public class LateralTCPService
      * @param group
      * @return Set
      */
-    public Set getGroupKeys( String cacheName, String group )
+    public Set<Serializable> getGroupKeys( String cacheName, String group )
     {
         if ( true )
         {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java Wed Jul 27 18:08:23 2011
@@ -179,7 +179,7 @@ public abstract class AbsractRemoteCache
             CompositeCache cache = cacheMgr.getCache( cb.getCacheName() );
 
             // Eventually the instance of will not be necessary.
-            if ( cb != null && cb instanceof ICacheElementSerialized )
+            if ( cb instanceof ICacheElementSerialized )
             {
                 if ( log.isDebugEnabled() )
                 {
@@ -324,6 +324,7 @@ public abstract class AbsractRemoteCache
      * <p>
      * @return Basic info on this listener.
      */
+    @Override
     public String toString()
     {
         StringBuffer buf = new StringBuffer();

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java Wed Jul 27 18:08:23 2011
@@ -21,12 +21,16 @@ package org.apache.jcs.auxiliary.remote;
 
 import java.io.IOException;
 import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -46,13 +50,8 @@ import org.apache.jcs.engine.stats.Stats
 import org.apache.jcs.engine.stats.behavior.IStatElement;
 import org.apache.jcs.engine.stats.behavior.IStats;
 import org.apache.jcs.utils.serialization.SerializationConversionUtil;
-import org.apache.jcs.utils.threadpool.ThreadPool;
 import org.apache.jcs.utils.threadpool.ThreadPoolManager;
 
-import EDU.oswego.cs.dl.util.concurrent.Callable;
-import EDU.oswego.cs.dl.util.concurrent.FutureResult;
-import EDU.oswego.cs.dl.util.concurrent.TimeoutException;
-
 /** Abstract base for remote caches. I'm trying to break out and reuse common functionality. */
 public abstract class AbstractRemoteAuxiliaryCache
     extends AbstractAuxiliaryCacheEventLogging
@@ -80,7 +79,7 @@ public abstract class AbstractRemoteAuxi
     private IRemoteCacheAttributes remoteCacheAttributes;
 
     /** A thread pool for gets if configured. */
-    private ThreadPool pool = null;
+    private ThreadPoolExecutor pool = null;
 
     /** Should we get asynchronously using a pool. */
     private boolean usePoolForGet = false;
@@ -133,6 +132,7 @@ public abstract class AbstractRemoteAuxi
      * <p>
      * @throws IOException
      */
+    @Override
     protected void processDispose()
         throws IOException
     {
@@ -167,6 +167,7 @@ public abstract class AbstractRemoteAuxi
      * @return ICacheElement, a wrapper around the key, value, and attributes
      * @throws IOException
      */
+    @Override
     protected ICacheElement processGet( Serializable key )
         throws IOException
     {
@@ -216,21 +217,21 @@ public abstract class AbstractRemoteAuxi
 
         try
         {
-            FutureResult future = new FutureResult();
-            Runnable command = future.setter( new Callable()
+            Callable<ICacheElement> command = new Callable<ICacheElement>()
             {
-                public Object call()
+                public ICacheElement call()
                     throws IOException
                 {
                     return getRemoteCacheService().get( cacheName, key, getListenerId() );
                 }
-            } );
+            };
 
             // execute using the pool
-            pool.execute( command );
+            Future<ICacheElement> future = pool.submit(command);
 
             // used timed get in order to timeout
-            ICacheElement ice = (ICacheElement) future.timedGet( timeout );
+            ICacheElement ice = future.get(timeout, TimeUnit.MILLISECONDS);
+
             if ( log.isDebugEnabled() )
             {
                 if ( ice == null )
@@ -254,10 +255,10 @@ public abstract class AbstractRemoteAuxi
             log.warn( "InterruptedException, Get Request timed out after " + timeout );
             throw new IOException( "Get Request timed out after " + timeout );
         }
-        catch ( InvocationTargetException ex )
+        catch (ExecutionException ex)
         {
             // assume that this is an IOException thrown by the callable.
-            log.error( "InvocationTargetException, Assuming an IO exception thrown in the background.", ex );
+            log.error( "ExecutionException, Assuming an IO exception thrown in the background.", ex );
             throw new IOException( "Get Request timed out after " + timeout );
         }
     }
@@ -269,28 +270,26 @@ public abstract class AbstractRemoteAuxi
      * @return Map
      * @throws IOException
      */
-    public Map processGetMatching( String pattern )
+    @Override
+    public Map<Serializable, ICacheElement> processGetMatching( String pattern )
         throws IOException
     {
-        Map results = new HashMap();
+        Map<Serializable, ICacheElement> results = new HashMap<Serializable, ICacheElement>();
         try
         {
-            Map rawResults = getRemoteCacheService().getMatching( cacheName, pattern, getListenerId() );
+            Map<Serializable, ICacheElement> rawResults = getRemoteCacheService().getMatching( cacheName, pattern, getListenerId() );
 
             // Eventually the instance of will not be necessary.
             if ( rawResults != null )
             {
-                Set entrySet = rawResults.entrySet();
-                Iterator it = entrySet.iterator();
-                while ( it.hasNext() )
+                for (Map.Entry<Serializable, ICacheElement> entry : rawResults.entrySet())
                 {
-                    Map.Entry entry = (Map.Entry) it.next();
                     ICacheElement unwrappedResult = null;
                     if ( entry.getValue() instanceof ICacheElementSerialized )
                     {
                         // Never try to deserialize if you are a cluster client. Cluster
                         // clients are merely intra-remote cache communicators. Remote caches are assumed
-                        // to have no ability to deserialze the objects.
+                        // to have no ability to deserialize the objects.
                         if ( this.getRemoteCacheAttributes().getRemoteType() != IRemoteCacheAttributes.CLUSTER )
                         {
                             unwrappedResult = SerializationConversionUtil
@@ -300,7 +299,7 @@ public abstract class AbstractRemoteAuxi
                     }
                     else
                     {
-                        unwrappedResult = (ICacheElement) entry.getValue();
+                        unwrappedResult = entry.getValue();
                     }
                     results.put( entry.getKey(), unwrappedResult );
                 }
@@ -322,18 +321,15 @@ public abstract class AbstractRemoteAuxi
      *         data in cache for any of these keys
      * @throws IOException
      */
-    protected Map processGetMultiple( Set keys )
+    @Override
+    protected Map<Serializable, ICacheElement> processGetMultiple( Set<Serializable> keys )
         throws IOException
     {
-        Map elements = new HashMap();
+        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
         if ( keys != null && !keys.isEmpty() )
         {
-            Iterator iterator = keys.iterator();
-
-            while ( iterator.hasNext() )
+            for (Serializable key : keys)
             {
-                Serializable key = (Serializable) iterator.next();
-
                 ICacheElement element = get( key );
 
                 if ( element != null )
@@ -353,6 +349,7 @@ public abstract class AbstractRemoteAuxi
      * @return boolean, whether or not the item was removed
      * @throws IOException
      */
+    @Override
     protected boolean processRemove( Serializable key )
         throws IOException
     {
@@ -381,6 +378,7 @@ public abstract class AbstractRemoteAuxi
      * <p>
      * @throws IOException
      */
+    @Override
     protected void processRemoveAll()
         throws IOException
     {
@@ -405,6 +403,7 @@ public abstract class AbstractRemoteAuxi
      * @param ce
      * @throws IOException
      */
+    @Override
     protected void processUpdate( ICacheElement ce )
         throws IOException
     {
@@ -450,16 +449,16 @@ public abstract class AbstractRemoteAuxi
      * @param groupName
      * @return Set
      * @throws java.rmi.RemoteException
-     * @throws IOException 
+     * @throws IOException
      */
-    public Set getGroupKeys( String groupName )
+    public Set<Serializable> getGroupKeys( String groupName )
         throws java.rmi.RemoteException, IOException
     {
         return getRemoteCacheService().getGroupKeys( cacheName, groupName );
     }
 
     /**
-     * Allows other member of this package to access the listerner. This is mainly needed for
+     * Allows other member of this package to access the listener. This is mainly needed for
      * deregistering a listener.
      * <p>
      * @return IRemoteCacheListener, the listener for this remote server
@@ -550,7 +549,7 @@ public abstract class AbstractRemoteAuxi
     {
         return getStatistics().toString();
     }
-    
+
     /**
      * @return IStats object
      */
@@ -559,7 +558,7 @@ public abstract class AbstractRemoteAuxi
         IStats stats = new Stats();
         stats.setTypeName( "AbstractRemoteAuxiliaryCache" );
 
-        ArrayList elems = new ArrayList();
+        ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
 
         IStatElement se = null;
 
@@ -584,12 +583,12 @@ public abstract class AbstractRemoteAuxi
         {
             se = new StatElement();
             se.setName( "Pool Size" );
-            se.setData( "" + pool.getPool().getPoolSize() );
+            se.setData( "" + pool.getPoolSize() );
             elems.add( se );
 
             se = new StatElement();
             se.setName( "Maximum Pool Size" );
-            se.setData( "" + pool.getPool().getMaximumPoolSize() );
+            se.setData( "" + pool.getMaximumPoolSize() );
             elems.add( se );
         }
 
@@ -602,7 +601,7 @@ public abstract class AbstractRemoteAuxi
         }
 
         // get an array and put them in the Stats object
-        IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[0] );
+        IStatElement[] ses = elems.toArray( new StatElement[0] );
         stats.setStatElements( ses );
 
         return stats;
@@ -654,7 +653,7 @@ public abstract class AbstractRemoteAuxi
         return;
     }
 
-    
+
     /**
      * Gets the cacheType attribute of the RemoteCache object
      * @return The cacheType value

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java Wed Jul 27 18:08:23 2011
@@ -61,7 +61,7 @@ public abstract class AbstractRemoteCach
     public RemoteCacheNoWait[] noWaits;
 
     /** The cache name */
-    private String cacheName;
+    private final String cacheName;
 
     /** holds failover and cluster information */
     protected IRemoteCacheAttributes remoteCacheAttributes;
@@ -179,7 +179,7 @@ public abstract class AbstractRemoteCach
      * @return map
      * @throws IOException
      */
-    public Map getMatching( String pattern )
+    public Map<Serializable, ICacheElement> getMatching( String pattern )
         throws IOException
     {
         for ( int i = 0; i < noWaits.length; i++ )
@@ -191,10 +191,10 @@ public abstract class AbstractRemoteCach
             catch ( Exception ex )
             {
                 log.debug( "Failed to getMatching." );
-                return Collections.EMPTY_MAP;
+                return Collections.emptyMap();
             }
         }
-        return Collections.EMPTY_MAP;
+        return Collections.emptyMap();
     }
 
     /**
@@ -204,7 +204,7 @@ public abstract class AbstractRemoteCach
      * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
      *         data in cache for any of these keys
      */
-    public Map getMultiple( Set keys )
+    public Map<Serializable, ICacheElement> getMultiple( Set<Serializable> keys )
     {
         if ( keys != null && !keys.isEmpty() )
         {
@@ -217,11 +217,11 @@ public abstract class AbstractRemoteCach
                 catch ( Exception ex )
                 {
                     log.debug( "Failed to get." );
-                    return Collections.EMPTY_MAP;
+                    return Collections.emptyMap();
                 }
             }
         }
-        return new HashMap();
+        return new HashMap<Serializable, ICacheElement>();
     }
 
     /**
@@ -231,10 +231,10 @@ public abstract class AbstractRemoteCach
      * @return the set of keys of objects currently in the group
      * @throws IOException
      */
-    public Set getGroupKeys( String group )
+    public Set<Serializable> getGroupKeys( String group )
         throws IOException
     {
-        HashSet allKeys = new HashSet();
+        HashSet<Serializable> allKeys = new HashSet<Serializable>();
         for ( int i = 0; i < noWaits.length; i++ )
         {
             AuxiliaryCache aux = noWaits[i];
@@ -357,6 +357,7 @@ public abstract class AbstractRemoteCach
      * <p>
      * @return Some info for logging.
      */
+    @Override
     public String toString()
     {
         return "RemoteCacheNoWaitFacade: " + cacheName + ", rca = " + remoteCacheAttributes;
@@ -368,7 +369,7 @@ public abstract class AbstractRemoteCach
      * @param i The no wait in error.
      */
     abstract void failover( int i );
-    
+
 
     /**
      * @return Returns the AuxiliaryCacheAttributes.
@@ -395,7 +396,7 @@ public abstract class AbstractRemoteCach
         IStats stats = new Stats();
         stats.setTypeName( "Remote Cache No Wait Facade" );
 
-        ArrayList elems = new ArrayList();
+        ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
 
         IStatElement se = null;
 
@@ -412,13 +413,13 @@ public abstract class AbstractRemoteCach
                 // get as array, convert to list, add list to our outer list
                 IStats sStats = noWaits[i].getStatistics();
                 IStatElement[] sSEs = sStats.getStatElements();
-                List sL = Arrays.asList( sSEs );
+                List<IStatElement> sL = Arrays.asList( sSEs );
                 elems.addAll( sL );
             }
         }
 
         // get an array and put them in the Stats object
-        IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[0] );
+        IStatElement[] ses = elems.toArray( new StatElement[0] );
         stats.setStatElements( ses );
 
         return stats;
@@ -429,11 +430,12 @@ public abstract class AbstractRemoteCach
      * <p>
      * @return the name
      */
+    @Override
     public String getEventLoggingExtraInfo()
     {
         return "Remote Cache No Wait Facade";
     }
-    
+
     /**
      * Gets the remoteCacheAttributes attribute of the RemoteCacheNoWaitFacade object
      * <p>

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java Wed Jul 27 18:08:23 2011
@@ -69,12 +69,13 @@ public class RemoteCache
     /**
      * @return IStats object
      */
+    @Override
     public IStats getStatistics()
     {
         IStats stats = new Stats();
         stats.setTypeName( "Remote Cache No Wait" );
 
-        ArrayList elems = new ArrayList();
+        ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
 
         IStatElement se = null;
 
@@ -97,11 +98,11 @@ public class RemoteCache
         // get as array, convert to list, add list to our outer list
         IStats sStats = super.getStatistics();
         IStatElement[] sSEs = sStats.getStatElements();
-        List sL = Arrays.asList( sSEs );
+        List<IStatElement> sL = Arrays.asList( sSEs );
         elems.addAll( sL );
 
         // get an array and put them in the Stats object
-        IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[0] );
+        IStatElement[] ses = elems.toArray( new StatElement[0] );
         stats.setStatElements( ses );
 
         return stats;
@@ -116,6 +117,7 @@ public class RemoteCache
      * @param eventName
      * @throws IOException
      */
+    @Override
     protected void handleException( Exception ex, String msg, String eventName )
         throws IOException
     {
@@ -167,6 +169,7 @@ public class RemoteCache
      * <p>
      * @return basic info about the RemoteCache
      */
+    @Override
     public String toString()
     {
         return "RemoteCache: " + cacheName + " attributes = " + getRemoteCacheAttributes();
@@ -177,6 +180,7 @@ public class RemoteCache
      * <p>
      * @return disk location
      */
+    @Override
     public String getEventLoggingExtraInfo()
     {
         return getIPAddressForService();

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java Wed Jul 27 18:08:23 2011
@@ -49,7 +49,8 @@ public class RemoteCacheFactory
     private String name;
 
     /** store reference of facades to initiate failover */
-    private final static HashMap facades = new HashMap();
+    private final static HashMap<String, RemoteCacheNoWaitFacade> facades =
+        new HashMap<String, RemoteCacheNoWaitFacade>();
 
     /**
      * For LOCAL clients we get a handle to all the failovers, but we do not register a listener
@@ -69,13 +70,13 @@ public class RemoteCacheFactory
     {
         RemoteCacheAttributes rca = (RemoteCacheAttributes) iaca;
 
-        ArrayList noWaits = new ArrayList();
+        ArrayList<ICache> noWaits = new ArrayList<ICache>();
 
         // if LOCAL
         if ( rca.getRemoteType() == RemoteCacheAttributes.LOCAL )
         {
             // a list to be turned into an array of failover server information
-            ArrayList failovers = new ArrayList();
+            ArrayList<String> failovers = new ArrayList<String>();
 
             // not necessary if a failover list is defined
             // REGISTER PRIMARY LISTENER
@@ -136,7 +137,7 @@ public class RemoteCacheFactory
             }
             // end if failoverList != null
 
-            rca.setFailovers( (String[]) failovers.toArray( new String[0] ) );
+            rca.setFailovers( failovers.toArray( new String[0] ) );
 
             // if CLUSTER
         }
@@ -168,7 +169,7 @@ public class RemoteCacheFactory
         }
         // end if CLUSTER
 
-        RemoteCacheNoWaitFacade rcnwf = new RemoteCacheNoWaitFacade( (RemoteCacheNoWait[]) noWaits
+        RemoteCacheNoWaitFacade rcnwf = new RemoteCacheNoWaitFacade( noWaits
             .toArray( new RemoteCacheNoWait[0] ), rca, cacheMgr, cacheEventLogger, elementSerializer );
 
         getFacades().put( rca.getCacheName(), rcnwf );
@@ -200,7 +201,7 @@ public class RemoteCacheFactory
      * The facades are what the cache hub talks to.
      * @return Returns the facades.
      */
-    public static HashMap getFacades()
+    public static HashMap<String, RemoteCacheNoWaitFacade> getFacades()
     {
         return facades;
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java Wed Jul 27 18:08:23 2011
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.rmi.Naming;
 import java.rmi.registry.Registry;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -60,7 +59,7 @@ public class RemoteCacheManager
     private final static Log log = LogFactory.getLog( RemoteCacheManager.class );
 
     /** Contains mappings of Location instance to RemoteCacheManager instance. */
-    final static Map instances = new HashMap();
+    final static Map<Location, RemoteCacheManager> instances = new HashMap<Location, RemoteCacheManager>();
 
     /** Monitors connections. */
     private static RemoteCacheMonitor monitor;
@@ -69,7 +68,7 @@ public class RemoteCacheManager
     private int clients;
 
     /** Contains instances of RemoteCacheNoWait managed by a RemoteCacheManager instance. */
-    final Map caches = new HashMap();
+    final Map<String, RemoteCacheNoWait> caches = new HashMap<String, RemoteCacheNoWait>();
 
     /** The remote host */
     final String host;
@@ -84,10 +83,10 @@ public class RemoteCacheManager
     private IRemoteCacheAttributes remoteCacheAttributes;
 
     /** The event logger. */
-    private ICacheEventLogger cacheEventLogger;
+    private final ICacheEventLogger cacheEventLogger;
 
     /** The serializer. */
-    private IElementSerializer elementSerializer;
+    private final IElementSerializer elementSerializer;
 
     /** Handle to the remote cache service; or a zombie handle if failed to connect. */
     private IRemoteCacheService remoteService;
@@ -99,7 +98,7 @@ public class RemoteCacheManager
     private RemoteCacheWatchRepairable remoteWatch;
 
     /** The cache manager listeners will need to use to get a cache. */
-    private ICompositeCacheManager cacheMgr;
+    private final ICompositeCacheManager cacheMgr;
 
     /** The service found through lookup */
     //private String registry;
@@ -248,7 +247,7 @@ public class RemoteCacheManager
     {
         synchronized ( caches )
         {
-            RemoteCacheNoWait cache = (RemoteCacheNoWait) caches.get( cattr.getCacheName() );
+            RemoteCacheNoWait cache = caches.get( cattr.getCacheName() );
             if ( cache != null )
             {
                 IRemoteCacheClient rc = cache.getRemoteCache();
@@ -290,7 +289,7 @@ public class RemoteCacheManager
     {
         synchronized ( caches )
         {
-            RemoteCacheNoWait cache = (RemoteCacheNoWait) caches.get( cacheName );
+            RemoteCacheNoWait cache = caches.get( cacheName );
             if ( cache != null )
             {
                 IRemoteCacheClient rc = cache.getRemoteCache();
@@ -342,7 +341,7 @@ public class RemoteCacheManager
         RemoteCacheManager ins = null;
         synchronized ( instances )
         {
-            ins = (RemoteCacheManager) instances.get( loc );
+            ins = instances.get( loc );
             if ( ins == null )
             {
                 // Change to use cattr and to set defaults
@@ -398,7 +397,7 @@ public class RemoteCacheManager
 
         synchronized ( caches )
         {
-            remoteCacheNoWait = (RemoteCacheNoWait) caches.get( cattr.getCacheName() );
+            remoteCacheNoWait = caches.get( cattr.getCacheName() );
             if ( remoteCacheNoWait == null )
             {
                 // create a listener first and pass it to the remotecache
@@ -453,7 +452,7 @@ public class RemoteCacheManager
         ICache c = null;
         synchronized ( caches )
         {
-            c = (ICache) caches.get( name );
+            c = caches.get( name );
         }
         if ( c != null )
         {
@@ -470,10 +469,8 @@ public class RemoteCacheManager
     public String getStats()
     {
         StringBuffer stats = new StringBuffer();
-        Iterator allCaches = caches.values().iterator();
-        while ( allCaches.hasNext() )
+        for (RemoteCacheNoWait c : caches.values())
         {
-            ICache c = (ICache) allCaches.next();
             if ( c != null )
             {
                 stats.append( c.getCacheName() );
@@ -492,10 +489,8 @@ public class RemoteCacheManager
         }
         synchronized ( caches )
         {
-            Iterator allCaches = caches.values().iterator();
-            while ( allCaches.hasNext() )
+            for (RemoteCacheNoWait c : caches.values())
             {
-                ICache c = (ICache) allCaches.next();
                 if ( c != null )
                 {
                     try
@@ -528,10 +523,9 @@ public class RemoteCacheManager
         {
             this.remoteService = remoteService;
             this.remoteWatch.setCacheWatch( remoteWatch );
-            for ( Iterator en = caches.values().iterator(); en.hasNext(); )
+            for (RemoteCacheNoWait c : caches.values())
             {
-                RemoteCacheNoWait cache = (RemoteCacheNoWait) en.next();
-                cache.fixCache( this.remoteService );
+                c.fixCache( this.remoteService );
             }
         }
     }
@@ -572,6 +566,7 @@ public class RemoteCacheManager
          * @param obj
          * @return true if the host and port are equal
          */
+        @Override
         public boolean equals( Object obj )
         {
             if ( obj == this )
@@ -593,6 +588,7 @@ public class RemoteCacheManager
         /**
          * @return int
          */
+        @Override
         public int hashCode()
         {
             return host == null ? port : host.hashCode() ^ port;

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java Wed Jul 27 18:08:23 2011
@@ -19,8 +19,6 @@ package org.apache.jcs.auxiliary.remote;
  * under the License.
  */
 
-import java.util.Iterator;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.engine.CacheConstants;
@@ -177,35 +175,30 @@ public class RemoteCacheMonitor
             //p("cache monitor running.");
             // Monitor each RemoteCacheManager instance one after the other.
             // Each RemoteCacheManager corresponds to one remote connection.
-            for ( Iterator itr = RemoteCacheManager.instances.values().iterator(); itr.hasNext(); )
+            for (RemoteCacheManager mgr : RemoteCacheManager.instances.values())
             {
-                RemoteCacheManager mgr = (RemoteCacheManager) itr.next();
                 try
                 {
                     // If any cache is in error, it strongly suggests all caches
                     // managed by the
                     // same RmicCacheManager instance are in error. So we fix
                     // them once and for all.
-                    for ( Iterator itr2 = mgr.caches.values().iterator(); itr2.hasNext(); )
+                    for (RemoteCacheNoWait c : mgr.caches.values())
                     {
-                        if ( itr2.hasNext() )
+                        if ( c.getStatus() == CacheConstants.STATUS_ERROR )
                         {
-                            RemoteCacheNoWait c = (RemoteCacheNoWait) itr2.next();
-                            if ( c.getStatus() == CacheConstants.STATUS_ERROR )
+                            RemoteCacheRestore repairer = new RemoteCacheRestore( mgr );
+                            // If we can't fix them, just skip and re-try in
+                            // the next round.
+                            if ( repairer.canFix() )
+                            {
+                                repairer.fix();
+                            }
+                            else
                             {
-                                RemoteCacheRestore repairer = new RemoteCacheRestore( mgr );
-                                // If we can't fix them, just skip and re-try in
-                                // the next round.
-                                if ( repairer.canFix() )
-                                {
-                                    repairer.fix();
-                                }
-                                else
-                                {
-                                    bad();
-                                }
-                                break;
+                                bad();
                             }
+                            break;
                         }
                     }
                 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java Wed Jul 27 18:08:23 2011
@@ -186,12 +186,12 @@ public class RemoteCacheNoWait
     }
 
     /**
-     * @param pattern 
+     * @param pattern
      * @return Map
-     * @throws IOException 
-     * 
+     * @throws IOException
+     *
      */
-    public Map getMatching( String pattern )
+    public Map<Serializable, ICacheElement> getMatching( String pattern )
         throws IOException
     {
         getMatchingCount++;
@@ -226,7 +226,7 @@ public class RemoteCacheNoWait
             throw ex;
         }
 
-        return Collections.EMPTY_MAP;
+        return Collections.emptyMap();
     }
 
     /**
@@ -238,7 +238,7 @@ public class RemoteCacheNoWait
      *         data in cache for any of these keys
      * @throws IOException
      */
-    public Map getMultiple( Set keys )
+    public Map<Serializable, ICacheElement> getMultiple( Set<Serializable> keys )
         throws IOException
     {
         getMultipleCount++;
@@ -273,7 +273,7 @@ public class RemoteCacheNoWait
             throw ex;
         }
 
-        return new HashMap();
+        return new HashMap<Serializable, ICacheElement>();
     }
 
     /**
@@ -281,7 +281,7 @@ public class RemoteCacheNoWait
      * @return the keys for the group name
      * @throws IOException
      */
-    public Set getGroupKeys( String groupName )
+    public Set<Serializable> getGroupKeys( String groupName )
         throws IOException
     {
         return remoteCacheClient.getGroupKeys( groupName );
@@ -460,6 +460,7 @@ public class RemoteCacheNoWait
      * (non-Javadoc)
      * @see java.lang.Object#toString()
      */
+    @Override
     public String toString()
     {
         return getStats() + "\n" + remoteCacheClient.toString();
@@ -483,7 +484,7 @@ public class RemoteCacheNoWait
         IStats stats = new Stats();
         stats.setTypeName( "Remote Cache No Wait" );
 
-        ArrayList elems = new ArrayList();
+        ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
 
         IStatElement se = null;
 
@@ -516,7 +517,7 @@ public class RemoteCacheNoWait
         if ( cStats != null )
         {
             IStatElement[] cSEs = cStats.getStatElements();
-            List cL = Arrays.asList( cSEs );
+            List<IStatElement> cL = Arrays.asList( cSEs );
             elems.addAll( cL );
         }
 
@@ -524,7 +525,7 @@ public class RemoteCacheNoWait
         // get as array, convert to list, add list to our outer list
         IStats eqStats = this.cacheEventQueue.getStatistics();
         IStatElement[] eqSEs = eqStats.getStatElements();
-        List eqL = Arrays.asList( eqSEs );
+        List<IStatElement> eqL = Arrays.asList( eqSEs );
         elems.addAll( eqL );
 
         se = new StatElement();
@@ -553,7 +554,7 @@ public class RemoteCacheNoWait
         elems.add( se );
 
         // get an array and put them in the Stats object
-        IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[elems.size()] );
+        IStatElement[] ses = elems.toArray( new StatElement[elems.size()] );
         stats.setStatElements( ses );
 
         return stats;
@@ -564,6 +565,7 @@ public class RemoteCacheNoWait
      * <p>
      * @return String
      */
+    @Override
     public String getEventLoggingExtraInfo()
     {
         return "Remote Cache No Wait";

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java Wed Jul 27 18:08:23 2011
@@ -64,6 +64,7 @@ public class RemoteCacheNoWaitFacade
      * <p>
      * @param i The no wait in error.
      */
+    @Override
     protected void failover( int i )
     {
         if ( log.isDebugEnabled() )
@@ -78,15 +79,10 @@ public class RemoteCacheNoWaitFacade
                 // start failover, primary recovery process
                 RemoteCacheFailoverRunner runner = new RemoteCacheFailoverRunner( this, getCompositeCacheManager(),
                                                                                   cacheEventLogger, elementSerializer );
-                // If the returned monitor is null, it means it's already
-                // started elsewhere.
-                if ( runner != null )
-                {
-                    runner.notifyError();
-                    Thread t = new Thread( runner );
-                    t.setDaemon( true );
-                    t.start();
-                }
+                runner.notifyError();
+                Thread t = new Thread( runner );
+                t.setDaemon( true );
+                t.start();
 
                 if ( getCacheEventLogger() != null )
                 {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteUtils.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteUtils.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteUtils.java Wed Jul 27 18:08:23 2011
@@ -104,21 +104,14 @@ public class RemoteUtils
 
             if ( log.isDebugEnabled() )
             {
-                if ( props != null )
+                Enumeration<Object> en = props.keys();
+                StringBuffer buf = new StringBuffer();
+                while ( en.hasMoreElements() )
                 {
-                    Enumeration en = props.keys();
-                    StringBuffer buf = new StringBuffer();
-                    while ( en.hasMoreElements() )
-                    {
-                        String key = (String) en.nextElement();
-                        buf.append( "\n" + key + " = " + props.getProperty( key ) );
-                    }
-                    log.debug( buf.toString() );
-                }
-                else
-                {
-                    log.debug( "props is null" );
+                    String key = (String) en.nextElement();
+                    buf.append( "\n" + key + " = " + props.getProperty( key ) );
                 }
+                log.debug( buf.toString() );
             }
 
         }
@@ -158,6 +151,7 @@ public class RemoteUtils
                 // use this socket factory to add a timeout.
                 RMISocketFactory.setSocketFactory( new RMISocketFactory()
                 {
+                    @Override
                     public Socket createSocket( String host, int port )
                         throws IOException
                     {
@@ -168,6 +162,7 @@ public class RemoteUtils
                         return socket;
                     }
 
+                    @Override
                     public ServerSocket createServerSocket( int port )
                         throws IOException
                     {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java Wed Jul 27 18:08:23 2011
@@ -130,7 +130,7 @@ public class RemoteHttpCacheClient
         ICacheElement retval = null;
         if ( remoteHttpCacheResponse != null && remoteHttpCacheResponse.getPayload() != null )
         {
-            retval = (ICacheElement) remoteHttpCacheResponse.getPayload().get( key );
+            retval = (ICacheElement)remoteHttpCacheResponse.getPayload().get( key );
         }
         return retval;
     }
@@ -144,7 +144,7 @@ public class RemoteHttpCacheClient
      *         data in cache matching the pattern.
      * @throws IOException
      */
-    public Map getMatching( String cacheName, String pattern )
+    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
         throws IOException
     {
         return getMatching( cacheName, pattern, 0 );
@@ -160,7 +160,7 @@ public class RemoteHttpCacheClient
      *         data in cache matching the pattern.
      * @throws IOException
      */
-    public Map getMatching( String cacheName, String pattern, long requesterId )
+    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
         throws IOException
     {
         if ( !isInitialized() )
@@ -181,7 +181,7 @@ public class RemoteHttpCacheClient
             log.debug( "GetMatching [" + pattern + "] = " + remoteHttpCacheResponse );
         }
 
-        return remoteHttpCacheResponse.getPayload();
+        return (Map)remoteHttpCacheResponse.getPayload();
     }
 
     /**
@@ -193,7 +193,7 @@ public class RemoteHttpCacheClient
      *         data in cache for any of these keys
      * @throws IOException
      */
-    public Map getMultiple( String cacheName, Set keys )
+    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
         throws IOException
     {
         return getMultiple( cacheName, keys, 0 );
@@ -209,7 +209,7 @@ public class RemoteHttpCacheClient
      *         data in cache for any of these keys
      * @throws IOException
      */
-    public Map getMultiple( String cacheName, Set keys, long requesterId )
+    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
         throws IOException
     {
         if ( !isInitialized() )
@@ -230,7 +230,7 @@ public class RemoteHttpCacheClient
             log.debug( "GetMultiple [" + keys + "] = " + remoteHttpCacheResponse );
         }
 
-        return remoteHttpCacheResponse.getPayload();
+        return (Map)remoteHttpCacheResponse.getPayload();
     }
 
     /**
@@ -271,7 +271,7 @@ public class RemoteHttpCacheClient
     }
 
     /**
-     * Remove all keys from the sepcified cache.
+     * Remove all keys from the specified cache.
      * <p>
      * @param cacheName
      * @throws IOException
@@ -378,7 +378,7 @@ public class RemoteHttpCacheClient
      * @return A Set of keys
      * @throws IOException
      */
-    public Set getGroupKeys( String cacheName, String groupName )
+    public Set<Serializable> getGroupKeys( String cacheName, String groupName )
         throws IOException
     {
         if ( !isInitialized() )
@@ -395,10 +395,10 @@ public class RemoteHttpCacheClient
 
         if ( remoteHttpCacheResponse != null && remoteHttpCacheResponse.getPayload() != null )
         {
-            return (Set)remoteHttpCacheResponse.getPayload().get( groupName );
+            return (Set<Serializable>)remoteHttpCacheResponse.getPayload().get( groupName );
         }
 
-        return Collections.EMPTY_SET;
+        return Collections.emptySet();
     }
 
     /**

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java Wed Jul 27 18:08:23 2011
@@ -51,7 +51,8 @@ public class RemoteHttpCacheFactory
     private String name;
 
     /** store reference of facades to initiate failover */
-    private final static HashMap facades = new HashMap();
+    private final static HashMap<String, RemoteCacheNoWaitFacade> facades =
+        new HashMap<String, RemoteCacheNoWaitFacade>();
 
     /**
      * For LOCAL clients we get a handle to all the failovers, but we do not register a listener
@@ -71,7 +72,7 @@ public class RemoteHttpCacheFactory
     {
         RemoteHttpCacheAttributes rca = (RemoteHttpCacheAttributes) iaca;
 
-        ArrayList noWaits = new ArrayList();
+        ArrayList<ICache> noWaits = new ArrayList<ICache>();
 
         RemoteHttpCacheManager rcm = RemoteHttpCacheManager.getInstance( cacheMgr, cacheEventLogger, elementSerializer );
         // TODO, use the configured value.
@@ -86,7 +87,7 @@ public class RemoteHttpCacheFactory
             log.info( "noWait is null" );
         }
 
-        RemoteCacheNoWaitFacade rcnwf = new RemoteCacheNoWaitFacade( (RemoteCacheNoWait[]) noWaits
+        RemoteCacheNoWaitFacade rcnwf = new RemoteCacheNoWaitFacade( noWaits
             .toArray( new RemoteCacheNoWait[0] ), rca, cacheMgr, cacheEventLogger, elementSerializer );
 
         getFacades().put( rca.getCacheName(), rcnwf );
@@ -118,7 +119,7 @@ public class RemoteHttpCacheFactory
      * The facades are what the cache hub talks to.
      * @return Returns the facades.
      */
-    public static HashMap getFacades()
+    public static HashMap<String, RemoteCacheNoWaitFacade> getFacades()
     {
         return facades;
     }



Mime
View raw message