commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1719092 [1/2] - in /commons/proper/jcs/trunk/commons-jcs-core/src: main/java/org/apache/commons/jcs/access/ main/java/org/apache/commons/jcs/auxiliary/disk/ main/java/org/apache/commons/jcs/auxiliary/disk/block/ main/java/org/apache/common...
Date Thu, 10 Dec 2015 15:07:31 GMT
Author: tv
Date: Thu Dec 10 15:07:30 2015
New Revision: 1719092

URL: http://svn.apache.org/viewvc?rev=1719092&view=rev
Log:
Address issues reported by Findbugs

Modified:
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/AbstractCacheAccess.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElement.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheAttributes.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/ICommonRemoteCacheAttributes.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/IRemoteCacheAttributes.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheInfo.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CompositeCacheAttributes.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThread.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/config/OptionConverter.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/PoolConfiguration.java
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/HsqlSetupTableUtil.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtilsUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/TestRemoteCache.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapUnitTest.java

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/AbstractCacheAccess.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/AbstractCacheAccess.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/AbstractCacheAccess.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/AbstractCacheAccess.java Thu Dec 10 15:07:30 2015
@@ -19,6 +19,8 @@ package org.apache.commons.jcs.access;
  * under the License.
  */
 
+import java.io.IOException;
+
 import org.apache.commons.jcs.access.behavior.ICacheAccessManagement;
 import org.apache.commons.jcs.access.exception.CacheException;
 import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes;
@@ -26,8 +28,6 @@ import org.apache.commons.jcs.engine.beh
 import org.apache.commons.jcs.engine.control.CompositeCache;
 import org.apache.commons.jcs.engine.stats.behavior.ICacheStats;
 
-import java.io.IOException;
-
 /**
  * This class provides the common methods for all types of access to the cache.
  * <p>
@@ -54,7 +54,7 @@ public abstract class AbstractCacheAcces
      * <p>
      * @param cacheControl The cache which the created instance accesses
      */
-    public AbstractCacheAccess( CompositeCache<K, V> cacheControl )
+    protected AbstractCacheAccess( CompositeCache<K, V> cacheControl )
     {
         this.cacheControl = cacheControl;
     }

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java Thu Dec 10 15:07:30 2015
@@ -19,6 +19,14 @@ package org.apache.commons.jcs.auxiliary
  * under the License.
  */
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
 import org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging;
 import org.apache.commons.jcs.auxiliary.AuxiliaryCache;
 import org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes;
@@ -36,14 +44,6 @@ import org.apache.commons.jcs.engine.sta
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
 /**
  * Abstract class providing a base implementation of a disk cache, which can be easily extended to
  * implement a disk cache for a specific persistence mechanism.
@@ -58,7 +58,6 @@ import java.util.concurrent.locks.Reentr
  */
 public abstract class AbstractDiskCache<K, V>
     extends AbstractAuxiliaryCacheEventLogging<K, V>
-    implements AuxiliaryCache<K, V>
 {
     /** The logger */
     private static final Log log = LogFactory.getLog( AbstractDiskCache.class );
@@ -66,9 +65,6 @@ public abstract class AbstractDiskCache<
     /** Generic disk cache attributes */
     private IDiskCacheAttributes diskCacheAttributes = null;
 
-    // TODO most of these fields should be made private with getters/setters as necessary
-    // Though hopefully many of them can be set at construction and made final
-
     /**
      * Map where elements are stored between being added to this cache and actually spooled to disk.
      * This allows puts to the disk cache to return quickly, and the more expensive operation of
@@ -77,31 +73,31 @@ public abstract class AbstractDiskCache<
      * If the elements are pulled into the memory cache while the are still in purgatory, writing to
      * disk can be canceled.
      */
-    protected Map<K, PurgatoryElement<K, V>> purgatory = new HashMap<K, PurgatoryElement<K, V>>();
+    private Map<K, PurgatoryElement<K, V>> purgatory;
 
     /**
      * The CacheEventQueue where changes will be queued for asynchronous updating of the persistent
      * storage.
      */
-    protected ICacheEventQueue<K, V> cacheEventQueue;
+    private ICacheEventQueue<K, V> cacheEventQueue;
 
     /**
      * Indicates whether the cache is 'alive': initialized, but not yet disposed. Child classes must
      * set this to true.
      */
-    protected boolean alive = false;
+    private boolean alive = false;
 
     /** Every cache will have a name, subclasses must set this when they are initialized. */
-    protected String cacheName;
+    private String cacheName;
 
     /** DEBUG: Keeps a count of the number of purgatory hits for debug messages */
-    protected int purgHits = 0;
+    private int purgHits = 0;
 
     /**
      * We lock here, so that we cannot get an update after a remove all. an individual removal locks
      * the item.
      */
-    protected final ReentrantReadWriteLock removeAllLock = new ReentrantReadWriteLock();
+    private final ReentrantReadWriteLock removeAllLock = new ReentrantReadWriteLock();
 
     // ----------------------------------------------------------- constructors
 
@@ -111,10 +107,9 @@ public abstract class AbstractDiskCache<
      * <p>
      * @param attr
      */
-    public AbstractDiskCache( IDiskCacheAttributes attr )
+    protected AbstractDiskCache( IDiskCacheAttributes attr )
     {
         this.diskCacheAttributes = attr;
-
         this.cacheName = attr.getCacheName();
 
         // create queue
@@ -128,6 +123,22 @@ public abstract class AbstractDiskCache<
     }
 
     /**
+     * @return true if the cache is alive
+     */
+    public boolean isAlive()
+    {
+        return alive;
+    }
+
+    /**
+     * @param alive set the alive status
+     */
+    public void setAlive(boolean alive)
+    {
+        this.alive = alive;
+    }
+
+    /**
      * Purgatory size of -1 means to use a HashMap with no size limit. Anything greater will use an
      * LRU map of some sort.
      * <p>
@@ -459,7 +470,7 @@ public abstract class AbstractDiskCache<
             public void run()
             {
                 boolean keepGoing = true;
-                long total = 0;
+                // long total = 0;
                 long interval = 100;
                 while ( keepGoing )
                 {
@@ -467,7 +478,7 @@ public abstract class AbstractDiskCache<
                     try
                     {
                         Thread.sleep( interval );
-                        total += interval;
+                        // total += interval;
                         // log.info( "total = " + total );
                     }
                     catch ( InterruptedException e )
@@ -483,7 +494,7 @@ public abstract class AbstractDiskCache<
         // wait up to 60 seconds for dispose and then quit if not done.
         try
         {
-            t.join( this.diskCacheAttributes.getShutdownSpoolTimeLimit() * 1000 );
+            t.join( this.diskCacheAttributes.getShutdownSpoolTimeLimit() * 1000L );
         }
         catch ( InterruptedException ex )
         {

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElement.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElement.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElement.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElement.java Thu Dec 10 15:07:30 2015
@@ -31,7 +31,6 @@ import org.apache.commons.jcs.engine.beh
  */
 public class PurgatoryElement<K, V>
     extends CacheElement<K, V>
-    implements ICacheElement<K, V>
 {
     /** Don't change */
     private static final long serialVersionUID = -8152034342684135628L;

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java Thu Dec 10 15:07:30 2015
@@ -144,7 +144,7 @@ public class BlockDiskCache<K, V>
             }
 
             // Initialization finished successfully, so set alive to true.
-            alive = true;
+            setAlive(true);
             if ( log.isInfoEnabled() )
             {
                 log.info( logCacheName + "Block Disk Cache is alive." );
@@ -314,7 +314,7 @@ public class BlockDiskCache<K, V>
     @Override
     protected ICacheElement<K, V> processGet( K key )
     {
-        if ( !alive )
+        if ( !isAlive() )
         {
             if ( log.isDebugEnabled() )
             {
@@ -371,7 +371,7 @@ public class BlockDiskCache<K, V>
     @Override
     protected void processUpdate( ICacheElement<K, V> element )
     {
-        if ( !alive )
+        if ( !isAlive() )
         {
             if ( log.isDebugEnabled() )
             {
@@ -430,7 +430,7 @@ public class BlockDiskCache<K, V>
     @Override
     protected boolean processRemove( K key )
     {
-        if ( !alive )
+        if ( !isAlive() )
         {
             if ( log.isDebugEnabled() )
             {
@@ -458,7 +458,7 @@ public class BlockDiskCache<K, V>
 
                     if ( k instanceof String && k.toString().startsWith( key.toString() ) )
                     {
-                        int[] ded = this.keyStore.get( key );
+                        int[] ded = entry.getValue();
                         this.dataFile.freeBlocks( ded );
                         iter.remove();
                         removed = true;
@@ -478,7 +478,7 @@ public class BlockDiskCache<K, V>
                     if ( k instanceof GroupAttrName &&
                         ((GroupAttrName<?>)k).groupId.equals(((GroupAttrName<?>)key).groupId))
                     {
-                        int[] ded = this.keyStore.get( key );
+                        int[] ded = entry.getValue();
                         this.dataFile.freeBlocks( ded );
                         iter.remove();
                         removed = true;
@@ -575,7 +575,7 @@ public class BlockDiskCache<K, V>
     protected void disposeInternal()
         throws InterruptedException
     {
-        if ( !alive )
+        if ( !isAlive() )
         {
             log.error( logCacheName + "Not alive and dispose was called, filename: " + fileName );
             return;
@@ -584,8 +584,7 @@ public class BlockDiskCache<K, V>
         try
         {
             // Prevents any interaction with the cache while we're shutting down.
-            alive = false;
-
+            setAlive(false);
             this.keyStore.saveKeys();
 
             try
@@ -620,7 +619,6 @@ public class BlockDiskCache<K, V>
     /**
      * Returns the attributes.
      * <p>
-     * (non-Javadoc)
      * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getAuxiliaryCacheAttributes()
      */
     @Override
@@ -697,7 +695,7 @@ public class BlockDiskCache<K, V>
 
         ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
 
-        elems.add(new StatElement<Boolean>( "Is Alive", Boolean.valueOf(alive) ) );
+        elems.add(new StatElement<Boolean>( "Is Alive", Boolean.valueOf(isAlive()) ) );
         elems.add(new StatElement<Integer>( "Key Map Size", Integer.valueOf(this.keyStore.size()) ) );
 
         if (this.dataFile != null)

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Thu Dec 10 15:07:30 2015
@@ -20,7 +20,6 @@ package org.apache.commons.jcs.auxiliary
  */
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -185,7 +184,7 @@ public class IndexedDiskCache<K, V> exte
             initializeRecycleBin();
 
             // Initialization finished successfully, so set alive to true.
-            alive = true;
+            setAlive(true);
             if (log.isInfoEnabled())
             {
                 log.info(logCacheName + "Indexed Disk Cache is alive.");
@@ -228,12 +227,10 @@ public class IndexedDiskCache<K, V> exte
      * <p>
      *
      * @param cattr
-     * @throws FileNotFoundException
      * @throws IOException
      * @throws InterruptedException
      */
-    private void initializeKeysAndData(IndexedDiskCacheAttributes cattr) throws FileNotFoundException, IOException,
-        InterruptedException
+    private void initializeKeysAndData(IndexedDiskCacheAttributes cattr) throws IOException, InterruptedException
     {
         this.dataFile = new IndexedDisk(new File(rafDir, fileName + ".data"), getElementSerializer());
         this.keyFile = new IndexedDisk(new File(rafDir, fileName + ".key"), getElementSerializer());
@@ -288,7 +285,7 @@ public class IndexedDiskCache<K, V> exte
     {
         loadKeys();
 
-        if (keyHash.size() == 0)
+        if (keyHash.isEmpty())
         {
             dataFile.reset();
         }
@@ -503,7 +500,7 @@ public class IndexedDiskCache<K, V> exte
     @Override
     protected void processUpdate(ICacheElement<K, V> ce)
     {
-        if (!alive)
+        if (!isAlive())
         {
             log.error(logCacheName + "No longer alive; aborting put of key = " + ce.getKey());
             return;
@@ -619,7 +616,7 @@ public class IndexedDiskCache<K, V> exte
     @Override
     protected ICacheElement<K, V> processGet(K key)
     {
-        if (!alive)
+        if (!isAlive())
         {
             log.error(logCacheName + "No longer alive so returning null for key = " + key);
             return null;
@@ -780,7 +777,7 @@ public class IndexedDiskCache<K, V> exte
     @Override
     protected boolean processRemove(K key)
     {
-        if (!alive)
+        if (!isAlive())
         {
             log.error(logCacheName + "No longer alive so returning false for key = " + key);
             return false;
@@ -854,7 +851,7 @@ public class IndexedDiskCache<K, V> exte
 
         for (K k : keyHash.keySet())
         {
-            if (k instanceof String && k.toString().startsWith(key.toString()))
+            if (k instanceof String && k.toString().startsWith(key))
             {
                 itemsToRemove.add(k);
             }
@@ -942,7 +939,7 @@ public class IndexedDiskCache<K, V> exte
     @Override
     public void processRemoveAll()
     {
-        ICacheEvent<String> cacheEvent = createICacheEvent(cacheName, "all", ICacheEventLogger.REMOVEALL_EVENT);
+        ICacheEvent<String> cacheEvent = createICacheEvent(getCacheName(), "all", ICacheEventLogger.REMOVEALL_EVENT);
         try
         {
             reset();
@@ -1035,7 +1032,7 @@ public class IndexedDiskCache<K, V> exte
         keyHash = null;
         if (maxKeySize >= 0)
         {
-            if (this.diskLimitType.equals(DiskLimitType.COUNT))
+            if (this.diskLimitType == DiskLimitType.COUNT)
             {
                 keyHash = new LRUMapCountLimited(maxKeySize);
             }
@@ -1070,7 +1067,7 @@ public class IndexedDiskCache<K, V> exte
     @Override
     public void processDispose()
     {
-        ICacheEvent<String> cacheEvent = createICacheEvent(cacheName, "none", ICacheEventLogger.DISPOSE_EVENT);
+        ICacheEvent<String> cacheEvent = createICacheEvent(getCacheName(), "none", ICacheEventLogger.DISPOSE_EVENT);
         try
         {
             Runnable disR = new Runnable()
@@ -1104,14 +1101,14 @@ public class IndexedDiskCache<K, V> exte
      */
     protected void disposeInternal()
     {
-        if (!alive)
+        if (!isAlive())
         {
             log.error(logCacheName + "Not alive and dispose was called, filename: " + fileName);
             return;
         }
 
         // Prevents any interaction with the cache while we're shutting down.
-        alive = false;
+        setAlive(false);
 
         Thread optimizationThread = currentOptimizationThread;
         if (isRealTimeOptimizationEnabled && optimizationThread != null)
@@ -1595,7 +1592,7 @@ public class IndexedDiskCache<K, V> exte
 
         ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
 
-        elems.add(new StatElement<Boolean>("Is Alive", Boolean.valueOf(alive)));
+        elems.add(new StatElement<Boolean>("Is Alive", Boolean.valueOf(isAlive())));
         elems.add(new StatElement<Integer>("Key Map Size", Integer.valueOf(this.keyHash != null ? this.keyHash.size() : -1)));
         try
         {
@@ -1663,11 +1660,8 @@ public class IndexedDiskCache<K, V> exte
          * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
          */
         @Override
-        public int compare(IndexedDiskElementDescriptor o1, IndexedDiskElementDescriptor o2)
+        public int compare(IndexedDiskElementDescriptor ded1, IndexedDiskElementDescriptor ded2)
         {
-            IndexedDiskElementDescriptor ded1 = o1;
-            IndexedDiskElementDescriptor ded2 = o2;
-
             if (ded1.pos < ded2.pos)
             {
                 return -1;

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java Thu Dec 10 15:07:30 2015
@@ -135,7 +135,7 @@ public class JDBCDiskCache<K, V>
         this.dsFactory = dsFactory;
 
         // Initialization finished successfully, so set alive to true.
-        alive = true;
+        setAlive(true);
     }
 
     /**
@@ -463,7 +463,7 @@ public class JDBCDiskCache<K, V>
             log.debug( "Getting [" + key + "] from disk" );
         }
 
-        if ( !alive )
+        if ( !isAlive() )
         {
             return null;
         }
@@ -570,7 +570,7 @@ public class JDBCDiskCache<K, V>
             log.debug( "Getting [" + pattern + "] from disk" );
         }
 
-        if ( !alive )
+        if ( !isAlive() )
         {
             return null;
         }
@@ -717,12 +717,12 @@ public class JDBCDiskCache<K, V>
 
                 psSelect.executeUpdate();
 
-                alive = true;
+                setAlive(true);
             }
             catch ( SQLException e )
             {
                 log.error( "Problem creating statement. sql [" + sql + "]", e );
-                alive = false;
+                setAlive(false);
             }
             finally
             {
@@ -767,13 +767,13 @@ public class JDBCDiskCache<K, V>
                 {
                     psDelete = con.prepareStatement( sql );
                     psDelete.setString( 1, this.getCacheName() );
-                    alive = true;
+                    setAlive(true);
                     psDelete.executeUpdate();
                 }
                 catch ( SQLException e )
                 {
                     log.error( "Problem creating statement.", e );
-                    alive = false;
+                    setAlive(false);
                 }
                 finally
                 {
@@ -839,14 +839,14 @@ public class JDBCDiskCache<K, V>
                 psDelete.setString( 2, this.getCacheName() );
                 psDelete.setLong( 3, now );
 
-                alive = true;
+                setAlive(true);
 
                 deleted = psDelete.executeUpdate();
             }
             catch ( SQLException e )
             {
                 log.error( "Problem creating statement.", e );
-                alive = false;
+                setAlive(false);
             }
             finally
             {
@@ -893,7 +893,7 @@ public class JDBCDiskCache<K, V>
     @Override
     public void processDispose()
     {
-        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, (K)"none", ICacheEventLogger.DISPOSE_EVENT );
+        ICacheEvent<K> cacheEvent = createICacheEvent( getCacheName(), (K)"none", ICacheEventLogger.DISPOSE_EVENT );
         try
         {
             try

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java Thu Dec 10 15:07:30 2015
@@ -19,6 +19,12 @@ package org.apache.commons.jcs.auxiliary
  * under the License.
  */
 
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging;
 import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.commons.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
@@ -33,12 +39,6 @@ import org.apache.commons.jcs.engine.sta
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * Lateral distributor. Returns null on get by default. Net search not implemented.
  */
@@ -98,20 +98,17 @@ public class LateralCache<K, V>
     {
         try
         {
-            if ( log.isDebugEnabled() )
+            if (ce != null)
             {
-                log.debug( "update: lateral = [" + lateralCacheService + "], " + "CacheInfo.listenerId = "
-                    + CacheInfo.listenerId );
+                if ( log.isDebugEnabled() )
+                {
+                    log.debug( "update: lateral = [" + lateralCacheService + "], " + "CacheInfo.listenerId = "
+                        + CacheInfo.listenerId );
+                }
+                lateralCacheService.update( ce, CacheInfo.listenerId );
             }
-            lateralCacheService.update( ce, CacheInfo.listenerId );
-        }
-        catch ( NullPointerException npe )
-        {
-            log.error( "Failure updating lateral. lateral = " + lateralCacheService, npe );
-            handleException( npe, "Failed to put [" + ce.getKey() + "] to " + ce.getCacheName() + "@" + lateralCacheAttributes );
-            return;
         }
-        catch ( Exception ex )
+        catch ( IOException ex )
         {
             handleException( ex, "Failed to put [" + ce.getKey() + "] to " + ce.getCacheName() + "@" + lateralCacheAttributes );
         }
@@ -214,7 +211,7 @@ public class LateralCache<K, V>
         {
             return lateralCacheService.getKeySet( cacheName );
         }
-        catch ( Exception ex )
+        catch ( IOException ex )
         {
             handleException( ex, "Failed to get key set from " + lateralCacheAttributes.getCacheName() + "@"
                 + lateralCacheAttributes );
@@ -243,7 +240,7 @@ public class LateralCache<K, V>
         {
             lateralCacheService.remove( cacheName, key, CacheInfo.listenerId );
         }
-        catch ( Exception ex )
+        catch ( IOException ex )
         {
             handleException( ex, "Failed to remove " + key + " from " + lateralCacheAttributes.getCacheName() + "@" + lateralCacheAttributes );
         }
@@ -264,7 +261,7 @@ public class LateralCache<K, V>
         {
             lateralCacheService.removeAll( cacheName, CacheInfo.listenerId );
         }
-        catch ( Exception ex )
+        catch ( IOException ex )
         {
             handleException( ex, "Failed to remove all from " + lateralCacheAttributes.getCacheName() + "@" + lateralCacheAttributes );
         }
@@ -290,7 +287,7 @@ public class LateralCache<K, V>
             lateralCacheService.dispose( this.lateralCacheAttributes.getCacheName() );
             // Should remove connection
         }
-        catch ( Exception ex )
+        catch ( IOException ex )
         {
             log.error( "Couldn't dispose", ex );
             handleException( ex, "Failed to dispose " + lateralCacheAttributes.getCacheName() );

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheAttributes.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheAttributes.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheAttributes.java Thu Dec 10 15:07:30 2015
@@ -23,14 +23,12 @@ import org.apache.commons.jcs.auxiliary.
 import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.commons.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 
-import java.io.Serializable;
-
 /**
  * This class stores attributes for all of the available lateral cache auxiliaries.
  */
 public class LateralCacheAttributes
     extends AbstractAuxiliaryCacheAttributes
-    implements Serializable, ILateralCacheAttributes
+    implements ILateralCacheAttributes
 {
     /** Don't change */
     private static final long serialVersionUID = -3408449508837393660L;

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java Thu Dec 10 15:07:30 2015
@@ -31,7 +31,6 @@ import org.apache.commons.jcs.auxiliary.
 import org.apache.commons.jcs.auxiliary.lateral.LateralCacheMonitor;
 import org.apache.commons.jcs.auxiliary.lateral.LateralCacheNoWait;
 import org.apache.commons.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
-import org.apache.commons.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.commons.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
 import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.commons.jcs.engine.CacheWatchRepairable;
@@ -178,6 +177,7 @@ public class LateralTCPCacheFactory
         // Create the monitoring daemon thread
         this.monitor = new LateralCacheMonitor(this);
         this.monitor.setDaemon( true );
+        this.monitor.start();
 
         this.lateralWatch = new CacheWatchRepairable();
         this.lateralWatch.setCacheWatch( new ZombieCacheWatch() );
@@ -209,7 +209,14 @@ public class LateralTCPCacheFactory
         if (this.monitor != null)
         {
             this.monitor.notifyShutdown();
-            // this.monitor.join(5000);
+            try
+            {
+                this.monitor.join(5000);
+            }
+            catch (InterruptedException e)
+            {
+                // swallow
+            }
             this.monitor = null;
         }
     }
@@ -365,15 +372,14 @@ public class LateralTCPCacheFactory
      * <p>
      * This should be called by create cache.
      * <p>
-     * @param lac  ILateralCacheAttributes
+     * @param attr  ITCPLateralCacheAttributes
      * @param cacheMgr
      *
      * @return the listener if created, else null
      */
-    private <K, V> ILateralCacheListener<K, V> createListener( ILateralCacheAttributes lac,
+    private <K, V> ILateralCacheListener<K, V> createListener( ITCPLateralCacheAttributes attr,
             ICompositeCacheManager cacheMgr )
     {
-        ITCPLateralCacheAttributes attr = (ITCPLateralCacheAttributes) lac;
         ILateralCacheListener<K, V> listener = null;
 
         // don't create a listener if we are not receiving.
@@ -381,21 +387,14 @@ public class LateralTCPCacheFactory
         {
             if ( log.isInfoEnabled() )
             {
-                log.info( "Getting listener for " + lac );
+                log.info( "Getting listener for " + attr );
             }
 
-            try
-            {
-                // make a listener. if one doesn't exist
-                listener = LateralTCPListener.getInstance( attr, cacheMgr );
+            // make a listener. if one doesn't exist
+            listener = LateralTCPListener.getInstance( attr, cacheMgr );
 
-                // register for shutdown notification
-                cacheMgr.registerShutdownObserver( (IShutdownObserver) listener );
-            }
-            catch ( Exception e )
-            {
-                log.error( "Problem creating lateral listener", e );
-            }
+            // register for shutdown notification
+            cacheMgr.registerShutdownObserver( (IShutdownObserver) listener );
         }
         else
         {

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/ICommonRemoteCacheAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/ICommonRemoteCacheAttributes.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/ICommonRemoteCacheAttributes.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/ICommonRemoteCacheAttributes.java Thu Dec 10 15:07:30 2015
@@ -20,6 +20,7 @@ package org.apache.commons.jcs.auxiliary
  */
 
 import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.commons.jcs.auxiliary.remote.RemoteLocation;
 import org.apache.commons.jcs.auxiliary.remote.server.behavior.RemoteType;
 
 /**
@@ -74,32 +75,26 @@ public interface ICommonRemoteCacheAttri
     void setRemoteServiceName( String s );
 
     /**
-     * Gets the remoteHost attribute of the IRemoteCacheAttributes object
+     * Sets the location attribute of the RemoteCacheAttributes object.
      * <p>
-     * @return The remoteHost value
+     * @param location The new location value
      */
-    String getRemoteHost();
+    void setRemoteLocation( RemoteLocation location );
 
     /**
-     * Sets the remoteHost attribute of the IRemoteCacheAttributes object
+     * Sets the location attribute of the RemoteCacheAttributes object.
      * <p>
-     * @param s The new remoteHost value
+     * @param host The new remoteHost value
+     * @param port The new remotePort value
      */
-    void setRemoteHost( String s );
+    void setRemoteLocation( String host, int port );
 
     /**
-     * Gets the remotePort attribute of the IRemoteCacheAttributes object
+     * Gets the location attribute of the RemoteCacheAttributes object.
      * <p>
-     * @return The remotePort value
+     * @return The remote location value
      */
-    int getRemotePort();
-
-    /**
-     * Sets the remotePort attribute of the IRemoteCacheAttributes object
-     * <p>
-     * @param p The new remotePort value
-     */
-    void setRemotePort( int p );
+    public RemoteLocation getRemoteLocation();
 
     /**
      * Gets the clusterServers attribute of the IRemoteCacheAttributes object

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/IRemoteCacheAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/IRemoteCacheAttributes.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/IRemoteCacheAttributes.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/behavior/IRemoteCacheAttributes.java Thu Dec 10 15:07:30 2015
@@ -1,5 +1,7 @@
 package org.apache.commons.jcs.auxiliary.remote.behavior;
 
+import org.apache.commons.jcs.auxiliary.remote.RemoteLocation;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -63,14 +65,14 @@ public interface IRemoteCacheAttributes
      * <p>
      * @return The failovers value
      */
-    String[] getFailovers();
+    RemoteLocation[] getFailovers();
 
     /**
      * Sets the failovers attribute of the IRemoteCacheAttributes object
      * <p>
      * @param f The new failovers value
      */
-    void setFailovers( String[] f );
+    void setFailovers( RemoteLocation[] f );
 
     /**
      * Gets the localPort attribute of the IRemoteCacheAttributes object

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java Thu Dec 10 15:07:30 2015
@@ -156,9 +156,8 @@ public class RemoteHttpCacheDispatcher
                 switch ( remoteCacheRequest.getRequestType() )
                 {
                     case GET:
-                        keyValue = remoteCacheRequest.getKey() + "";
-                        break;
                     case REMOVE:
+                    case GET_KEYSET:
                         keyValue = remoteCacheRequest.getKey() + "";
                         break;
                     case GET_MATCHING:
@@ -167,9 +166,6 @@ public class RemoteHttpCacheDispatcher
                     case GET_MULTIPLE:
                         keyValue = remoteCacheRequest.getKeySet() + "";
                         break;
-                    case GET_KEYSET:
-                        keyValue = remoteCacheRequest.getKey() + "";
-                        break;
                     case UPDATE:
                         keyValue = remoteCacheRequest.getCacheElement().getKey() + "";
                         break;

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java Thu Dec 10 15:07:30 2015
@@ -19,6 +19,12 @@ package org.apache.commons.jcs.auxiliary
  * under the License.
  */
 
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
 import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
@@ -27,12 +33,6 @@ import org.apache.commons.jcs.engine.beh
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * The Servlet deserializes the request object. The request object is passed to the processor. The
  * processor then calls the service which does the work of talking to the cache.
@@ -126,8 +126,6 @@ public class RemoteCacheServiceAdaptor<K
                         getRemoteCacheService().update( request.getCacheElement(), request.getRequesterId() );
                         break;
                     case ALIVE_CHECK:
-                        response.setSuccess( true );
-                        break;
                     case DISPOSE:
                         response.setSuccess( true );
                         // DO NOTHING

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java Thu Dec 10 15:07:30 2015
@@ -19,15 +19,15 @@ package org.apache.commons.jcs.auxiliary
  * under the License.
  */
 
+import java.rmi.Naming;
+import java.rmi.RemoteException;
+import java.rmi.registry.Registry;
+
 import org.apache.commons.jcs.auxiliary.remote.RemoteUtils;
 import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.rmi.Naming;
-import java.rmi.RemoteException;
-import java.rmi.registry.Registry;
-
 /**
  * This class tries to keep the registry alive. If if is able to create a registry, it will also
  * rebind the remote cache server.
@@ -93,7 +93,6 @@ public class RegistryKeepAliveRunner
             {
                 log.debug( message );
             }
-            obj = null;
         }
         catch ( Exception ex )
         {

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java Thu Dec 10 15:07:30 2015
@@ -489,9 +489,7 @@ public class RemoteCacheServer<K, V>
             }
         }
 
-        ICacheElement<K, V> element = null;
-
-        element = getFromCacheListeners( key, fromCluster, cacheDesc, element );
+        ICacheElement<K, V> element = getFromCacheListeners( key, fromCluster, cacheDesc, null );
         return element;
     }
 
@@ -731,8 +729,6 @@ public class RemoteCacheServer<K, V>
      */
     private Map<K, ICacheElement<K, V>> processGetMultiple( String cacheName, Set<K> keys, long requesterId )
     {
-        Map<K, ICacheElement<K, V>> elements = null;
-
         boolean fromCluster = isRequestFromCluster( requesterId );
 
         if ( log.isDebugEnabled() )
@@ -741,17 +737,8 @@ public class RemoteCacheServer<K, V>
                 + "] fromCluster = " + fromCluster );
         }
 
-        CacheListeners<K, V> cacheDesc = null;
-        try
-        {
-            cacheDesc = getCacheListeners( cacheName );
-        }
-        catch ( Exception e )
-        {
-            log.error( "Problem getting listeners.", e );
-        }
-
-        elements = getMultipleFromCacheListeners( keys, elements, fromCluster, cacheDesc );
+        CacheListeners<K, V> cacheDesc = getCacheListeners( cacheName );
+        Map<K, ICacheElement<K, V>> elements = getMultipleFromCacheListeners( keys, null, fromCluster, cacheDesc );
         return elements;
     }
 

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java Thu Dec 10 15:07:30 2015
@@ -19,17 +19,6 @@ package org.apache.commons.jcs.auxiliary
  * under the License.
  */
 
-import org.apache.commons.jcs.auxiliary.AuxiliaryCacheConfigurator;
-import org.apache.commons.jcs.auxiliary.remote.RemoteUtils;
-import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheConstants;
-import org.apache.commons.jcs.engine.behavior.ICacheServiceAdmin;
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
-import org.apache.commons.jcs.utils.config.OptionConverter;
-import org.apache.commons.jcs.utils.config.PropertySetter;
-import org.apache.commons.jcs.utils.threadpool.DaemonThreadFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import java.io.IOException;
 import java.io.Serializable;
 import java.net.MalformedURLException;
@@ -45,6 +34,17 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.commons.jcs.auxiliary.AuxiliaryCacheConfigurator;
+import org.apache.commons.jcs.auxiliary.remote.RemoteUtils;
+import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheConstants;
+import org.apache.commons.jcs.engine.behavior.ICacheServiceAdmin;
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
+import org.apache.commons.jcs.utils.config.OptionConverter;
+import org.apache.commons.jcs.utils.config.PropertySetter;
+import org.apache.commons.jcs.utils.threadpool.DaemonThreadFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 /**
  * Provides remote cache services. This creates remote cache servers and can proxy command line
  * requests to a running server.
@@ -156,8 +156,7 @@ public class RemoteCacheServerFactory
             rcsa.setConfigFileName( propFile );
 
             // These should come from the file!
-            rcsa.setRemotePort( port );
-            rcsa.setRemoteHost( host );
+            rcsa.setRemoteLocation( host, port );
             if ( log.isInfoEnabled() )
             {
                 log.info( "Creating server with these attributes: " + rcsa );
@@ -355,14 +354,14 @@ public class RemoteCacheServerFactory
         String lccStr = prop.getProperty( REMOTE_LOCAL_CLUSTER_CONSISTENCY );
         if ( lccStr != null )
         {
-            boolean lcc = Boolean.valueOf( lccStr ).booleanValue();
+            boolean lcc = Boolean.parseBoolean( lccStr );
             rcsa.setLocalClusterConsistency( lcc );
         }
 
         String acgStr = prop.getProperty( REMOTE_ALLOW_CLUSTER_GET );
         if ( acgStr != null )
         {
-            boolean acg = Boolean.valueOf( acgStr ).booleanValue();
+            boolean acg = Boolean.parseBoolean( lccStr );
             rcsa.setAllowClusterGet( acg );
         }
 

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheInfo.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheInfo.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheInfo.java Thu Dec 10 15:07:30 2015
@@ -40,7 +40,7 @@ public final class CacheInfo
      * TODO: may have some trouble in failover mode if the cache keeps its old
      * id. We may need to reset this when moving into failover.
      */
-    protected static final VMID vmid = new VMID();
+    private static final VMID vmid = new VMID();
 
     /** By default this is the hashcode of the VMID */
     public static final long listenerId = vmid.hashCode();

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CompositeCacheAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CompositeCacheAttributes.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CompositeCacheAttributes.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CompositeCacheAttributes.java Thu Dec 10 15:07:30 2015
@@ -412,7 +412,7 @@ public class CompositeCacheAttributes
     {
         try
         {
-            ICompositeCacheAttributes cattr = (CompositeCacheAttributes) this.clone();
+            ICompositeCacheAttributes cattr = (ICompositeCacheAttributes) this.clone();
             return cattr;
         }
         catch ( Exception e )

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java Thu Dec 10 15:07:30 2015
@@ -232,7 +232,7 @@ public class CompositeCacheConfigurator
      *<p>
      * @param props
      */
-    protected <K, V> void parseSystemRegions( Properties props )
+    protected void parseSystemRegions( Properties props )
     {
         Enumeration<?> en = props.propertyNames();
         while ( en.hasMoreElements() )
@@ -242,7 +242,7 @@ public class CompositeCacheConfigurator
             {
                 String regionName = key.substring( SYSTEM_REGION_PREFIX.length() );
                 String value = OptionConverter.findAndSubst( key, props );
-                ICache<K, V> cache;
+                ICache<?, ?> cache;
                 synchronized ( regionName )
                 {
                     cache = parseRegion( props, regionName, value, null, SYSTEM_REGION_PREFIX );
@@ -258,7 +258,7 @@ public class CompositeCacheConfigurator
      *<p>
      * @param props
      */
-    protected <K, V> void parseRegions( Properties props )
+    protected void parseRegions( Properties props )
     {
         List<String> regionNames = new ArrayList<String>();
 
@@ -273,7 +273,7 @@ public class CompositeCacheConfigurator
                 regionNames.add( regionName );
 
                 String auxiliaryList = OptionConverter.findAndSubst( key, props );
-                ICache<K, V> cache;
+                ICache<?, ?> cache;
                 synchronized ( regionName )
                 {
                     cache = parseRegion( props, regionName, auxiliaryList );

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java Thu Dec 10 15:07:30 2015
@@ -26,12 +26,13 @@ import java.security.AccessControlExcept
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
-import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.locks.ReentrantLock;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -79,9 +80,12 @@ public class CompositeCacheManager
     public static final String JMX_OBJECT_NAME = "org.apache.commons.jcs:type=JCSAdminBean";
 
     /** Caches managed by this cache manager */
-    private final Map<String, ICache<?, ?>> caches =
+    private final ConcurrentMap<String, ICache<?, ?>> caches =
         new ConcurrentHashMap<String, ICache<?, ?>>();
 
+    /** Lock for initialization of caches */
+    private ReentrantLock cacheLock = new ReentrantLock();
+
     /** Number of clients accessing this cache manager */
     private int clients;
 
@@ -92,15 +96,15 @@ public class CompositeCacheManager
     private IElementAttributes defaultElementAttr = new ElementAttributes();
 
     /** Used to keep track of configured auxiliaries */
-    private final Map<String, AuxiliaryCacheFactory> auxiliaryFactoryRegistry =
+    private final ConcurrentMap<String, AuxiliaryCacheFactory> auxiliaryFactoryRegistry =
         new ConcurrentHashMap<String, AuxiliaryCacheFactory>( 11 );
 
     /** Used to keep track of attributes for auxiliaries. */
-    private final Map<String, AuxiliaryCacheAttributes> auxiliaryAttributeRegistry =
+    private final ConcurrentMap<String, AuxiliaryCacheAttributes> auxiliaryAttributeRegistry =
         new ConcurrentHashMap<String, AuxiliaryCacheAttributes>( 11 );
 
     /** Used to keep track of configured auxiliaries */
-    private final Map<String, AuxiliaryCache<?, ?>> auxiliaryCaches =
+    private final ConcurrentMap<String, AuxiliaryCache<?, ?>> auxiliaryCaches =
         new ConcurrentHashMap<String, AuxiliaryCache<?, ?>>( 11 );
 
     /** Properties with which this manager was configured. This is exposed for other managers. */
@@ -459,7 +463,7 @@ public class CompositeCacheManager
                 {
                     log.info( "Using system property [[" + key + "] [" + sysProps.getProperty( key ) + "]]" );
                 }
-                props.put( key, sysProps.getProperty( key ) );
+                props.setProperty( key, sysProps.getProperty( key ) );
             }
         }
     }
@@ -603,19 +607,32 @@ public class CompositeCacheManager
             log.debug( "attr = " + attr );
         }
 
-        synchronized ( caches )
+        cache = (CompositeCache<K, V>) caches.get( cattr.getCacheName() );
+
+        if (cache == null)
         {
-            cache = (CompositeCache<K, V>) caches.get( cattr.getCacheName() );
-            if ( cache == null )
+            cacheLock.lock();
+
+            try
             {
-                cattr.setCacheName( cattr.getCacheName() );
+                // double check
+                cache = (CompositeCache<K, V>) caches.get( cattr.getCacheName() );
+
+                if ( cache == null )
+                {
+                    cattr.setCacheName( cattr.getCacheName() );
 
-                CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( this );
+                    CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( this );
 
-                cache = configurator.parseRegion( this.getConfigurationProperties(), cattr.getCacheName(),
-                                                  this.defaultAuxValues, cattr );
+                    cache = configurator.parseRegion( this.getConfigurationProperties(), cattr.getCacheName(),
+                                                      this.defaultAuxValues, cattr );
 
-                caches.put( cattr.getCacheName(), cache );
+                    caches.put( cattr.getCacheName(), cache );
+                }
+            }
+            finally
+            {
+                cacheLock.unlock();
             }
         }
 

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThread.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThread.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThread.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThread.java Thu Dec 10 15:07:30 2015
@@ -19,6 +19,8 @@ package org.apache.commons.jcs.engine.me
  * under the License.
  */
 
+import java.util.Set;
+
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
 import org.apache.commons.jcs.engine.behavior.IElementAttributes;
 import org.apache.commons.jcs.engine.control.CompositeCache;
@@ -27,8 +29,6 @@ import org.apache.commons.jcs.engine.mem
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.Set;
-
 /**
  * A background memory shrinker. Memory problems and concurrent modification exception caused by
  * acting directly on an iterator of the underlying memory cache should have been solved.
@@ -201,7 +201,6 @@ public class ShrinkerThread<K, V>
                         // stop processing if limit has been reached.
                         if ( spoolLimit && spoolCount >= this.maxSpoolPerRun )
                         {
-                            keys = null;
                             return;
                         }
                     }

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/config/OptionConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/config/OptionConverter.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/config/OptionConverter.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/config/OptionConverter.java Thu Dec 10 15:07:30 2015
@@ -19,11 +19,11 @@ package org.apache.commons.jcs.utils.con
  * under the License.
  */
 
+import java.util.Properties;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.Properties;
-
 /**
  * This class is based on the log4j class org.apache.log4j.helpers.OptionConverter that was made by
  * Ceki G&uuml;lc&uuml; Simon Kitching; Avy Sharell (sharell@online.fr) Anders Kristensen Matthieu
@@ -184,7 +184,6 @@ public class OptionConverter
      * @param dEfault
      * @return Object
      */
-
     public static boolean toBoolean( String value, boolean dEfault )
     {
         if ( value == null )
@@ -217,7 +216,7 @@ public class OptionConverter
             String s = value.trim();
             try
             {
-                return Integer.valueOf( s ).intValue();
+                return Integer.parseInt(s);
             }
             catch ( NumberFormatException e )
             {
@@ -263,7 +262,7 @@ public class OptionConverter
         {
             try
             {
-                return Long.valueOf( s ).longValue() * multiplier;
+                return Long.parseLong(s) * multiplier;
             }
             catch ( NumberFormatException e )
             {

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java Thu Dec 10 15:07:30 2015
@@ -197,7 +197,7 @@ public final class UDPDiscoveryAttribute
 
     /** @return a clone of this object */
     @Override
-    public Object clone()
+    public UDPDiscoveryAttributes clone()
     {
         UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes();
         attributes.setSendDelaySec( this.getSendDelaySec() );

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java Thu Dec 10 15:07:30 2015
@@ -170,7 +170,7 @@ public class UDPDiscoveryReceiver
             objectStream = new ObjectInputStreamClassLoaderAware( byteStream, null );
             obj = objectStream.readObject();
 
-            if ( obj != null && obj instanceof UDPDiscoveryMessage )
+            if ( obj instanceof UDPDiscoveryMessage )
             {
             	// Ensure that the address we're supposed to send to is, indeed, the address
             	// of the machine on the other end of this connection.  This guards against

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java Thu Dec 10 15:07:30 2015
@@ -133,7 +133,7 @@ public abstract class AbstractLRUMap<K,
     @Override
     public boolean isEmpty()
     {
-        return map.size() == 0;
+        return map.isEmpty();
     }
 
     /**

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/PoolConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/PoolConfiguration.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/PoolConfiguration.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/PoolConfiguration.java Thu Dec 10 15:07:30 2015
@@ -260,7 +260,7 @@ public final class PoolConfiguration
      * @return PoolConfiguration
      */
     @Override
-    public Object clone()
+    public PoolConfiguration clone()
     {
         return new PoolConfiguration( isUseBoundary(), boundarySize, maximumPoolSize, minimumPoolSize, keepAliveTime,
                                       getWhenBlockedPolicy(), startUpSize );

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java Thu Dec 10 15:07:30 2015
@@ -331,89 +331,68 @@ public class ThreadPoolManager
      */
     private static PoolConfiguration loadConfig( String root )
     {
-        PoolConfiguration config = (PoolConfiguration) defaultConfig.clone();
+        PoolConfiguration config = defaultConfig.clone();
 
-        if ( props.containsKey( root + ".useBoundary" ) )
+        try
         {
-            try
-            {
-                config.setUseBoundary( Boolean.valueOf( (String) props.get( root + ".useBoundary" ) ).booleanValue() );
-            }
-            catch ( NumberFormatException nfe )
-            {
-                log.error( "useBoundary not a boolean.", nfe );
-            }
+            config.setUseBoundary( Boolean.parseBoolean( props.getProperty( root + ".useBoundary", "false" ) ) );
+        }
+        catch ( NumberFormatException nfe )
+        {
+            log.error( "useBoundary not a boolean.", nfe );
         }
 
         // load default if they exist
-        if ( props.containsKey( root + ".boundarySize" ) )
+        try
+        {
+            config.setBoundarySize( Integer.parseInt( props.getProperty( root + ".boundarySize", "2000" ) ) );
+        }
+        catch ( NumberFormatException nfe )
         {
-            try
-            {
-                config.setBoundarySize( Integer.parseInt( (String) props.get( root + ".boundarySize" ) ) );
-            }
-            catch ( NumberFormatException nfe )
-            {
-                log.error( "boundarySize not a number.", nfe );
-            }
+            log.error( "boundarySize not a number.", nfe );
         }
 
         // maximum pool size
-        if ( props.containsKey( root + ".maximumPoolSize" ) )
+        try
         {
-            try
-            {
-                config.setMaximumPoolSize( Integer.parseInt( (String) props.get( root + ".maximumPoolSize" ) ) );
-            }
-            catch ( NumberFormatException nfe )
-            {
-                log.error( "maximumPoolSize not a number.", nfe );
-            }
+            config.setMaximumPoolSize( Integer.parseInt( props.getProperty( root + ".maximumPoolSize", "150" ) ) );
+        }
+        catch ( NumberFormatException nfe )
+        {
+            log.error( "maximumPoolSize not a number.", nfe );
         }
 
         // minimum pool size
-        if ( props.containsKey( root + ".minimumPoolSize" ) )
+        try
+        {
+            config.setMinimumPoolSize( Integer.parseInt( props.getProperty( root + ".minimumPoolSize", "4" ) ) );
+        }
+        catch ( NumberFormatException nfe )
         {
-            try
-            {
-                config.setMinimumPoolSize( Integer.parseInt( (String) props.get( root + ".minimumPoolSize" ) ) );
-            }
-            catch ( NumberFormatException nfe )
-            {
-                log.error( "minimumPoolSize not a number.", nfe );
-            }
+            log.error( "minimumPoolSize not a number.", nfe );
         }
 
         // keep alive
-        if ( props.containsKey( root + ".keepAliveTime" ) )
+        try
         {
-            try
-            {
-                config.setKeepAliveTime( Integer.parseInt( (String) props.get( root + ".keepAliveTime" ) ) );
-            }
-            catch ( NumberFormatException nfe )
-            {
-                log.error( "keepAliveTime not a number.", nfe );
-            }
+            config.setKeepAliveTime( Integer.parseInt( props.getProperty( root + ".keepAliveTime", "300000" ) ) );
         }
-
-        // when blocked
-        if ( props.containsKey( root + ".whenBlockedPolicy" ) )
+        catch ( NumberFormatException nfe )
         {
-            config.setWhenBlockedPolicy( (String) props.get( root + ".whenBlockedPolicy" ) );
+            log.error( "keepAliveTime not a number.", nfe );
         }
 
+        // when blocked
+        config.setWhenBlockedPolicy( props.getProperty( root + ".whenBlockedPolicy", "RUN" ) );
+
         // startupsize
-        if ( props.containsKey( root + ".startUpSize" ) )
+        try
+        {
+            config.setStartUpSize( Integer.parseInt( props.getProperty( root + ".startUpSize", "4" ) ) );
+        }
+        catch ( NumberFormatException nfe )
         {
-            try
-            {
-                config.setStartUpSize( Integer.parseInt( (String) props.get( root + ".startUpSize" ) ) );
-            }
-            catch ( NumberFormatException nfe )
-            {
-                log.error( "startUpSize not a number.", nfe );
-            }
+            log.error( "startUpSize not a number.", nfe );
         }
 
         if ( log.isInfoEnabled() )

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java Thu Dec 10 15:07:30 2015
@@ -19,17 +19,18 @@ package org.apache.commons.jcs;
  * under the License.
  */
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
 import junit.framework.TestCase;
+
 import org.apache.commons.jcs.access.CacheAccess;
 import org.apache.commons.jcs.engine.stats.behavior.IStatElement;
 import org.apache.commons.jcs.engine.stats.behavior.IStats;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * This is based on a test that was posted to the user's list:
  * <p>
@@ -321,6 +322,7 @@ public class JCSThrashTest
                     if ( listSize.equals( statElement.getName() ) )
                     {
                         result = statElement.getData().toString();
+                        break;
                     }
                 }
             }

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java Thu Dec 10 15:07:30 2015
@@ -100,7 +100,7 @@ public class AbstractDiskCacheUnitTest
         diskCache.dispose();
 
         // VERIFY
-        assertFalse( "disk cache should not be alive.", diskCache.alive );
+        assertFalse( "disk cache should not be alive.", diskCache.isAlive() );
         assertEquals( "Status should be disposed", CacheStatus.DISPOSED, diskCache.getStatus() );
     }
 
@@ -186,7 +186,7 @@ public class AbstractDiskCacheUnitTest
         {
             super( attr );
             diskCacheAttributes = attr;
-            super.alive = true;
+            setAlive(true);
         }
 
         /**

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/HsqlSetupTableUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/HsqlSetupTableUtil.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/HsqlSetupTableUtil.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/HsqlSetupTableUtil.java Thu Dec 10 15:07:30 2015
@@ -56,11 +56,11 @@ public class HsqlSetupTableUtil
 
         try
         {
-            sStatement.executeQuery( createSql.toString() );
+            sStatement.execute( createSql.toString() );
         }
         catch ( SQLException e )
         {
-            if ( e.toString().indexOf( "already exists" ) != -1 )
+            if ("23000".equals(e.getSQLState()))
             {
                 newT = false;
             }
@@ -78,11 +78,11 @@ public class HsqlSetupTableUtil
 
         if ( newT )
         {
-            for ( int i = 1; i < setupData.length; i++ )
+            for ( int i = 0; i < setupData.length; i++ )
             {
                 try
                 {
-                    sStatement.executeQuery( setupData[i] );
+                    sStatement.execute( setupData[i] );
                 }
                 catch ( SQLException e )
                 {

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java Thu Dec 10 15:07:30 2015
@@ -19,16 +19,17 @@ package org.apache.commons.jcs.auxiliary
  * under the License.
  */
 
-import junit.framework.TestCase;
-import org.apache.commons.jcs.JCS;
-import org.apache.commons.jcs.access.CacheAccess;
-
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Properties;
 
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
+
 /** Tests for the removal functionality. */
 public class JDBCDiskCacheRemovalUnitTest
     extends TestCase
@@ -136,12 +137,11 @@ public class JDBCDiskCacheRemovalUnitTes
 
         try
         {
-            sStatement.executeQuery( createSql.toString() );
+            sStatement.execute( createSql.toString() );
         }
         catch ( SQLException e )
         {
-            // FIXME: This is unreliable
-            if ( e.toString().indexOf( "already exists" ) != -1 )
+            if ("23000".equals(e.getSQLState()))
             {
                 newT = false;
             }
@@ -159,11 +159,11 @@ public class JDBCDiskCacheRemovalUnitTes
 
         if ( newT )
         {
-            for ( int i = 1; i < setupData.length; i++ )
+            for ( int i = 0; i < setupData.length; i++ )
             {
                 try
                 {
-                    sStatement.executeQuery( setupData[i] );
+                    sStatement.execute( setupData[i] );
                 }
                 catch ( SQLException e )
                 {

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java Thu Dec 10 15:07:30 2015
@@ -19,11 +19,8 @@ package org.apache.commons.jcs.auxiliary
  * under the License.
  */
 
-import junit.framework.TestCase;
-import org.apache.commons.jcs.JCS;
-import org.apache.commons.jcs.access.CacheAccess;
-import org.apache.commons.jcs.access.exception.CacheException;
-import org.apache.commons.jcs.utils.timing.SleepUtil;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
@@ -31,29 +28,29 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Properties;
 
+import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
+import org.apache.commons.jcs.access.exception.CacheException;
+import org.apache.commons.jcs.utils.timing.SleepUtil;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
 /**
  * Runs basic tests for the JDBC disk cache.
  * <p>
  * @author Aaron Smuts
  */
 public class JDBCDiskCacheShrinkUnitTest
-    extends TestCase
 {
-
     /**
-     * Test setup
+     * Creates the DB
      * <p>
-     * @throws ClassNotFoundException
-     * @throws IllegalAccessException
-     * @throws InstantiationException
-     * @throws SQLException
+     * @throws Exception
      */
-    @Override
-    public void setUp()
-        throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
+    @BeforeClass
+    public static void setupDatabase() throws Exception
     {
-        JCS.setConfigFilename( "/TestJDBCDiskCacheShrink.ccf" );
-
         System.setProperty( "hsqldb.cache_scale", "8" );
 
         String rafroot = "target";
@@ -72,11 +69,21 @@ public class JDBCDiskCacheShrinkUnitTest
     }
 
     /**
+     * Test setup
+     */
+    @Before
+    public void setUp()
+    {
+        JCS.setConfigFilename( "/TestJDBCDiskCacheShrink.ccf" );
+    }
+
+    /**
      * Test the basic JDBC disk cache functionality with a hsql backing. Verify that items
      * configured to expire after 1 second actually expire.
      * <p>
      * @throws Exception
      */
+    @Test
     public void testExpireInBackground()
         throws Exception
     {
@@ -114,6 +121,7 @@ public class JDBCDiskCacheShrinkUnitTest
      * @throws CacheException
      * @throws InterruptedException
      */
+    @Test
     public void testDidNotExpire()
         throws CacheException, InterruptedException
     {
@@ -166,6 +174,7 @@ public class JDBCDiskCacheShrinkUnitTest
      * @throws CacheException
      * @throws InterruptedException
      */
+    @Test
     public void testDidNotExpireEternal()
         throws CacheException, InterruptedException
     {
@@ -219,7 +228,7 @@ public class JDBCDiskCacheShrinkUnitTest
      *
      * @throws SQLException if database problems occur
      */
-    void setupTABLE( Connection cConn ) throws SQLException
+    private static void setupTABLE( Connection cConn ) throws SQLException
     {
         boolean newT = true;
 
@@ -241,11 +250,11 @@ public class JDBCDiskCacheShrinkUnitTest
 
         try
         {
-            sStatement.executeQuery( createSql.toString() );
+            sStatement.execute( createSql.toString() );
         }
         catch ( SQLException e )
         {
-            if ( e.toString().indexOf( "already exists" ) != -1 )
+            if ("23000".equals(e.getSQLState()))
             {
                 newT = false;
             }
@@ -263,11 +272,11 @@ public class JDBCDiskCacheShrinkUnitTest
 
         if ( newT )
         {
-            for ( int i = 1; i < setupData.length; i++ )
+            for ( int i = 0; i < setupData.length; i++ )
             {
                 try
                 {
-                    sStatement.executeQuery( setupData[i] );
+                    sStatement.execute( setupData[i] );
                 }
                 catch ( SQLException e )
                 {

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java?rev=1719092&r1=1719091&r2=1719092&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java Thu Dec 10 15:07:30 2015
@@ -19,6 +19,10 @@ package org.apache.commons.jcs.auxiliary
  * under the License.
  */
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
@@ -27,28 +31,27 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.jcs.JCS;
 import org.apache.commons.jcs.access.CacheAccess;
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 /**
  * Runs basic tests for the JDBC disk cache.
  * @author Aaron Smuts
  */
 public class MySQLDiskCacheHsqlBackedUnitTest
-    extends TestCase
 {
     /**
      * Creates the DB
      * <p>
      * @throws Exception
      */
-    public MySQLDiskCacheHsqlBackedUnitTest()
-        throws Exception
+    @BeforeClass
+    public static void setupDatabase() throws Exception
     {
-        super();
         System.setProperty( "hsqldb.cache_scale", "8" );
 
         String rafroot = "target";
@@ -66,7 +69,7 @@ public class MySQLDiskCacheHsqlBackedUni
     /**
      * Test setup
      */
-    @Override
+    @Before
     public void setUp()
     {
         JCS.setConfigFilename( "/TestMySQLDiskCache.ccf" );
@@ -76,6 +79,7 @@ public class MySQLDiskCacheHsqlBackedUni
      * Test the basic JDBC disk cache functionality with a hsql backing.
      * @throws Exception
      */
+    @Test
     public void testSimpleJDBCPutGetWithHSQL()
         throws Exception
     {
@@ -148,6 +152,7 @@ public class MySQLDiskCacheHsqlBackedUni
      * <p>
      * @throws Exception
      */
+    @Test
     public void testPutGetMatchingWithHSQL()
         throws Exception
     {
@@ -176,7 +181,7 @@ public class MySQLDiskCacheHsqlBackedUni
      * SETUP TABLE FOR CACHE
      * @param cConn
      */
-    void setupTABLE( Connection cConn ) throws SQLException
+    private static void setupTABLE( Connection cConn ) throws SQLException
     {
         boolean newT = true;
 




Mime
View raw message