You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2019/05/28 13:48:48 UTC

[commons-jcs] branch master updated (ad89701 -> d8b77d1)

This is an automated email from the ASF dual-hosted git repository.

tv pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git.


    from ad89701  More Java 8, trim whitespace
     new d879971  Remove most Iterators
     new 4f39598  JCS-195 Update element attributes size on serialization
     new 79e8cbb  Remove duplicate code
     new eb4ec71  JCS-195 Update element attributes size on serialization
     new bd42161  Make all statistic numbers long
     new 6b6cf13  Remove synchronized sections
     new efdbca6  JCS-194 NullPointerException in IndexedDiskCache.addToRecycleBin(...)
     new b8486dc  Use lambdas for Runnables
     new d8b77d1  Use Java7 diamond operator

The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/org/apache/commons/jcs/JCS.java  |   12 +-
 .../org/apache/commons/jcs/access/CacheAccess.java |    4 +-
 .../commons/jcs/access/GroupCacheAccess.java       |    4 +-
 .../commons/jcs/access/PartitionedCacheAccess.java |    8 +-
 .../apache/commons/jcs/admin/CacheRegionInfo.java  |   20 +-
 .../org/apache/commons/jcs/admin/JCSAdminBean.java |   16 +-
 .../org/apache/commons/jcs/admin/JCSJMXBean.java   |    4 +-
 .../jcs/auxiliary/AbstractAuxiliaryCache.java      |    8 +-
 .../jcs/auxiliary/disk/AbstractDiskCache.java      |   53 +-
 .../jcs/auxiliary/disk/block/BlockDisk.java        |    2 +-
 .../jcs/auxiliary/disk/block/BlockDiskCache.java   |   84 +-
 .../disk/block/BlockDiskCacheFactory.java          |    2 +-
 .../auxiliary/disk/block/BlockDiskKeyStore.java    |   10 +-
 .../auxiliary/disk/indexed/IndexedDiskCache.java   |  133 +-
 .../disk/indexed/IndexedDiskCacheFactory.java      |    2 +-
 .../auxiliary/disk/indexed/IndexedDiskDumper.java  |    2 +-
 .../jcs/auxiliary/disk/jdbc/JDBCDiskCache.java     |   10 +-
 .../auxiliary/disk/jdbc/JDBCDiskCacheFactory.java  |    8 +-
 .../jcs/auxiliary/disk/jdbc/ShrinkerThread.java    |    2 +-
 .../disk/jdbc/dsfactory/JndiDataSourceFactory.java |  364 ++--
 .../disk/jdbc/hsql/HSQLDiskCacheFactory.java       |    2 +-
 .../disk/jdbc/mysql/MySQLDiskCacheFactory.java     |    2 +-
 .../jcs/auxiliary/lateral/LateralCache.java        |    2 +-
 .../jcs/auxiliary/lateral/LateralCacheMonitor.java |    2 +-
 .../jcs/auxiliary/lateral/LateralCacheNoWait.java  |   20 +-
 .../lateral/LateralCacheNoWaitFacade.java          |   10 +-
 .../lateral/socket/tcp/LateralTCPCacheFactory.java |   16 +-
 .../socket/tcp/LateralTCPDiscoveryListener.java    |    4 +-
 .../lateral/socket/tcp/LateralTCPListener.java     |    4 +-
 .../lateral/socket/tcp/LateralTCPService.java      |   32 +-
 .../remote/AbstractRemoteAuxiliaryCache.java       |   12 +-
 .../remote/AbstractRemoteCacheNoWaitFacade.java    |    8 +-
 .../commons/jcs/auxiliary/remote/RemoteCache.java  |    8 +-
 .../jcs/auxiliary/remote/RemoteCacheFactory.java   |    8 +-
 .../jcs/auxiliary/remote/RemoteCacheManager.java   |   10 +-
 .../jcs/auxiliary/remote/RemoteCacheMonitor.java   |    2 +-
 .../jcs/auxiliary/remote/RemoteCacheNoWait.java    |   20 +-
 .../auxiliary/remote/RemoteCacheNoWaitFacade.java  |    2 +-
 .../remote/http/client/RemoteHttpCache.java        |    2 +-
 .../remote/http/client/RemoteHttpCacheFactory.java |    8 +-
 .../remote/http/client/RemoteHttpCacheMonitor.java |    2 +-
 .../http/server/AbstractRemoteCacheService.java    |    4 +-
 .../remote/http/server/RemoteHttpCacheServlet.java |    8 +-
 .../auxiliary/remote/server/RemoteCacheServer.java |   41 +-
 .../remote/server/RemoteCacheServerFactory.java    |    4 +-
 .../remote/util/RemoteCacheRequestFactory.java     |    2 +-
 .../commons/jcs/engine/CacheEventQueueFactory.java |    4 +-
 .../apache/commons/jcs/engine/CacheListeners.java  |   31 +-
 .../commons/jcs/engine/CacheWatchRepairable.java   |    4 +-
 .../commons/jcs/engine/ElementAttributes.java      |    5 +-
 .../commons/jcs/engine/PooledCacheEventQueue.java  |   10 +-
 .../jcs/engine/ZombieCacheServiceNonLocal.java     |   10 +-
 .../jcs/engine/behavior/IElementAttributes.java    |    3 +-
 .../commons/jcs/engine/control/CompositeCache.java |  537 +++---
 .../engine/control/CompositeCacheConfigurator.java |    8 +-
 .../jcs/engine/control/CompositeCacheManager.java  |   12 +-
 .../logging/CacheEventLoggerDebugLogger.java       |    2 +-
 .../AbstractDoubleLinkedListMemoryCache.java       |   10 +-
 .../jcs/engine/memory/AbstractMemoryCache.java     |   46 +-
 .../jcs/engine/memory/lru/LHMLRUMemoryCache.java   |    3 +-
 .../memory/soft/SoftReferenceMemoryCache.java      |   12 +-
 .../util/SoftReferenceElementDescriptor.java       |    2 +-
 .../apache/commons/jcs/utils/access/JCSWorker.java |    2 +-
 .../jcs/utils/discovery/UDPCleanupRunner.java      |    2 +-
 .../jcs/utils/discovery/UDPDiscoveryManager.java   |    2 +-
 .../jcs/utils/discovery/UDPDiscoveryMessage.java   |    2 +-
 .../jcs/utils/discovery/UDPDiscoveryReceiver.java  |   36 +-
 .../utils/discovery/UDPDiscoverySenderThread.java  |    2 +-
 .../jcs/utils/discovery/UDPDiscoveryService.java   |   14 +-
 .../utils/serialization/CompressingSerializer.java |   60 +-
 .../serialization/SerializationConversionUtil.java |    9 +-
 .../utils/serialization/StandardSerializer.java    |    7 +-
 .../commons/jcs/utils/struct/AbstractLRUMap.java   |   67 +-
 .../jcs/utils/threadpool/ThreadPoolManager.java    |   10 +-
 .../jcs/JCSConcurrentCacheAccessUnitTest.java      |    4 +-
 .../java/org/apache/commons/jcs/JCSThrashTest.java |    2 +-
 .../java/org/apache/commons/jcs/JCSUnitTest.java   |    4 +-
 .../commons/jcs/JCSvsHashtablePerformanceTest.java |    2 +-
 .../commons/jcs/access/CacheAccessUnitTest.java    |    2 +-
 .../commons/jcs/auxiliary/MockAuxiliaryCache.java  |    4 +-
 .../jcs/auxiliary/MockAuxiliaryCacheFactory.java   |    2 +-
 .../jcs/auxiliary/MockCacheEventLogger.java        |    4 +-
 .../auxiliary/disk/AbstractDiskCacheUnitTest.java  |   20 +-
 .../auxiliary/disk/PurgatoryElementUnitTest.java   |   12 +-
 .../block/BlockDiskCacheConcurrentUnitTest.java    |    4 +-
 .../disk/block/BlockDiskCacheKeyStoreUnitTest.java |    8 +-
 ...BlockDiskCacheSameRegionConcurrentUnitTest.java |    2 +-
 .../disk/block/BlockDiskCacheUnitTestAbstract.java | 1144 +++++------
 .../block/BlockDiskElementDescriptorUnitTest.java  |    2 +-
 .../auxiliary/disk/indexed/DiskTestObjectUtil.java |    4 +-
 .../disk/indexed/IndexDiskCacheCountUnitTest.java  |  218 +--
 .../disk/indexed/IndexDiskCacheSizeUnitTest.java   |  220 +--
 .../indexed/IndexDiskCacheUnitTestAbstract.java    | 1978 ++++++++++----------
 .../IndexedDiskCacheConcurrentUnitTest.java        |    4 +-
 .../indexed/IndexedDiskCacheKeyStoreUnitTest.java  |   10 +-
 .../indexed/IndexedDiskCacheNoMemoryUnitTest.java  |    2 +-
 .../IndexedDiskCacheOptimizationUnitTest.java      |    2 +-
 ...dexedDiskCacheSameRegionConcurrentUnitTest.java |    2 +-
 .../auxiliary/disk/indexed/LRUMapSizeVsCount.java  |    2 +-
 .../disk/jdbc/JDBCDataSourceFactoryUnitTest.java   |    2 +-
 .../disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java |    2 +-
 .../auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java |    2 +-
 .../jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java |    2 +-
 .../disk/jdbc/hsql/HSQLDiskCacheUnitTest.java      |    2 +-
 .../mysql/MySQLDiskCacheHsqlBackedUnitTest.java    |    2 +-
 .../disk/jdbc/mysql/MySQLDiskCacheUnitTest.java    |    2 +-
 .../lateral/LateralCacheNoWaitFacadeUnitTest.java  |   26 +-
 .../tcp/LateralTCPConcurrentRandomTestUtil.java    |    4 +-
 .../tcp/LateralTCPDiscoveryListenerUnitTest.java   |   36 +-
 .../LateralTCPFilterRemoveHashCodeUnitTest.java    |    6 +-
 .../tcp/LateralTCPIssueRemoveOnPutUnitTest.java    |   10 +-
 .../lateral/socket/tcp/TestTCPLateralUnitTest.java |   34 +-
 .../auxiliary/remote/MockRemoteCacheClient.java    |   10 +-
 .../auxiliary/remote/MockRemoteCacheListener.java  |    4 +-
 .../auxiliary/remote/MockRemoteCacheService.java   |   10 +-
 .../auxiliary/remote/RemoteCacheClientTester.java  |    4 +-
 .../remote/RemoteCacheListenerUnitTest.java        |    8 +-
 .../remote/RemoteCacheNoWaitFacadeUnitTest.java    |  112 +-
 .../remote/RemoteCacheNoWaitUnitTest.java          |   42 +-
 .../jcs/auxiliary/remote/RemoteCacheUnitTest.java  |   34 +-
 .../jcs/auxiliary/remote/TestRemoteCache.java      |    2 +-
 .../remote/ZombieRemoteCacheServiceUnitTest.java   |   20 +-
 .../http/client/RemoteHttpCacheClientUnitTest.java |   34 +-
 .../server/RemoteHttpCacheServiceUnitTest.java     |   16 +-
 .../server/RemoteHttpCacheServletUnitTest.java     |    4 +-
 .../BasicRemoteCacheClientServerUnitTest.java      |   12 +-
 .../remote/server/RemoteCacheServerUnitTest.java   |   46 +-
 .../util/RemoteCacheRequestFactoryUnitTest.java    |    2 +-
 .../jcs/engine/CacheEventQueueFactoryUnitTest.java |    8 +-
 .../jcs/engine/EventQueueConcurrentLoadTest.java   |   10 +-
 .../jcs/engine/MockCacheServiceNonLocal.java       |   10 +-
 .../engine/ZombieCacheServiceNonLocalUnitTest.java |   20 +-
 .../control/CompositeCacheDiskUsageUnitTest.java   |   40 +-
 .../jcs/engine/control/CompositeCacheUnitTest.java |   28 +-
 .../engine/control/MockCompositeCacheManager.java  |    2 +-
 .../jcs/engine/logging/MockCacheEventLogger.java   |    2 +-
 .../match/KeyMatcherPatternImpllUnitTest.java      |   12 +-
 .../commons/jcs/engine/memory/MockMemoryCache.java |    6 +-
 .../memory/fifo/FIFOMemoryCacheUnitTest.java       |   14 +-
 .../lru/LHMLRUMemoryCacheConcurrentUnitTest.java   |    6 +-
 .../memory/lru/LHMLRUMemoryCacheUnitTest.java      |    6 +-
 .../lru/LRUMemoryCacheConcurrentUnitTest.java      |    6 +-
 .../engine/memory/mru/MRUMemoryCacheUnitTest.java  |    6 +-
 .../memory/shrinking/ShrinkerThreadUnitTest.java   |   34 +-
 .../soft/SoftReferenceMemoryCacheUnitTest.java     |    6 +-
 .../jcs/utils/access/JCSWorkerUnitTest.java        |    2 +-
 .../jcs/utils/discovery/MockDiscoveryListener.java |    2 +-
 .../discovery/UDPDiscoverySenderUnitTest.java      |    4 +-
 .../discovery/UDPDiscoveryServiceUnitTest.java     |   10 +-
 .../jcs/utils/discovery/UDPDiscoveryUnitTest.java  |    2 +-
 .../CompressingSerializerUnitTest.java             |    2 +-
 .../SerializationConversionUtilUnitTest.java       |    6 +-
 .../jcs/utils/struct/DoubleLinkedListUnitTest.java |   40 +-
 .../struct/JCSvsCommonsLRUMapPerformanceTest.java  |    2 +-
 .../jcs/utils/struct/LRUMapConcurrentUnitTest.java |   10 +-
 .../jcs/utils/struct/LRUMapPerformanceTest.java    |    2 +-
 .../commons/jcs/utils/struct/LRUMapUnitTest.java   |   10 +-
 157 files changed, 3071 insertions(+), 3280 deletions(-)


[commons-jcs] 08/09: Use lambdas for Runnables

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit b8486dccdc7bec2314a9d7e0b3d445c34e5169ad
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:46:27 2019 +0200

    Use lambdas for Runnables
---
 .../jcs/auxiliary/disk/AbstractDiskCache.java      | 37 +++++-----
 .../jcs/auxiliary/disk/block/BlockDiskCache.java   | 29 +-------
 .../auxiliary/disk/indexed/IndexedDiskCache.java   | 78 ++++++++--------------
 .../jcs/utils/discovery/UDPDiscoveryReceiver.java  | 36 ++++------
 .../jcs/utils/discovery/UDPDiscoveryService.java   |  4 +-
 5 files changed, 62 insertions(+), 122 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java
index 6f42f20..a536876 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java
@@ -437,32 +437,27 @@ public abstract class AbstractDiskCache<K, V>
     public final void dispose()
         throws IOException
     {
-        Runnable disR = new Runnable()
+        Thread t = new Thread(() ->
         {
-            @Override
-            public void run()
+            boolean keepGoing = true;
+            // long total = 0;
+            long interval = 100;
+            while ( keepGoing )
             {
-                boolean keepGoing = true;
-                // long total = 0;
-                long interval = 100;
-                while ( keepGoing )
+                keepGoing = !cacheEventQueue.isEmpty();
+                try
                 {
-                    keepGoing = !cacheEventQueue.isEmpty();
-                    try
-                    {
-                        Thread.sleep( interval );
-                        // total += interval;
-                        // log.info( "total = " + total );
-                    }
-                    catch ( InterruptedException e )
-                    {
-                        break;
-                    }
+                    Thread.sleep( interval );
+                    // total += interval;
+                    // log.info( "total = " + total );
+                }
+                catch ( InterruptedException e )
+                {
+                    break;
                 }
-                log.info( "No longer waiting for event queue to finish: " + cacheEventQueue.getStatistics() );
             }
-        };
-        Thread t = new Thread( disR );
+            log.info( "No longer waiting for event queue to finish: " + cacheEventQueue.getStatistics() );
+        });
         t.start();
         // wait up to 60 seconds for dispose and then quit if not done.
         try
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
index 2eae22b..06f89ba 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
@@ -171,15 +171,7 @@ public class BlockDiskCache<K, V>
         // TODO we might need to stagger this a bit.
         if ( this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds() > 0 )
         {
-            future = scheduledExecutor.scheduleAtFixedRate(
-                    new Runnable()
-                    {
-                        @Override
-                        public void run()
-                        {
-                            keyStore.saveKeys();
-                        }
-                    },
+            future = scheduledExecutor.scheduleAtFixedRate(keyStore::saveKeys,
                     this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds(),
                     this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds(),
                     TimeUnit.SECONDS);
@@ -574,22 +566,7 @@ public class BlockDiskCache<K, V>
     @Override
     public void processDispose()
     {
-        Runnable disR = new Runnable()
-        {
-            @Override
-            public void run()
-            {
-                try
-                {
-                    disposeInternal();
-                }
-                catch ( InterruptedException e )
-                {
-                    log.warn( "Interrupted while diposing." );
-                }
-            }
-        };
-        Thread t = new Thread( disR, "BlockDiskCache-DisposalThread" );
+        Thread t = new Thread(this::disposeInternal, "BlockDiskCache-DisposalThread" );
         t.start();
         // wait up to 60 seconds for dispose and then quit if not done.
         try
@@ -604,10 +581,8 @@ public class BlockDiskCache<K, V>
 
     /**
      * Internal method that handles the disposal.
-     * @throws InterruptedException
      */
     protected void disposeInternal()
-        throws InterruptedException
     {
         if ( !isAlive() )
         {
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
index 825376e..c288784 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
@@ -79,7 +79,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
     private IndexedDisk keyFile;
 
     /** Map containing the keys and disk offsets. */
-    private Map<K, IndexedDiskElementDescriptor> keyHash;
+    private final Map<K, IndexedDiskElementDescriptor> keyHash;
 
     /** The maximum number of keys that we will keep in memory. */
     private final int maxKeySize;
@@ -112,11 +112,10 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
     private boolean queueInput = false;
 
     /** list where puts made during optimization are made */
-    private final ConcurrentSkipListSet<IndexedDiskElementDescriptor> queuedPutList =
-            new ConcurrentSkipListSet<IndexedDiskElementDescriptor>(new PositionComparator());
+    private final ConcurrentSkipListSet<IndexedDiskElementDescriptor> queuedPutList;
 
     /** RECYLCE BIN -- array of empty spots */
-    private ConcurrentSkipListSet<IndexedDiskElementDescriptor> recycle;
+    private final ConcurrentSkipListSet<IndexedDiskElementDescriptor> recycle;
 
     /** User configurable parameters */
     private final IndexedDiskCacheAttributes cattr;
@@ -174,14 +173,15 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
         this.diskLimitType = cattr.getDiskLimitType();
         // Make a clean file name
         this.fileName = getCacheName().replaceAll("[^a-zA-Z0-9-_\\.]", "_");
+        this.keyHash = createInitialKeyMap();
+        this.queuedPutList = new ConcurrentSkipListSet<>(new PositionComparator());
+        this.recycle = new ConcurrentSkipListSet<>();
 
         try
         {
-            initializeRecycleBin();
             initializeFileSystem(cattr);
             initializeKeysAndData(cattr);
 
-
             // Initialization finished successfully, so set alive to true.
             setAlive(true);
             if (log.isInfoEnabled())
@@ -263,7 +263,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
      */
     private void initializeEmptyStore() throws IOException
     {
-        initializeKeyMap();
+        this.keyHash.clear();
 
         if (dataFile.length() > 0)
         {
@@ -321,8 +321,8 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
 
         try
         {
-            // create a key map to use.
-            initializeKeyMap();
+            // clear a key map to use.
+            keyHash.clear();
 
             HashMap<K, IndexedDiskElementDescriptor> keys = keyFile.readObject(
                 new IndexedDiskElementDescriptor(0, (int) keyFile.length() - IndexedDisk.HEADER_SIZE_BYTES));
@@ -961,13 +961,12 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
             dataFile = new IndexedDisk(new File(rafDir, fileName + ".data"), getElementSerializer());
             keyFile = new IndexedDisk(new File(rafDir, fileName + ".key"), getElementSerializer());
 
-            initializeRecycleBin();
-
-            initializeKeyMap();
+            this.recycle.clear();
+            this.keyHash.clear();
         }
         catch (IOException e)
         {
-            log.error(logCacheName + "Failure reseting state", e);
+            log.error(logCacheName + "Failure resetting state", e);
         }
         finally
         {
@@ -976,29 +975,22 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
     }
 
     /**
-     * If the maxKeySize is < 0, use 5000, no way to have an unlimited recycle bin right now, or one
-     * less than the mazKeySize.
-     */
-    private void initializeRecycleBin()
-    {
-        recycle = new ConcurrentSkipListSet<IndexedDiskElementDescriptor>();
-    }
-
-    /**
      * Create the map for keys that contain the index position on disk.
+     * 
+     * @return a new empty Map for keys and IndexedDiskElementDescriptors
      */
-    private void initializeKeyMap()
+    private Map<K, IndexedDiskElementDescriptor> createInitialKeyMap()
     {
-        keyHash = null;
+        Map<K, IndexedDiskElementDescriptor> keyMap = null;
         if (maxKeySize >= 0)
         {
             if (this.diskLimitType == DiskLimitType.COUNT)
             {
-                keyHash = new LRUMapCountLimited(maxKeySize);
+                keyMap = new LRUMapCountLimited(maxKeySize);
             }
             else
             {
-                keyHash = new LRUMapSizeLimited(maxKeySize);
+                keyMap = new LRUMapSizeLimited(maxKeySize);
             }
 
             if (log.isInfoEnabled())
@@ -1009,13 +1001,15 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
         else
         {
             // If no max size, use a plain map for memory and processing efficiency.
-            keyHash = new HashMap<K, IndexedDiskElementDescriptor>();
+            keyMap = new HashMap<>();
             // keyHash = Collections.synchronizedMap( new HashMap() );
             if (log.isInfoEnabled())
             {
                 log.info(logCacheName + "Set maxKeySize to unlimited'");
             }
         }
+        
+        return keyMap;
     }
 
     /**
@@ -1030,15 +1024,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
         ICacheEvent<String> cacheEvent = createICacheEvent(getCacheName(), "none", ICacheEventLogger.DISPOSE_EVENT);
         try
         {
-            Runnable disR = new Runnable()
-            {
-                @Override
-                public void run()
-                {
-                    disposeInternal();
-                }
-            };
-            Thread t = new Thread(disR, "IndexedDiskCache-DisposalThread");
+            Thread t = new Thread(this::disposeInternal, "IndexedDiskCache-DisposalThread");
             t.start();
             // wait up to 60 seconds for dispose and then quit if not done.
             try
@@ -1076,7 +1062,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
             // Join with the current optimization thread.
             if (log.isDebugEnabled())
             {
-                log.debug(logCacheName + "In dispose, optimization already " + "in progress; waiting for completion.");
+                log.debug(logCacheName + "In dispose, optimization already in progress; waiting for completion.");
             }
             try
             {
@@ -1136,14 +1122,14 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
 
             try
             {
-                this.adjustBytesFree(ded, true);
+                adjustBytesFree(ded, true);
 
                 if (doRecycle)
                 {
                     recycle.add(ded);
                     if (log.isDebugEnabled())
                     {
-                        log.debug(logCacheName + "recycled ded" + ded);
+                        log.debug(logCacheName + "recycled ded " + ded);
                     }
 
                 }
@@ -1178,15 +1164,9 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
                 {
                     if (currentOptimizationThread == null)
                     {
-                        currentOptimizationThread = new Thread(new Runnable()
-                        {
-                            @Override
-                            public void run()
-                            {
-                                optimizeFile();
-
-                                currentOptimizationThread = null;
-                            }
+                        currentOptimizationThread = new Thread(() -> {
+                            optimizeFile();
+                            currentOptimizationThread = null;
                         }, "IndexedDiskCache-OptimizationThread");
                     }
                 }
@@ -1279,7 +1259,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
             // RESTORE NORMAL OPERATION
             removeCount = 0;
             resetBytesFree();
-            initializeRecycleBin();
+            this.recycle.clear();
             queuedPutList.clear();
             queueInput = false;
             // turn recycle back on.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
index 0f5f510..b519159 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
@@ -26,6 +26,7 @@ import java.net.DatagramPacket;
 import java.net.InetAddress;
 import java.net.MulticastSocket;
 import java.util.concurrent.ExecutorService;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.jcs.engine.CacheInfo;
 import org.apache.commons.jcs.engine.behavior.IShutdownObserver;
@@ -57,19 +58,19 @@ public class UDPDiscoveryReceiver
     private static final int maxPoolSize = 2;
 
     /** The processor */
-    private ExecutorService pooledExecutor = null;
+    private final ExecutorService pooledExecutor;
 
     /** number of messages received. For debugging and testing. */
-    private int cnt = 0;
+    private AtomicInteger cnt = new AtomicInteger(0);
 
     /** Service to get cache names and handle request broadcasts */
-    private UDPDiscoveryService service = null;
+    private final UDPDiscoveryService service;
 
     /** Address */
-    private String multicastAddressString = "";
+    private final String multicastAddressString;
 
     /** The port */
-    private int multicastPort = 0;
+    private final int multicastPort;
 
     /** Is it shutdown. */
     private boolean shutdown = false;
@@ -92,7 +93,7 @@ public class UDPDiscoveryReceiver
         this.multicastPort = multicastPort;
 
         // create a small thread pool to handle a barrage
-        pooledExecutor = ThreadPoolManager.getInstance().createPool(
+        this.pooledExecutor = ThreadPoolManager.getInstance().createPool(
         		new PoolConfiguration(false, 0, maxPoolSize, maxPoolSize, 0, WhenBlockedPolicy.DISCARDOLDEST, maxPoolSize),
         		"JCS-UDPDiscoveryReceiver-", Thread.MIN_PRIORITY);
 
@@ -101,16 +102,7 @@ public class UDPDiscoveryReceiver
             log.info( "Constructing listener, [" + this.multicastAddressString + ":" + this.multicastPort + "]" );
         }
 
-        try
-        {
-            createSocket( this.multicastAddressString, this.multicastPort );
-        }
-        catch ( IOException ioe )
-        {
-            // consider eating this so we can go on, or constructing the socket
-            // later
-            throw ioe;
-        }
+        createSocket( this.multicastAddressString, this.multicastPort );
     }
 
     /**
@@ -165,9 +157,8 @@ public class UDPDiscoveryReceiver
                 log.debug( "Received packet from address [" + packet.getSocketAddress() + "]" );
             }
 
-            final ByteArrayInputStream byteStream = new ByteArrayInputStream( mBuffer, 0, packet.getLength() );
-
-            try (ObjectInputStream objectStream = new ObjectInputStreamClassLoaderAware( byteStream, null ))
+            try (ByteArrayInputStream byteStream = new ByteArrayInputStream(mBuffer, 0, packet.getLength());
+                 ObjectInputStream objectStream = new ObjectInputStreamClassLoaderAware(byteStream, null))
             {
                 obj = objectStream.readObject();
             }
@@ -204,8 +195,7 @@ public class UDPDiscoveryReceiver
             {
                 Object obj = waitForMessage();
 
-                // not thread safe, but just for debugging
-                cnt++;
+                cnt.incrementAndGet();
 
                 if ( log.isDebugEnabled() )
                 {
@@ -261,7 +251,7 @@ public class UDPDiscoveryReceiver
      */
     public void setCnt( int cnt )
     {
-        this.cnt = cnt;
+        this.cnt.set(cnt);
     }
 
     /**
@@ -269,7 +259,7 @@ public class UDPDiscoveryReceiver
      */
     public int getCnt()
     {
-        return cnt;
+        return cnt.get();
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
index b2047d7..15b635f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
@@ -300,8 +300,8 @@ public class UDPDiscoveryService
      */
     public void startup()
     {
-        udpReceiverThread = new Thread( receiver );
-        udpReceiverThread.setDaemon( true );
+        udpReceiverThread = new Thread(receiver);
+        udpReceiverThread.setDaemon(true);
         // udpReceiverThread.setName( t.getName() + "--UDPReceiver" );
         udpReceiverThread.start();
     }


[commons-jcs] 04/09: JCS-195 Update element attributes size on serialization

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit eb4ec7143c1d7f4e576c33fc97b17d36d08bfbdd
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:39:54 2019 +0200

    JCS-195 Update element attributes size on serialization
---
 .../src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java | 3 ++-
 .../org/apache/commons/jcs/engine/behavior/IElementAttributes.java     | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java
index 4fd0252..e0dd6b8 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java
@@ -160,7 +160,8 @@ public class ElementAttributes
     }
 
     /**
-     * Size in bytes. This is not used except in the admin pages. It will be -1 by default.
+     * Size in bytes. This is not used except in the admin pages. It will be 0 by default
+     * and is only updated when the element is serialized.
      * <p>
      * @param size The new size value
      */
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/IElementAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/IElementAttributes.java
index 2aa4e46..116d187 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/IElementAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/IElementAttributes.java
@@ -60,7 +60,8 @@ public interface IElementAttributes extends Serializable, Cloneable
     void setIdleTime( long idle );
 
     /**
-     * Size in bytes. This is not used except in the admin pages. It will be -1 by default.
+     * Size in bytes. This is not used except in the admin pages. It will be 0 by default
+     * and is only updated when the element is serialized.
      * <p>
      * @param size The new size value
      */


[commons-jcs] 02/09: JCS-195 Update element attributes size on serialization

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit 4f395986a06fb96187c1a70dddbbac7799a92abc
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:36:35 2019 +0200

    JCS-195 Update element attributes size on serialization
---
 .../commons/jcs/utils/serialization/SerializationConversionUtil.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java
index 35c945c..3eb7cb8 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java
@@ -71,7 +71,10 @@ public class SerializationConversionUtil
             {
                 try
                 {
-                    serializedValue = elementSerializer.serialize( element.getVal() );
+                    serializedValue = elementSerializer.serialize(element.getVal());
+
+                    // update size in bytes
+                    element.getElementAttributes().setSize(serializedValue.length);
                 }
                 catch ( IOException e )
                 {


[commons-jcs] 06/09: Remove synchronized sections

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit 6b6cf13d8f0709ea8b6029416805d68df594bbd2
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:43:20 2019 +0200

    Remove synchronized sections
---
 .../commons/jcs/engine/control/CompositeCache.java | 472 ++++++++++-----------
 1 file changed, 227 insertions(+), 245 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
index cf49552..8f2efda 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
@@ -29,7 +29,7 @@ import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -95,22 +95,22 @@ public class CompositeCache<K, V>
     private ICompositeCacheAttributes cacheAttr;
 
     /** How many times update was called. */
-    private AtomicInteger updateCount;
+    private AtomicLong updateCount;
 
     /** How many times remove was called. */
-    private AtomicInteger removeCount;
+    private AtomicLong removeCount;
 
     /** Memory cache hit count */
-    private AtomicInteger hitCountRam;
+    private AtomicLong hitCountRam;
 
     /** Auxiliary cache hit count (number of times found in ANY auxiliary) */
-    private AtomicInteger hitCountAux;
+    private AtomicLong hitCountAux;
 
     /** Count of misses where element was not found. */
-    private AtomicInteger missCountNotFound;
+    private AtomicLong missCountNotFound;
 
     /** Count of misses where element was expired. */
-    private AtomicInteger missCountExpired;
+    private AtomicLong missCountExpired;
 
     /** Cache manager. */
     private CompositeCacheManager cacheManager = null;
@@ -137,12 +137,12 @@ public class CompositeCache<K, V>
         this.attr = attr;
         this.cacheAttr = cattr;
         this.alive = new AtomicBoolean(true);
-        this.updateCount = new AtomicInteger(0);
-        this.removeCount = new AtomicInteger(0);
-        this.hitCountRam = new AtomicInteger(0);
-        this.hitCountAux = new AtomicInteger(0);
-        this.missCountNotFound = new AtomicInteger(0);
-        this.missCountExpired = new AtomicInteger(0);
+        this.updateCount = new AtomicLong(0);
+        this.removeCount = new AtomicLong(0);
+        this.hitCountRam = new AtomicLong(0);
+        this.hitCountAux = new AtomicLong(0);
+        this.missCountNotFound = new AtomicLong(0);
+        this.missCountExpired = new AtomicLong(0);
 
         createMemoryCache(cattr);
 
@@ -260,12 +260,8 @@ public class CompositeCache<K, V>
         }
 
         updateCount.incrementAndGet();
-
-        synchronized (this)
-        {
-            memCache.update(cacheElement);
-            updateAuxiliaries(cacheElement, localOnly);
-        }
+        memCache.update(cacheElement);
+        updateAuxiliaries(cacheElement, localOnly);
 
         cacheElement.getElementAttributes().setLastAccessTimeNow();
     }
@@ -510,113 +506,110 @@ public class CompositeCache<K, V>
             log.debug("get: key = " + key + ", localOnly = " + localOnly);
         }
 
-        synchronized (this)
+        try
         {
-            try
-            {
-                // First look in memory cache
-                element = memCache.get(key);
+            // First look in memory cache
+            element = memCache.get(key);
 
-                if (element != null)
+            if (element != null)
+            {
+                // Found in memory cache
+                if (isExpired(element))
                 {
-                    // Found in memory cache
-                    if (isExpired(element))
+                    if (log.isDebugEnabled())
                     {
-                        if (log.isDebugEnabled())
-                        {
-                            log.debug(cacheAttr.getCacheName() + " - Memory cache hit, but element expired");
-                        }
-
-                        doExpires(element);
-                        element = null;
+                        log.debug(cacheAttr.getCacheName() + " - Memory cache hit, but element expired");
                     }
-                    else
-                    {
-                        if (log.isDebugEnabled())
-                        {
-                            log.debug(cacheAttr.getCacheName() + " - Memory cache hit");
-                        }
 
-                        // Update counters
-                        hitCountRam.incrementAndGet();
+                    doExpires(element);
+                    element = null;
+                }
+                else
+                {
+                    if (log.isDebugEnabled())
+                    {
+                        log.debug(cacheAttr.getCacheName() + " - Memory cache hit");
                     }
 
-                    found = true;
+                    // Update counters
+                    hitCountRam.incrementAndGet();
                 }
-                else
+
+                found = true;
+            }
+            else
+            {
+                // Item not found in memory. If local invocation look in aux
+                // caches, even if not local look in disk auxiliaries
+                for (AuxiliaryCache<K, V> aux : auxCaches)
                 {
-                    // Item not found in memory. If local invocation look in aux
-                    // caches, even if not local look in disk auxiliaries
-                    for (AuxiliaryCache<K, V> aux : auxCaches)
+                    if (aux != null)
                     {
-                        if (aux != null)
-                        {
-                            CacheType cacheType = aux.getCacheType();
+                        CacheType cacheType = aux.getCacheType();
 
-                            if (!localOnly || cacheType == CacheType.DISK_CACHE)
+                        if (!localOnly || cacheType == CacheType.DISK_CACHE)
+                        {
+                            if (log.isDebugEnabled())
                             {
-                                if (log.isDebugEnabled())
-                                {
-                                    log.debug("Attempting to get from aux [" + aux.getCacheName() + "] which is of type: "
-                                        + cacheType);
-                                }
-
-                                try
-                                {
-                                    element = aux.get(key);
-                                }
-                                catch (IOException e)
-                                {
-                                    log.error("Error getting from aux", e);
-                                }
+                                log.debug("Attempting to get from aux [" + aux.getCacheName() + "] which is of type: "
+                                    + cacheType);
                             }
 
-                            if (log.isDebugEnabled())
+                            try
+                            {
+                                element = aux.get(key);
+                            }
+                            catch (IOException e)
                             {
-                                log.debug("Got CacheElement: " + element);
+                                log.error("Error getting from aux", e);
                             }
+                        }
+
+                        if (log.isDebugEnabled())
+                        {
+                            log.debug("Got CacheElement: " + element);
+                        }
 
-                            // Item found in one of the auxiliary caches.
-                            if (element != null)
+                        // Item found in one of the auxiliary caches.
+                        if (element != null)
+                        {
+                            if (isExpired(element))
                             {
-                                if (isExpired(element))
+                                if (log.isDebugEnabled())
                                 {
-                                    if (log.isDebugEnabled())
-                                    {
-                                        log.debug(cacheAttr.getCacheName() + " - Aux cache[" + aux.getCacheName() + "] hit, but element expired.");
-                                    }
-
-                                    // This will tell the remotes to remove the item
-                                    // based on the element's expiration policy. The elements attributes
-                                    // associated with the item when it created govern its behavior
-                                    // everywhere.
-                                    doExpires(element);
-                                    element = null;
+                                    log.debug(cacheAttr.getCacheName() + " - Aux cache[" + aux.getCacheName() + "] hit, but element expired.");
                                 }
-                                else
+
+                                // This will tell the remotes to remove the item
+                                // based on the element's expiration policy. The elements attributes
+                                // associated with the item when it created govern its behavior
+                                // everywhere.
+                                doExpires(element);
+                                element = null;
+                            }
+                            else
+                            {
+                                if (log.isDebugEnabled())
                                 {
-                                    if (log.isDebugEnabled())
-                                    {
-                                        log.debug(cacheAttr.getCacheName() + " - Aux cache[" + aux.getCacheName() + "] hit");
-                                    }
-
-                                    // Update counters
-                                    hitCountAux.incrementAndGet();
-                                    copyAuxiliaryRetrievedItemToMemory(element);
+                                    log.debug(cacheAttr.getCacheName() + " - Aux cache[" + aux.getCacheName() + "] hit");
                                 }
 
-                                found = true;
-
-                                break;
+                                // Update counters
+                                hitCountAux.incrementAndGet();
+                                copyAuxiliaryRetrievedItemToMemory(element);
                             }
+
+                            found = true;
+
+                            break;
                         }
                     }
                 }
             }
-            catch (IOException e)
-            {
-                log.error("Problem encountered getting element.", e);
-            }
+        }
+        catch (IOException e)
+        {
+            log.error("Problem encountered getting element.", e);
         }
 
         if (!found)
@@ -1150,52 +1143,49 @@ public class CompositeCache<K, V>
 
         boolean removed = false;
 
-        synchronized (this)
+        try
         {
-            try
+            removed = memCache.remove(key);
+        }
+        catch (IOException e)
+        {
+            log.error(e);
+        }
+
+        // Removes from all auxiliary caches.
+        for (ICache<K, V> aux : auxCaches)
+        {
+            if (aux == null)
             {
-                removed = memCache.remove(key);
+                continue;
             }
-            catch (IOException e)
+
+            CacheType cacheType = aux.getCacheType();
+
+            // for now let laterals call remote remove but not vice versa
+            if (localOnly && (cacheType == CacheType.REMOTE_CACHE || cacheType == CacheType.LATERAL_CACHE))
             {
-                log.error(e);
+                continue;
             }
-
-            // Removes from all auxiliary caches.
-            for (ICache<K, V> aux : auxCaches)
+            try
             {
-                if (aux == null)
+                if (log.isDebugEnabled())
                 {
-                    continue;
+                    log.debug("Removing " + key + " from cacheType" + cacheType);
                 }
 
-                CacheType cacheType = aux.getCacheType();
+                boolean b = aux.remove(key);
 
-                // for now let laterals call remote remove but not vice versa
-                if (localOnly && (cacheType == CacheType.REMOTE_CACHE || cacheType == CacheType.LATERAL_CACHE))
-                {
-                    continue;
-                }
-                try
+                // Don't take the remote removal into account.
+                if (!removed && cacheType != CacheType.REMOTE_CACHE)
                 {
-                    if (log.isDebugEnabled())
-                    {
-                        log.debug("Removing " + key + " from cacheType" + cacheType);
-                    }
-
-                    boolean b = aux.remove(key);
-
-                    // Don't take the remote removal into account.
-                    if (!removed && cacheType != CacheType.REMOTE_CACHE)
-                    {
-                        removed = b;
-                    }
-                }
-                catch (IOException ex)
-                {
-                    log.error("Failure removing from aux", ex);
+                    removed = b;
                 }
             }
+            catch (IOException ex)
+            {
+                log.error("Failure removing from aux", ex);
+            }
         }
 
         return removed;
@@ -1235,40 +1225,37 @@ public class CompositeCache<K, V>
     protected void removeAll(boolean localOnly)
         throws IOException
     {
-        synchronized (this)
+        try
         {
-            try
-            {
-                memCache.removeAll();
+            memCache.removeAll();
 
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Removed All keys from the memory cache.");
-                }
-            }
-            catch (IOException ex)
+            if (log.isDebugEnabled())
             {
-                log.error("Trouble updating memory cache.", ex);
+                log.debug("Removed All keys from the memory cache.");
             }
+        }
+        catch (IOException ex)
+        {
+            log.error("Trouble updating memory cache.", ex);
+        }
 
-            // Removes from all auxiliary disk caches.
-            for (ICache<K, V> aux : auxCaches)
+        // Removes from all auxiliary disk caches.
+        for (ICache<K, V> aux : auxCaches)
+        {
+            if (aux != null && (aux.getCacheType() == CacheType.DISK_CACHE || !localOnly))
             {
-                if (aux != null && (aux.getCacheType() == CacheType.DISK_CACHE || !localOnly))
+                try
                 {
-                    try
-                    {
-                        if (log.isDebugEnabled())
-                        {
-                            log.debug("Removing All keys from cacheType" + aux.getCacheType());
-                        }
-
-                        aux.removeAll();
-                    }
-                    catch (IOException ex)
+                    if (log.isDebugEnabled())
                     {
-                        log.error("Failure removing all from aux", ex);
+                        log.debug("Removing All keys from cacheType" + aux.getCacheType());
                     }
+
+                    aux.removeAll();
+                }
+                catch (IOException ex)
+                {
+                    log.error("Failure removing all from aux", ex);
                 }
             }
         }
@@ -1303,93 +1290,90 @@ public class CompositeCache<K, V>
             log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] fromRemote [" + fromRemote + "]");
         }
 
-        synchronized (this)
+        // Remove us from the cache managers list
+        // This will call us back but exit immediately
+        if (cacheManager != null)
         {
-            // Remove us from the cache managers list
-            // This will call us back but exit immediately
-            if (cacheManager != null)
-            {
-                cacheManager.freeCache(getCacheName(), fromRemote);
-            }
+            cacheManager.freeCache(getCacheName(), fromRemote);
+        }
 
-            // Try to stop shrinker thread
-            if (future != null)
-            {
-                future.cancel(true);
-            }
+        // Try to stop shrinker thread
+        if (future != null)
+        {
+            future.cancel(true);
+        }
 
-            // Now, shut down the event queue
-            if (elementEventQ != null)
-            {
-                elementEventQ.dispose();
-                elementEventQ = null;
-            }
+        // Now, shut down the event queue
+        if (elementEventQ != null)
+        {
+            elementEventQ.dispose();
+            elementEventQ = null;
+        }
 
-            // Dispose of each auxiliary cache, Remote auxiliaries will be
-            // skipped if 'fromRemote' is true.
-            for (ICache<K, V> aux : auxCaches)
+        // Dispose of each auxiliary cache, Remote auxiliaries will be
+        // skipped if 'fromRemote' is true.
+        for (ICache<K, V> aux : auxCaches)
+        {
+            try
             {
-                try
+                // Skip this auxiliary if:
+                // - The auxiliary is null
+                // - The auxiliary is not alive
+                // - The auxiliary is remote and the invocation was remote
+                if (aux == null || aux.getStatus() != CacheStatus.ALIVE
+                    || (fromRemote && aux.getCacheType() == CacheType.REMOTE_CACHE))
                 {
-                    // Skip this auxiliary if:
-                    // - The auxiliary is null
-                    // - The auxiliary is not alive
-                    // - The auxiliary is remote and the invocation was remote
-                    if (aux == null || aux.getStatus() != CacheStatus.ALIVE
-                        || (fromRemote && aux.getCacheType() == CacheType.REMOTE_CACHE))
-                    {
-                        if (log.isInfoEnabled())
-                        {
-                            log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] SKIPPING auxiliary [" + aux.getCacheName() + "] fromRemote ["
-                                + fromRemote + "]");
-                        }
-                        continue;
-                    }
-
                     if (log.isInfoEnabled())
                     {
-                        log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] auxiliary [" + aux.getCacheName() + "]");
-                    }
-
-                    // IT USED TO BE THE CASE THAT (If the auxiliary is not a lateral, or the cache
-                    // attributes
-                    // have 'getUseLateral' set, all the elements currently in
-                    // memory are written to the lateral before disposing)
-                    // I changed this. It was excessive. Only the disk cache needs the items, since only
-                    // the disk cache is in a situation to not get items on a put.
-                    if (aux.getCacheType() == CacheType.DISK_CACHE)
-                    {
-                        int numToFree = memCache.getSize();
-                        memCache.freeElements(numToFree);
-
-                        if (log.isInfoEnabled())
-                        {
-                            log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] put " + numToFree + " into auxiliary " + aux.getCacheName());
-                        }
+                        log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] SKIPPING auxiliary [" + aux.getCacheName() + "] fromRemote ["
+                            + fromRemote + "]");
                     }
+                    continue;
+                }
 
-                    // Dispose of the auxiliary
-                    aux.dispose();
+                if (log.isInfoEnabled())
+                {
+                    log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] auxiliary [" + aux.getCacheName() + "]");
                 }
-                catch (IOException ex)
+
+                // IT USED TO BE THE CASE THAT (If the auxiliary is not a lateral, or the cache
+                // attributes
+                // have 'getUseLateral' set, all the elements currently in
+                // memory are written to the lateral before disposing)
+                // I changed this. It was excessive. Only the disk cache needs the items, since only
+                // the disk cache is in a situation to not get items on a put.
+                if (aux.getCacheType() == CacheType.DISK_CACHE)
                 {
-                    log.error("Failure disposing of aux.", ex);
+                    int numToFree = memCache.getSize();
+                    memCache.freeElements(numToFree);
+
+                    if (log.isInfoEnabled())
+                    {
+                        log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] put " + numToFree + " into auxiliary " + aux.getCacheName());
+                    }
                 }
-            }
 
-            if (log.isInfoEnabled())
-            {
-                log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] disposing of memory cache.");
-            }
-            try
-            {
-                memCache.dispose();
+                // Dispose of the auxiliary
+                aux.dispose();
             }
             catch (IOException ex)
             {
-                log.error("Failure disposing of memCache", ex);
+                log.error("Failure disposing of aux.", ex);
             }
         }
+
+        if (log.isInfoEnabled())
+        {
+            log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] disposing of memory cache.");
+        }
+        try
+        {
+            memCache.dispose();
+        }
+        catch (IOException ex)
+        {
+            log.error("Failure disposing of memCache", ex);
+        }
     }
 
     /**
@@ -1404,31 +1388,29 @@ public class CompositeCache<K, V>
             return;
         }
 
-        synchronized (this)
+        for (ICache<K, V> aux : auxCaches)
         {
-            for (ICache<K, V> aux : auxCaches)
+            try
             {
-                try
+                if (aux.getStatus() == CacheStatus.ALIVE)
                 {
-                    if (aux.getStatus() == CacheStatus.ALIVE)
+                    for (K key : memCache.getKeySet())
                     {
-                        for (K key : memCache.getKeySet())
-                        {
-                            ICacheElement<K, V> ce = memCache.get(key);
+                        ICacheElement<K, V> ce = memCache.get(key);
 
-                            if (ce != null)
-                            {
-                                aux.update(ce);
-                            }
+                        if (ce != null)
+                        {
+                            aux.update(ce);
                         }
                     }
                 }
-                catch (IOException ex)
-                {
-                    log.error("Failure saving aux caches.", ex);
-                }
+            }
+            catch (IOException ex)
+            {
+                log.error("Failure saving aux caches.", ex);
             }
         }
+
         if (log.isDebugEnabled())
         {
             log.debug("Called save for [" + cacheAttr.getCacheName() + "]");
@@ -1493,8 +1475,8 @@ public class CompositeCache<K, V>
         // store the composite cache stats first
         ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
 
-        elems.add(new StatElement<Integer>("HitCountRam", Integer.valueOf(getHitCountRam())));
-        elems.add(new StatElement<Integer>("HitCountAux", Integer.valueOf(getHitCountAux())));
+        elems.add(new StatElement<Long>("HitCountRam", Long.valueOf(getHitCountRam())));
+        elems.add(new StatElement<Long>("HitCountAux", Long.valueOf(getHitCountAux())));
 
         stats.setStatElements(elems);
 
@@ -1755,7 +1737,7 @@ public class CompositeCache<K, V>
      * <p>
      * @return number of hits in memory
      */
-    public int getHitCountRam()
+    public long getHitCountRam()
     {
         return hitCountRam.get();
     }
@@ -1764,7 +1746,7 @@ public class CompositeCache<K, V>
      * Number of times a requested item was found in and auxiliary cache.
      * @return number of auxiliary hits.
      */
-    public int getHitCountAux()
+    public long getHitCountAux()
     {
         return hitCountAux.get();
     }
@@ -1773,7 +1755,7 @@ public class CompositeCache<K, V>
      * Number of times a requested element was not found.
      * @return number of misses.
      */
-    public int getMissCountNotFound()
+    public long getMissCountNotFound()
     {
         return missCountNotFound.get();
     }
@@ -1782,7 +1764,7 @@ public class CompositeCache<K, V>
      * Number of times a requested element was found but was expired.
      * @return number of found but expired gets.
      */
-    public int getMissCountExpired()
+    public long getMissCountExpired()
     {
         return missCountExpired.get();
     }
@@ -1790,7 +1772,7 @@ public class CompositeCache<K, V>
     /**
      * @return Returns the updateCount.
      */
-    public int getUpdateCount()
+    public long getUpdateCount()
     {
         return updateCount.get();
     }


[commons-jcs] 05/09: Make all statistic numbers long

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit bd42161440b98f8485b9dc3b2e79cc1685bb3412
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:41:18 2019 +0200

    Make all statistic numbers long
---
 .../apache/commons/jcs/admin/CacheRegionInfo.java    | 20 ++++++++++----------
 .../org/apache/commons/jcs/admin/JCSAdminBean.java   | 12 ++++++------
 .../org/apache/commons/jcs/admin/JCSJMXBean.java     |  4 ++--
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/CacheRegionInfo.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/CacheRegionInfo.java
index 963f5d4..520d38e 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/CacheRegionInfo.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/CacheRegionInfo.java
@@ -41,16 +41,16 @@ public class CacheRegionInfo
     private final String cacheStatistics;
 
     /** The number of memory hits in the cache region */
-    private final int hitCountRam;
+    private final long hitCountRam;
 
     /** The number of auxiliary hits in the cache region */
-    private final int hitCountAux;
+    private final long hitCountAux;
 
     /** The number of misses in the cache region because the items were not found */
-    private final int missCountNotFound;
+    private final long missCountNotFound;
 
     /** The number of misses in the cache region because the items were expired */
-    private final int missCountExpired;
+    private final long missCountExpired;
 
     /** The number of bytes counted so far, will be a total of all items */
     private final long byteCount;
@@ -71,8 +71,8 @@ public class CacheRegionInfo
     @ConstructorProperties({"cacheName", "cacheSize", "cacheStatus", "cacheStatistics",
     	"hitCountRam", "hitCountAux", "missCountNotFound", "missCountExpired", "byteCount"})
 	public CacheRegionInfo(String cacheName, int cacheSize, String cacheStatus,
-			String cacheStatistics, int hitCountRam, int hitCountAux,
-			int missCountNotFound, int missCountExpired, long byteCount)
+			String cacheStatistics, long hitCountRam, long hitCountAux,
+			long missCountNotFound, long missCountExpired, long byteCount)
 	{
 		super();
 		this.cacheName = cacheName;
@@ -123,7 +123,7 @@ public class CacheRegionInfo
     /**
 	 * @return the hitCountRam
 	 */
-	public int getHitCountRam()
+	public long getHitCountRam()
 	{
 		return hitCountRam;
 	}
@@ -131,7 +131,7 @@ public class CacheRegionInfo
 	/**
 	 * @return the hitCountAux
 	 */
-	public int getHitCountAux()
+	public long getHitCountAux()
 	{
 		return hitCountAux;
 	}
@@ -139,7 +139,7 @@ public class CacheRegionInfo
 	/**
 	 * @return the missCountNotFound
 	 */
-	public int getMissCountNotFound()
+	public long getMissCountNotFound()
 	{
 		return missCountNotFound;
 	}
@@ -147,7 +147,7 @@ public class CacheRegionInfo
 	/**
 	 * @return the missCountExpired
 	 */
-	public int getMissCountExpired()
+	public long getMissCountExpired()
 	{
 		return missCountExpired;
 	}
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java
index e2e8036..8e33621 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java
@@ -182,7 +182,7 @@ public class JCSAdminBean implements JCSJMXBean
      * @return int The size of the region in bytes.
      */
 	@Override
-    public int getByteCount(String cacheName)
+    public long getByteCount(String cacheName)
 	{
 		return getByteCount(cacheHub.getCache(cacheName));
 	}
@@ -194,7 +194,7 @@ public class JCSAdminBean implements JCSJMXBean
      *
      * @return int The size of the region in bytes.
      */
-    public <K, V> int getByteCount(CompositeCache<K, V> cache)
+    public <K, V> long getByteCount(CompositeCache<K, V> cache)
     {
         if (cache == null)
         {
@@ -223,7 +223,7 @@ public class JCSAdminBean implements JCSJMXBean
 
 			if (ice instanceof CacheElementSerialized)
             {
-                size = size + ((CacheElementSerialized<K, V>) ice).getSerializedValue().length;
+                size += ((CacheElementSerialized<K, V>) ice).getSerializedValue().length;
             }
             else
             {
@@ -256,12 +256,12 @@ public class JCSAdminBean implements JCSJMXBean
             }
         }
 
-        if (size > Integer.MAX_VALUE)
+        if (size > Long.MAX_VALUE)
         {
-            throw new IllegalStateException("The size of cache " + cache.getCacheName() + " (" + size + " bytes) is too large to be represented as an integer.");
+            throw new IllegalStateException("The size of cache " + cache.getCacheName() + " (" + size + " bytes) is too large to be represented as an long integer.");
         }
 
-        return (int) size;
+        return size;
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSJMXBean.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSJMXBean.java
index 4ad4b7e..1cf02d0 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSJMXBean.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSJMXBean.java
@@ -52,9 +52,9 @@ public interface JCSJMXBean
      * the region or an error occurs, suppresses exceptions and returns 0.
      * <p>
      *
-     * @return int The size of the region in bytes.
+     * @return long The size of the region in bytes.
      */
-    int getByteCount(String cacheName);
+    long getByteCount(String cacheName);
 
     /**
      * Clears all regions in the cache.


[commons-jcs] 09/09: Use Java7 diamond operator

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit d8b77d11ee4171d73ab8ecd42ee7ee2fb1e8def9
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:48:25 2019 +0200

    Use Java7 diamond operator
---
 .../src/main/java/org/apache/commons/jcs/JCS.java  |   12 +-
 .../org/apache/commons/jcs/access/CacheAccess.java |    4 +-
 .../commons/jcs/access/GroupCacheAccess.java       |    4 +-
 .../commons/jcs/access/PartitionedCacheAccess.java |    8 +-
 .../org/apache/commons/jcs/admin/JCSAdminBean.java |    4 +-
 .../jcs/auxiliary/AbstractAuxiliaryCache.java      |    8 +-
 .../jcs/auxiliary/disk/AbstractDiskCache.java      |   16 +-
 .../jcs/auxiliary/disk/block/BlockDisk.java        |    2 +-
 .../jcs/auxiliary/disk/block/BlockDiskCache.java   |   22 +-
 .../disk/block/BlockDiskCacheFactory.java          |    2 +-
 .../auxiliary/disk/block/BlockDiskKeyStore.java    |   10 +-
 .../auxiliary/disk/indexed/IndexedDiskCache.java   |   36 +-
 .../disk/indexed/IndexedDiskCacheFactory.java      |    2 +-
 .../auxiliary/disk/indexed/IndexedDiskDumper.java  |    2 +-
 .../jcs/auxiliary/disk/jdbc/JDBCDiskCache.java     |   10 +-
 .../auxiliary/disk/jdbc/JDBCDiskCacheFactory.java  |    8 +-
 .../jcs/auxiliary/disk/jdbc/ShrinkerThread.java    |    2 +-
 .../disk/jdbc/dsfactory/JndiDataSourceFactory.java |    2 +-
 .../disk/jdbc/hsql/HSQLDiskCacheFactory.java       |    2 +-
 .../disk/jdbc/mysql/MySQLDiskCacheFactory.java     |    2 +-
 .../jcs/auxiliary/lateral/LateralCache.java        |    2 +-
 .../jcs/auxiliary/lateral/LateralCacheMonitor.java |    2 +-
 .../jcs/auxiliary/lateral/LateralCacheNoWait.java  |   20 +-
 .../lateral/LateralCacheNoWaitFacade.java          |   10 +-
 .../lateral/socket/tcp/LateralTCPCacheFactory.java |   16 +-
 .../socket/tcp/LateralTCPDiscoveryListener.java    |    4 +-
 .../lateral/socket/tcp/LateralTCPListener.java     |    4 +-
 .../lateral/socket/tcp/LateralTCPService.java      |   32 +-
 .../remote/AbstractRemoteAuxiliaryCache.java       |   12 +-
 .../remote/AbstractRemoteCacheNoWaitFacade.java    |    8 +-
 .../commons/jcs/auxiliary/remote/RemoteCache.java  |    8 +-
 .../jcs/auxiliary/remote/RemoteCacheFactory.java   |    8 +-
 .../jcs/auxiliary/remote/RemoteCacheManager.java   |   10 +-
 .../jcs/auxiliary/remote/RemoteCacheMonitor.java   |    2 +-
 .../jcs/auxiliary/remote/RemoteCacheNoWait.java    |   20 +-
 .../auxiliary/remote/RemoteCacheNoWaitFacade.java  |    2 +-
 .../remote/http/client/RemoteHttpCache.java        |    2 +-
 .../remote/http/client/RemoteHttpCacheFactory.java |    8 +-
 .../remote/http/client/RemoteHttpCacheMonitor.java |    2 +-
 .../http/server/AbstractRemoteCacheService.java    |    4 +-
 .../remote/http/server/RemoteHttpCacheServlet.java |    8 +-
 .../auxiliary/remote/server/RemoteCacheServer.java |   20 +-
 .../remote/server/RemoteCacheServerFactory.java    |    4 +-
 .../remote/util/RemoteCacheRequestFactory.java     |    2 +-
 .../commons/jcs/engine/CacheEventQueueFactory.java |    4 +-
 .../apache/commons/jcs/engine/CacheListeners.java  |    2 +-
 .../commons/jcs/engine/CacheWatchRepairable.java   |    4 +-
 .../commons/jcs/engine/ElementAttributes.java      |    2 +-
 .../commons/jcs/engine/PooledCacheEventQueue.java  |   10 +-
 .../jcs/engine/ZombieCacheServiceNonLocal.java     |   10 +-
 .../commons/jcs/engine/control/CompositeCache.java |   34 +-
 .../engine/control/CompositeCacheConfigurator.java |    8 +-
 .../jcs/engine/control/CompositeCacheManager.java  |   12 +-
 .../logging/CacheEventLoggerDebugLogger.java       |    2 +-
 .../AbstractDoubleLinkedListMemoryCache.java       |   10 +-
 .../jcs/engine/memory/AbstractMemoryCache.java     |   14 +-
 .../jcs/engine/memory/lru/LHMLRUMemoryCache.java   |    2 +-
 .../memory/soft/SoftReferenceMemoryCache.java      |   12 +-
 .../util/SoftReferenceElementDescriptor.java       |    2 +-
 .../apache/commons/jcs/utils/access/JCSWorker.java |    2 +-
 .../jcs/utils/discovery/UDPCleanupRunner.java      |    2 +-
 .../jcs/utils/discovery/UDPDiscoveryManager.java   |    2 +-
 .../jcs/utils/discovery/UDPDiscoveryMessage.java   |    2 +-
 .../utils/discovery/UDPDiscoverySenderThread.java  |    2 +-
 .../jcs/utils/discovery/UDPDiscoveryService.java   |   10 +-
 .../serialization/SerializationConversionUtil.java |    4 +-
 .../commons/jcs/utils/struct/AbstractLRUMap.java   |   18 +-
 .../jcs/utils/threadpool/ThreadPoolManager.java    |   10 +-
 .../jcs/JCSConcurrentCacheAccessUnitTest.java      |    4 +-
 .../java/org/apache/commons/jcs/JCSThrashTest.java |    2 +-
 .../java/org/apache/commons/jcs/JCSUnitTest.java   |    4 +-
 .../commons/jcs/JCSvsHashtablePerformanceTest.java |    2 +-
 .../commons/jcs/access/CacheAccessUnitTest.java    |    2 +-
 .../commons/jcs/auxiliary/MockAuxiliaryCache.java  |    4 +-
 .../jcs/auxiliary/MockAuxiliaryCacheFactory.java   |    2 +-
 .../jcs/auxiliary/MockCacheEventLogger.java        |    4 +-
 .../auxiliary/disk/AbstractDiskCacheUnitTest.java  |   20 +-
 .../auxiliary/disk/PurgatoryElementUnitTest.java   |   12 +-
 .../block/BlockDiskCacheConcurrentUnitTest.java    |    4 +-
 .../disk/block/BlockDiskCacheKeyStoreUnitTest.java |    8 +-
 ...BlockDiskCacheSameRegionConcurrentUnitTest.java |    2 +-
 .../disk/block/BlockDiskCacheUnitTestAbstract.java | 1144 +++++------
 .../block/BlockDiskElementDescriptorUnitTest.java  |    2 +-
 .../auxiliary/disk/indexed/DiskTestObjectUtil.java |    4 +-
 .../disk/indexed/IndexDiskCacheCountUnitTest.java  |  218 +--
 .../disk/indexed/IndexDiskCacheSizeUnitTest.java   |  220 +--
 .../indexed/IndexDiskCacheUnitTestAbstract.java    | 1978 ++++++++++----------
 .../IndexedDiskCacheConcurrentUnitTest.java        |    4 +-
 .../indexed/IndexedDiskCacheKeyStoreUnitTest.java  |   10 +-
 .../indexed/IndexedDiskCacheNoMemoryUnitTest.java  |    2 +-
 .../IndexedDiskCacheOptimizationUnitTest.java      |    2 +-
 ...dexedDiskCacheSameRegionConcurrentUnitTest.java |    2 +-
 .../auxiliary/disk/indexed/LRUMapSizeVsCount.java  |    2 +-
 .../disk/jdbc/JDBCDataSourceFactoryUnitTest.java   |    2 +-
 .../disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java |    2 +-
 .../auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java |    2 +-
 .../jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java |    2 +-
 .../disk/jdbc/hsql/HSQLDiskCacheUnitTest.java      |    2 +-
 .../mysql/MySQLDiskCacheHsqlBackedUnitTest.java    |    2 +-
 .../disk/jdbc/mysql/MySQLDiskCacheUnitTest.java    |    2 +-
 .../lateral/LateralCacheNoWaitFacadeUnitTest.java  |   26 +-
 .../tcp/LateralTCPConcurrentRandomTestUtil.java    |    4 +-
 .../tcp/LateralTCPDiscoveryListenerUnitTest.java   |   36 +-
 .../LateralTCPFilterRemoveHashCodeUnitTest.java    |    6 +-
 .../tcp/LateralTCPIssueRemoveOnPutUnitTest.java    |   10 +-
 .../lateral/socket/tcp/TestTCPLateralUnitTest.java |   34 +-
 .../auxiliary/remote/MockRemoteCacheClient.java    |   10 +-
 .../auxiliary/remote/MockRemoteCacheListener.java  |    4 +-
 .../auxiliary/remote/MockRemoteCacheService.java   |   10 +-
 .../auxiliary/remote/RemoteCacheClientTester.java  |    4 +-
 .../remote/RemoteCacheListenerUnitTest.java        |    8 +-
 .../remote/RemoteCacheNoWaitFacadeUnitTest.java    |  112 +-
 .../remote/RemoteCacheNoWaitUnitTest.java          |   42 +-
 .../jcs/auxiliary/remote/RemoteCacheUnitTest.java  |   34 +-
 .../jcs/auxiliary/remote/TestRemoteCache.java      |    2 +-
 .../remote/ZombieRemoteCacheServiceUnitTest.java   |   20 +-
 .../http/client/RemoteHttpCacheClientUnitTest.java |   34 +-
 .../server/RemoteHttpCacheServiceUnitTest.java     |   16 +-
 .../server/RemoteHttpCacheServletUnitTest.java     |    4 +-
 .../BasicRemoteCacheClientServerUnitTest.java      |   12 +-
 .../remote/server/RemoteCacheServerUnitTest.java   |   46 +-
 .../util/RemoteCacheRequestFactoryUnitTest.java    |    2 +-
 .../jcs/engine/CacheEventQueueFactoryUnitTest.java |    8 +-
 .../jcs/engine/EventQueueConcurrentLoadTest.java   |   10 +-
 .../jcs/engine/MockCacheServiceNonLocal.java       |   10 +-
 .../engine/ZombieCacheServiceNonLocalUnitTest.java |   20 +-
 .../control/CompositeCacheDiskUsageUnitTest.java   |   40 +-
 .../jcs/engine/control/CompositeCacheUnitTest.java |   28 +-
 .../engine/control/MockCompositeCacheManager.java  |    2 +-
 .../jcs/engine/logging/MockCacheEventLogger.java   |    2 +-
 .../match/KeyMatcherPatternImpllUnitTest.java      |   12 +-
 .../commons/jcs/engine/memory/MockMemoryCache.java |    6 +-
 .../memory/fifo/FIFOMemoryCacheUnitTest.java       |   14 +-
 .../lru/LHMLRUMemoryCacheConcurrentUnitTest.java   |    6 +-
 .../memory/lru/LHMLRUMemoryCacheUnitTest.java      |    6 +-
 .../lru/LRUMemoryCacheConcurrentUnitTest.java      |    6 +-
 .../engine/memory/mru/MRUMemoryCacheUnitTest.java  |    6 +-
 .../memory/shrinking/ShrinkerThreadUnitTest.java   |   34 +-
 .../soft/SoftReferenceMemoryCacheUnitTest.java     |    6 +-
 .../jcs/utils/access/JCSWorkerUnitTest.java        |    2 +-
 .../jcs/utils/discovery/MockDiscoveryListener.java |    2 +-
 .../discovery/UDPDiscoverySenderUnitTest.java      |    4 +-
 .../discovery/UDPDiscoveryServiceUnitTest.java     |   10 +-
 .../jcs/utils/discovery/UDPDiscoveryUnitTest.java  |    2 +-
 .../SerializationConversionUtilUnitTest.java       |    6 +-
 .../jcs/utils/struct/DoubleLinkedListUnitTest.java |   40 +-
 .../struct/JCSvsCommonsLRUMapPerformanceTest.java  |    2 +-
 .../jcs/utils/struct/LRUMapConcurrentUnitTest.java |   10 +-
 .../jcs/utils/struct/LRUMapPerformanceTest.java    |    2 +-
 .../commons/jcs/utils/struct/LRUMapUnitTest.java   |   10 +-
 150 files changed, 2501 insertions(+), 2501 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java
index 282988b..8a006a2 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java
@@ -129,7 +129,7 @@ public abstract class JCS
         throws CacheException
     {
         CompositeCache<K, V> cache = getCacheManager().getCache( region );
-        return new CacheAccess<K, V>( cache );
+        return new CacheAccess<>( cache );
     }
 
     /**
@@ -144,7 +144,7 @@ public abstract class JCS
         throws CacheException
     {
         CompositeCache<K, V> cache = getCacheManager().getCache( region, icca );
-        return new CacheAccess<K, V>( cache );
+        return new CacheAccess<>( cache );
     }
 
     /**
@@ -160,7 +160,7 @@ public abstract class JCS
         throws CacheException
     {
         CompositeCache<K, V> cache = getCacheManager().getCache( region, icca, eattr );
-        return new CacheAccess<K, V>( cache );
+        return new CacheAccess<>( cache );
     }
 
     /**
@@ -174,7 +174,7 @@ public abstract class JCS
         throws CacheException
     {
         CompositeCache<GroupAttrName<K>, V> cache = getCacheManager().getCache( region );
-        return new GroupCacheAccess<K, V>( cache );
+        return new GroupCacheAccess<>( cache );
     }
 
     /**
@@ -189,7 +189,7 @@ public abstract class JCS
         throws CacheException
     {
         CompositeCache<GroupAttrName<K>, V> cache = getCacheManager().getCache( region, icca );
-        return new GroupCacheAccess<K, V>( cache );
+        return new GroupCacheAccess<>( cache );
     }
 
     /**
@@ -205,6 +205,6 @@ public abstract class JCS
         throws CacheException
     {
         CompositeCache<GroupAttrName<K>, V> cache = getCacheManager().getCache( region, icca, eattr );
-        return new GroupCacheAccess<K, V>( cache );
+        return new GroupCacheAccess<>( cache );
     }
 }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/CacheAccess.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/CacheAccess.java
index 71095eb..9ca959a 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/CacheAccess.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/CacheAccess.java
@@ -118,7 +118,7 @@ public class CacheAccess<K, V>
 
         if ( wrappedResults == null )
         {
-            unwrappedResults = new HashMap<K, V>();
+            unwrappedResults = new HashMap<>();
         }
         else
         {
@@ -260,7 +260,7 @@ public class CacheAccess<K, V>
         // should be wrapped by cache access.
         try
         {
-            CacheElement<K, V> ce = new CacheElement<K, V>( this.getCacheControl().getCacheName(), key,
+            CacheElement<K, V> ce = new CacheElement<>( this.getCacheControl().getCacheName(), key,
                                                 val );
 
             ce.setElementAttributes( attr );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/GroupCacheAccess.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/GroupCacheAccess.java
index 83c846c..88d4a28 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/GroupCacheAccess.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/GroupCacheAccess.java
@@ -76,7 +76,7 @@ public class GroupCacheAccess<K, V>
     private GroupAttrName<K> getGroupAttrName( String group, K name )
     {
         GroupId gid = new GroupId( this.getCacheControl().getCacheName(), group );
-        return new GroupAttrName<K>( gid, name );
+        return new GroupAttrName<>( gid, name );
     }
 
     /**
@@ -134,7 +134,7 @@ public class GroupCacheAccess<K, V>
         {
             GroupAttrName<K> key = getGroupAttrName( groupName, name );
             CacheElement<GroupAttrName<K>, V> ce =
-                new CacheElement<GroupAttrName<K>, V>( this.getCacheControl().getCacheName(), key, value );
+                new CacheElement<>( this.getCacheControl().getCacheName(), key, value );
 
             IElementAttributes attributes = (attr == null) ? this.getCacheControl().getElementAttributes() : attr;
             ce.setElementAttributes( attributes );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/PartitionedCacheAccess.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/PartitionedCacheAccess.java
index a12e039..c516a54 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/PartitionedCacheAccess.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/PartitionedCacheAccess.java
@@ -281,12 +281,12 @@ public class PartitionedCacheAccess<K, V>
             int partition = getPartitionNumberForKey( key );
             if ( dividedNames[partition] == null )
             {
-                dividedNames[partition] = new HashSet<K>();
+                dividedNames[partition] = new HashSet<>();
             }
             dividedNames[partition].add( key );
         }
 
-        Map<K, ICacheElement<K, V>> result = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> result = new HashMap<>();
         for ( int i = 0; i < partitions.length; i++ )
         {
             if ( dividedNames[i] != null && !dividedNames[i].isEmpty() )
@@ -320,7 +320,7 @@ public class PartitionedCacheAccess<K, V>
             return null;
         }
 
-        Map<K, V> result = new HashMap<K, V>();
+        Map<K, V> result = new HashMap<>();
         for (ICacheAccess<K, V> partition : partitions)
         {
             result.putAll( partition.getMatching( pattern ) );
@@ -349,7 +349,7 @@ public class PartitionedCacheAccess<K, V>
             return null;
         }
 
-        Map<K, ICacheElement<K, V>> result = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> result = new HashMap<>();
         for (ICacheAccess<K, V> partition : partitions)
         {
             result.putAll( partition.getMatchingCacheElements( pattern ) );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java
index 8e33621..10fddd9 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdminBean.java
@@ -102,7 +102,7 @@ public class JCSAdminBean implements JCSJMXBean
             keys = cache.getMemoryCache().getKeySet().toArray(new Serializable[0]);
         }
 
-        LinkedList<CacheElementInfo> records = new LinkedList<CacheElementInfo>();
+        LinkedList<CacheElementInfo> records = new LinkedList<>();
 
         ICacheElement<Serializable, Serializable> element;
         IElementAttributes attributes;
@@ -147,7 +147,7 @@ public class JCSAdminBean implements JCSJMXBean
 
         Arrays.sort( cacheNames );
 
-        LinkedList<CacheRegionInfo> cacheInfo = new LinkedList<CacheRegionInfo>();
+        LinkedList<CacheRegionInfo> cacheInfo = new LinkedList<>();
 
         CacheRegionInfo regionInfo;
         CompositeCache<?, ?> cache;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCache.java
index 2371b39..b0ee573 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCache.java
@@ -45,7 +45,7 @@ public abstract class AbstractAuxiliaryCache<K, V>
     private IElementSerializer elementSerializer = new StandardSerializer();
 
     /** Key matcher used by the getMatching API */
-    private IKeyMatcher<K> keyMatcher = new KeyMatcherPatternImpl<K>();
+    private IKeyMatcher<K> keyMatcher = new KeyMatcherPatternImpl<>();
 
     /**
      * Gets multiple items from the cache based on the given set of keys.
@@ -75,7 +75,7 @@ public abstract class AbstractAuxiliaryCache<K, V>
                         element -> element));
         }
 
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -99,7 +99,7 @@ public abstract class AbstractAuxiliaryCache<K, V>
     {
         if ( cacheEventLogger == null )
         {
-            return new CacheEvent<K>();
+            return new CacheEvent<>();
         }
         String diskLocation = getEventLoggingExtraInfo();
         String regionName = null;
@@ -125,7 +125,7 @@ public abstract class AbstractAuxiliaryCache<K, V>
     {
         if ( cacheEventLogger == null )
         {
-            return new CacheEvent<T>();
+            return new CacheEvent<>();
         }
         String diskLocation = getEventLoggingExtraInfo();
         return cacheEventLogger.createICacheEvent( getAuxiliaryCacheAttributes().getName(), regionName, eventName,
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java
index a536876..1ceb231 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java
@@ -114,7 +114,7 @@ public abstract class AbstractDiskCache<K, V>
         this.cacheName = attr.getCacheName();
 
         // create queue
-        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<K, V>();
+        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<>();
         this.cacheEventQueue = fact.createCacheEventQueue( new MyCacheListener(), CacheInfo.listenerId, cacheName,
                                                            diskCacheAttributes.getEventQueuePoolName(),
                                                            diskCacheAttributes.getEventQueueType() );
@@ -159,11 +159,11 @@ public abstract class AbstractDiskCache<K, V>
             {
                 if ( diskCacheAttributes.getMaxPurgatorySize() >= 0 )
                 {
-                    purgatory = new LRUMap<K, PurgatoryElement<K, V>>( diskCacheAttributes.getMaxPurgatorySize() );
+                    purgatory = new LRUMap<>( diskCacheAttributes.getMaxPurgatorySize() );
                 }
                 else
                 {
-                    purgatory = new HashMap<K, PurgatoryElement<K, V>>();
+                    purgatory = new HashMap<>();
                 }
             }
         }
@@ -198,7 +198,7 @@ public abstract class AbstractDiskCache<K, V>
         try
         {
             // Wrap the CacheElement in a PurgatoryElement
-            PurgatoryElement<K, V> pe = new PurgatoryElement<K, V>( cacheElement );
+            PurgatoryElement<K, V> pe = new PurgatoryElement<>( cacheElement );
 
             // Indicates the the element is eligible to be spooled to disk,
             // this will remain true unless the item is pulled back into
@@ -324,7 +324,7 @@ public abstract class AbstractDiskCache<K, V>
         // this avoids locking purgatory, but it uses more memory
         synchronized ( purgatory )
         {
-            keyArray = new HashSet<K>(purgatory.keySet());
+            keyArray = new HashSet<>(purgatory.keySet());
         }
 
         Set<K> matchingKeys = getKeyMatcher().getMatchingKeysFromArray( pattern, keyArray );
@@ -512,10 +512,10 @@ public abstract class AbstractDiskCache<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Abstract Disk Cache" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        elems.add(new StatElement<Integer>( "Purgatory Hits", Integer.valueOf(purgHits) ) );
-        elems.add(new StatElement<Integer>( "Purgatory Size", Integer.valueOf(purgatory.size()) ) );
+        elems.add(new StatElement<>( "Purgatory Hits", Integer.valueOf(purgHits) ) );
+        elems.add(new StatElement<>( "Purgatory Size", Integer.valueOf(purgatory.size()) ) );
 
         // get the stats from the event queue too
         IStats eqStats = this.cacheEventQueue.getStatistics();
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
index 8d3e046..aaf3bea 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
@@ -63,7 +63,7 @@ public class BlockDisk
     private final AtomicInteger numberOfBlocks = new AtomicInteger(0);
 
     /** Empty blocks that can be reused. */
-    private final ConcurrentLinkedQueue<Integer> emptyBlocks = new ConcurrentLinkedQueue<Integer>();
+    private final ConcurrentLinkedQueue<Integer> emptyBlocks = new ConcurrentLinkedQueue<>();
 
     /** The serializer. */
     private final IElementSerializer elementSerializer;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
index 06f89ba..7e66e8d 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
@@ -138,7 +138,7 @@ public class BlockDiskCache<K, V>
                                                getElementSerializer() );
             }
 
-            keyStore = new BlockDiskKeyStore<K>( this.blockDiskCacheAttributes, this );
+            keyStore = new BlockDiskKeyStore<>( this.blockDiskCacheAttributes, this );
 
             boolean alright = verifyDisk();
 
@@ -234,7 +234,7 @@ public class BlockDiskCache<K, V>
     @Override
     public Set<K> getKeySet() throws IOException
     {
-        HashSet<K> keys = new HashSet<K>();
+        HashSet<K> keys = new HashSet<>();
 
         storageLock.readLock().lock();
 
@@ -264,7 +264,7 @@ public class BlockDiskCache<K, V>
         storageLock.readLock().lock();
         try
         {
-            keyArray = new HashSet<K>(keyStore.keySet());
+            keyArray = new HashSet<>(keyStore.keySet());
         }
         finally
         {
@@ -695,29 +695,29 @@ public class BlockDiskCache<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Block Disk Cache" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        elems.add(new StatElement<Boolean>( "Is Alive", Boolean.valueOf(isAlive()) ) );
-        elems.add(new StatElement<Integer>( "Key Map Size", Integer.valueOf(this.keyStore.size()) ) );
+        elems.add(new StatElement<>( "Is Alive", Boolean.valueOf(isAlive()) ) );
+        elems.add(new StatElement<>( "Key Map Size", Integer.valueOf(this.keyStore.size()) ) );
 
         if (this.dataFile != null)
         {
             try
             {
-                elems.add(new StatElement<Long>( "Data File Length", Long.valueOf(this.dataFile.length()) ) );
+                elems.add(new StatElement<>( "Data File Length", Long.valueOf(this.dataFile.length()) ) );
             }
             catch ( IOException e )
             {
                 log.error( e );
             }
 
-            elems.add(new StatElement<Integer>( "Block Size Bytes",
+            elems.add(new StatElement<>( "Block Size Bytes",
                     Integer.valueOf(this.dataFile.getBlockSizeBytes()) ) );
-            elems.add(new StatElement<Integer>( "Number Of Blocks",
+            elems.add(new StatElement<>( "Number Of Blocks",
                     Integer.valueOf(this.dataFile.getNumberOfBlocks()) ) );
-            elems.add(new StatElement<Long>( "Average Put Size Bytes",
+            elems.add(new StatElement<>( "Average Put Size Bytes",
                     Long.valueOf(this.dataFile.getAveragePutSizeBytes()) ) );
-            elems.add(new StatElement<Integer>( "Empty Blocks",
+            elems.add(new StatElement<>( "Empty Blocks",
                     Integer.valueOf(this.dataFile.getEmptyBlocks()) ) );
         }
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java
index 0b35d2b..c54c573 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java
@@ -57,7 +57,7 @@ public class BlockDiskCacheFactory
             log.debug( "Creating DiskCache for attributes = " + idca );
         }
 
-        BlockDiskCache<K, V> cache = new BlockDiskCache<K, V>( idca, elementSerializer );
+        BlockDiskCache<K, V> cache = new BlockDiskCache<>( idca, elementSerializer );
         cache.setCacheEventLogger( cacheEventLogger );
 
         return cache;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskKeyStore.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
index 4a9568e..bf4909a 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
@@ -161,7 +161,7 @@ public class BlockDiskKeyStore<K>
                     // collection makes a copy
                     for (Map.Entry<K, int[]> entry : keyHash.entrySet())
                     {
-                        BlockDiskElementDescriptor<K> descriptor = new BlockDiskElementDescriptor<K>();
+                        BlockDiskElementDescriptor<K> descriptor = new BlockDiskElementDescriptor<>();
                         descriptor.setKey(entry.getKey());
                         descriptor.setBlocks(entry.getValue());
                         // stream these out in the loop.
@@ -228,7 +228,7 @@ public class BlockDiskKeyStore<K>
         {
             // If no max size, use a plain map for memory and processing
             // efficiency.
-            keyHash = new HashMap<K, int[]>();
+            keyHash = new HashMap<>();
             // keyHash = Collections.synchronizedMap( new HashMap() );
             if (log.isInfoEnabled())
             {
@@ -253,7 +253,7 @@ public class BlockDiskKeyStore<K>
             // create a key map to use.
             initKeyMap();
 
-            HashMap<K, int[]> keys = new HashMap<K, int[]>();
+            HashMap<K, int[]> keys = new HashMap<>();
 
             synchronized (keyFile)
             {
@@ -377,7 +377,7 @@ public class BlockDiskKeyStore<K>
      */
     private boolean verify()
     {
-        Map<Integer, Set<K>> blockAllocationMap = new TreeMap<Integer, Set<K>>();
+        Map<Integer, Set<K>> blockAllocationMap = new TreeMap<>();
         for (Entry<K, int[]> e : keyHash.entrySet())
         {
             for (int block : e.getValue())
@@ -385,7 +385,7 @@ public class BlockDiskKeyStore<K>
                 Set<K> keys = blockAllocationMap.get(block);
                 if (keys == null)
                 {
-                    keys = new HashSet<K>();
+                    keys = new HashSet<>();
                     blockAllocationMap.put(block, keys);
                 }
                 else if (!log.isDebugEnabled())
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
index c288784..9f2e3c8 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
@@ -464,7 +464,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
 
             keyFile.reset();
 
-            HashMap<K, IndexedDiskElementDescriptor> keys = new HashMap<K, IndexedDiskElementDescriptor>();
+            HashMap<K, IndexedDiskElementDescriptor> keys = new HashMap<>();
             keys.putAll(keyHash);
 
             if (keys.size() > 0)
@@ -650,12 +650,12 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
     @Override
     public Map<K, ICacheElement<K, V>> processGetMatching(String pattern)
     {
-        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<>();
         Set<K> keyArray = null;
         storageLock.readLock().lock();
         try
         {
-            keyArray = new HashSet<K>(keyHash.keySet());
+            keyArray = new HashSet<>(keyHash.keySet());
         }
         finally
         {
@@ -725,7 +725,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
     @Override
     public Set<K> getKeySet() throws IOException
     {
-        HashSet<K> keys = new HashSet<K>();
+        HashSet<K> keys = new HashSet<>();
 
         storageLock.readLock().lock();
 
@@ -817,7 +817,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
         boolean removed = false;
 
         // remove all keys of the same name hierarchy.
-        List<K> itemsToRemove = new LinkedList<K>();
+        List<K> itemsToRemove = new LinkedList<>();
 
         for (K k : keyHash.keySet())
         {
@@ -855,7 +855,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
         boolean removed = false;
 
         // remove all keys of the same name group.
-        List<K> itemsToRemove = new LinkedList<K>();
+        List<K> itemsToRemove = new LinkedList<>();
 
         // remove all keys of the same name hierarchy.
         for (K k : keyHash.keySet())
@@ -1512,27 +1512,27 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
         IStats stats = new Stats();
         stats.setTypeName("Indexed Disk Cache");
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        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)));
+        elems.add(new StatElement<>("Is Alive", Boolean.valueOf(isAlive())));
+        elems.add(new StatElement<>("Key Map Size", Integer.valueOf(this.keyHash != null ? this.keyHash.size() : -1)));
         try
         {
             elems
-                .add(new StatElement<Long>("Data File Length", Long.valueOf(this.dataFile != null ? this.dataFile.length() : -1L)));
+                .add(new StatElement<>("Data File Length", Long.valueOf(this.dataFile != null ? this.dataFile.length() : -1L)));
         }
         catch (IOException e)
         {
             log.error(e);
         }
-        elems.add(new StatElement<Integer>("Max Key Size", this.maxKeySize));
-        elems.add(new StatElement<AtomicInteger>("Hit Count", this.hitCount));
-        elems.add(new StatElement<AtomicLong>("Bytes Free", this.bytesFree));
-        elems.add(new StatElement<Integer>("Optimize Operation Count", Integer.valueOf(this.removeCount)));
-        elems.add(new StatElement<Integer>("Times Optimized", Integer.valueOf(this.timesOptimized)));
-        elems.add(new StatElement<Integer>("Recycle Count", Integer.valueOf(this.recycleCnt)));
-        elems.add(new StatElement<Integer>("Recycle Bin Size", Integer.valueOf(this.recycle.size())));
-        elems.add(new StatElement<Integer>("Startup Size", Integer.valueOf(this.startupSize)));
+        elems.add(new StatElement<>("Max Key Size", this.maxKeySize));
+        elems.add(new StatElement<>("Hit Count", this.hitCount));
+        elems.add(new StatElement<>("Bytes Free", this.bytesFree));
+        elems.add(new StatElement<>("Optimize Operation Count", Integer.valueOf(this.removeCount)));
+        elems.add(new StatElement<>("Times Optimized", Integer.valueOf(this.timesOptimized)));
+        elems.add(new StatElement<>("Recycle Count", Integer.valueOf(this.recycleCnt)));
+        elems.add(new StatElement<>("Recycle Bin Size", Integer.valueOf(this.recycle.size())));
+        elems.add(new StatElement<>("Startup Size", Integer.valueOf(this.startupSize)));
 
         // get the stats from the super too
         IStats sStats = super.getStatistics();
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java
index 03f2f10..e34bd51 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java
@@ -57,7 +57,7 @@ public class IndexedDiskCacheFactory
             log.debug( "Creating DiskCache for attributes = " + idca );
         }
 
-        IndexedDiskCache<K, V> cache = new IndexedDiskCache<K, V>( idca, elementSerializer );
+        IndexedDiskCache<K, V> cache = new IndexedDiskCache<>( idca, elementSerializer );
         cache.setCacheEventLogger( cacheEventLogger );
 
         return cache;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskDumper.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskDumper.java
index 94d9cfe..a6ab077 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskDumper.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskDumper.java
@@ -50,7 +50,7 @@ public class IndexedDiskDumper
         attr.setCacheName( args[0] );
         attr.setDiskPath( args[0] );
 
-        IndexedDiskCache<Serializable, Serializable> dc = new IndexedDiskCache<Serializable, Serializable>( attr );
+        IndexedDiskCache<Serializable, Serializable> dc = new IndexedDiskCache<>( attr );
         dc.dump( true );
         System.exit( 0 );
     }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
index 0177f09..30ffaee 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
@@ -465,7 +465,7 @@ public class JDBCDiskCache<K, V>
             return null;
         }
 
-        Map<K, ICacheElement<K, V>> results = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> results = new HashMap<>();
 
         try
         {
@@ -830,10 +830,10 @@ public class JDBCDiskCache<K, V>
 
         List<IStatElement<?>> elems = stats.getStatElements();
 
-        elems.add(new StatElement<AtomicInteger>( "Update Count", updateCount ) );
-        elems.add(new StatElement<AtomicInteger>( "Get Count", getCount ) );
-        elems.add(new StatElement<AtomicInteger>( "Get Matching Count", getMatchingCount ) );
-        elems.add(new StatElement<String>( "DB URL", getJdbcDiskCacheAttributes().getUrl()) );
+        elems.add(new StatElement<>( "Update Count", updateCount ) );
+        elems.add(new StatElement<>( "Get Count", getCount ) );
+        elems.add(new StatElement<>( "Get Matching Count", getMatchingCount ) );
+        elems.add(new StatElement<>( "DB URL", getJdbcDiskCacheAttributes().getUrl()) );
 
         stats.setStatElements( elems );
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
index 026a172..0ba22ea 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
@@ -95,7 +95,7 @@ public class JDBCDiskCacheFactory
         TableState tableState = getTableState( cattr.getTableName() );
         DataSourceFactory dsFactory = getDataSourceFactory(cattr, compositeCacheManager.getConfigurationProperties());
 
-        JDBCDiskCache<K, V> cache = new JDBCDiskCache<K, V>( cattr, dsFactory, tableState, compositeCacheManager );
+        JDBCDiskCache<K, V> cache = new JDBCDiskCache<>( cattr, dsFactory, tableState, compositeCacheManager );
         cache.setCacheEventLogger( cacheEventLogger );
         cache.setElementSerializer( elementSerializer );
 
@@ -112,9 +112,9 @@ public class JDBCDiskCacheFactory
     public void initialize()
     {
         super.initialize();
-        this.tableStates = new ConcurrentHashMap<String, TableState>();
-        this.shrinkerThreadMap = new ConcurrentHashMap<String, ShrinkerThread>();
-        this.dsFactories = new ConcurrentHashMap<String, DataSourceFactory>();
+        this.tableStates = new ConcurrentHashMap<>();
+        this.shrinkerThreadMap = new ConcurrentHashMap<>();
+        this.dsFactories = new ConcurrentHashMap<>();
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/ShrinkerThread.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
index adcdb0e..752845b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
@@ -40,7 +40,7 @@ public class ShrinkerThread
 
     /** A set of JDBCDiskCache objects to call deleteExpired on. */
     private final Set<JDBCDiskCache<?, ?>> shrinkSet =
-        Collections.synchronizedSet( new HashSet<JDBCDiskCache<?, ?>>() );
+        Collections.synchronizedSet( new HashSet<>() );
 
     /** Default time period to use. */
     private static final long DEFAULT_PAUSE_BETWEEN_REGION_CALLS_MILLIS = 5000;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
index cd32e11..4c8f12b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
@@ -138,7 +138,7 @@ public class JndiDataSourceFactory implements DataSourceFactory
                 log.debug("Time between context lookups: " + ttl);
             }
 
-    		Hashtable<String, Object> env = new Hashtable<String, Object>();
+    		Hashtable<String, Object> env = new Hashtable<>();
             ctx = new InitialContext(env);
 
             if (log.isDebugEnabled())
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java
index 49899c1..a821a26 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java
@@ -79,7 +79,7 @@ public class HSQLDiskCacheFactory
     public void initialize()
     {
         super.initialize();
-        this.databases = Collections.synchronizedSet( new HashSet<String>() );
+        this.databases = Collections.synchronizedSet( new HashSet<>() );
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java
index 147948a..090f766 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java
@@ -68,7 +68,7 @@ public class MySQLDiskCacheFactory
         TableState tableState = getTableState( cattr.getTableName() );
         DataSourceFactory dsFactory = getDataSourceFactory(cattr, compositeCacheManager.getConfigurationProperties());
 
-        MySQLDiskCache<K, V> cache = new MySQLDiskCache<K, V>( cattr, dsFactory, tableState, compositeCacheManager );
+        MySQLDiskCache<K, V> cache = new MySQLDiskCache<>( cattr, dsFactory, tableState, compositeCacheManager );
         cache.setCacheEventLogger( cacheEventLogger );
         cache.setElementSerializer( elementSerializer );
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java
index 77b6cd1..0a7ccea 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java
@@ -319,7 +319,7 @@ public class LateralCache<K, V>
     {
         log.error( "Disabling lateral cache due to error " + msg, ex );
 
-        lateralCacheService = new ZombieCacheServiceNonLocal<K, V>( lateralCacheAttributes.getZombieQueueMaxSize() );
+        lateralCacheService = new ZombieCacheServiceNonLocal<>( lateralCacheAttributes.getZombieQueueMaxSize() );
         // may want to flush if region specifies
         // Notify the cache monitor about the error, and kick off the recovery
         // process.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheMonitor.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheMonitor.java
index bbe88ad..c78916b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheMonitor.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheMonitor.java
@@ -69,7 +69,7 @@ public class LateralCacheMonitor extends AbstractAuxiliaryCacheMonitor
     {
         super("JCS-LateralCacheMonitor");
         this.factory = factory;
-        this.caches = new ConcurrentHashMap<String, LateralCacheNoWait<?,?>>();
+        this.caches = new ConcurrentHashMap<>();
         setIdlePeriod(20000L);
     }
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java
index ab9e1dc..3a7d9d4 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java
@@ -84,8 +84,8 @@ public class LateralCacheNoWait<K, V>
             log.debug( "Constructing LateralCacheNoWait, LateralCache = [" + cache + "]" );
         }
 
-        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<K, V>();
-        this.eventQueue = fact.createCacheEventQueue( new CacheAdaptor<K, V>( cache ), CacheInfo.listenerId, cache
+        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<>();
+        this.eventQueue = fact.createCacheEventQueue( new CacheAdaptor<>( cache ), CacheInfo.listenerId, cache
             .getCacheName(), cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(), cache
             .getAuxiliaryCacheAttributes().getEventQueueType() );
 
@@ -182,7 +182,7 @@ public class LateralCacheNoWait<K, V>
             return elements;
         }
 
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -360,8 +360,8 @@ public class LateralCacheNoWait<K, V>
         {
             eventQueue.destroy();
         }
-        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<K, V>();
-        this.eventQueue = fact.createCacheEventQueue( new CacheAdaptor<K, V>( cache ), CacheInfo.listenerId, cache
+        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<>();
+        this.eventQueue = fact.createCacheEventQueue( new CacheAdaptor<>( cache ), CacheInfo.listenerId, cache
             .getCacheName(), cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(), cache
             .getAuxiliaryCacheAttributes().getEventQueueType() );
     }
@@ -405,16 +405,16 @@ public class LateralCacheNoWait<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Lateral Cache No Wait" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
         // get the stats from the event queue too
         IStats eqStats = this.eventQueue.getStatistics();
         elems.addAll(eqStats.getStatElements());
 
-        elems.add(new StatElement<Integer>( "Get Count", Integer.valueOf(this.getCount) ) );
-        elems.add(new StatElement<Integer>( "Remove Count", Integer.valueOf(this.removeCount) ) );
-        elems.add(new StatElement<Integer>( "Put Count", Integer.valueOf(this.putCount) ) );
-        elems.add(new StatElement<AuxiliaryCacheAttributes>( "Attributes", cache.getAuxiliaryCacheAttributes() ) );
+        elems.add(new StatElement<>( "Get Count", Integer.valueOf(this.getCount) ) );
+        elems.add(new StatElement<>( "Remove Count", Integer.valueOf(this.removeCount) ) );
+        elems.add(new StatElement<>( "Put Count", Integer.valueOf(this.putCount) ) );
+        elems.add(new StatElement<>( "Attributes", cache.getAuxiliaryCacheAttributes() ) );
 
         stats.setStatElements( elems );
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
index 90e322c..807ec69 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
@@ -246,7 +246,7 @@ public class LateralCacheNoWaitFacade<K, V>
             return elements;
         }
 
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -259,7 +259,7 @@ public class LateralCacheNoWaitFacade<K, V>
     @Override
     public Map<K, ICacheElement<K, V>> getMatching(String pattern)
     {
-        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<>();
         for (LateralCacheNoWait<K, V> nw : noWaits)
         {
             elements.putAll( nw.getMatching( pattern ) );
@@ -275,7 +275,7 @@ public class LateralCacheNoWaitFacade<K, V>
     @Override
     public Set<K> getKeySet() throws IOException
     {
-        HashSet<K> allKeys = new HashSet<K>();
+        HashSet<K> allKeys = new HashSet<>();
         for (LateralCacheNoWait<K, V> nw : noWaits)
         {
             if ( nw != null )
@@ -451,11 +451,11 @@ public class LateralCacheNoWaitFacade<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Lateral Cache No Wait Facade" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
         if ( noWaits != null )
         {
-            elems.add(new StatElement<Integer>( "Number of No Waits", Integer.valueOf(noWaits.length) ) );
+            elems.add(new StatElement<>( "Number of No Waits", Integer.valueOf(noWaits.length) ) );
 
             for ( LateralCacheNoWait<K, V> lcnw : noWaits )
             {
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
index c517a74..c254a45 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
@@ -89,7 +89,7 @@ public class LateralTCPCacheFactory
            ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
         ITCPLateralCacheAttributes lac = (ITCPLateralCacheAttributes) iaca;
-        ArrayList<ICache<K, V>> noWaits = new ArrayList<ICache<K, V>>();
+        ArrayList<ICache<K, V>> noWaits = new ArrayList<>();
 
         // pairs up the tcp servers and set the tcpServer value and
         // get the manager and then get the cache
@@ -125,7 +125,7 @@ public class LateralTCPCacheFactory
         @SuppressWarnings("unchecked") // No generic arrays in java
         LateralCacheNoWait<K, V>[] lcnwArray = noWaits.toArray( new LateralCacheNoWait[0] );
         LateralCacheNoWaitFacade<K, V> lcnwf =
-            new LateralCacheNoWaitFacade<K, V>(listener, lcnwArray, lac );
+            new LateralCacheNoWaitFacade<>(listener, lcnwArray, lac );
 
         // create udp discovery if available.
         createDiscoveryService( lac, lcnwf, cacheMgr, cacheEventLogger, elementSerializer );
@@ -138,7 +138,7 @@ public class LateralTCPCacheFactory
     {
         ICacheServiceNonLocal<K, V> lateralService = getCSNLInstance(lca);
 
-        LateralCache<K, V> cache = new LateralCache<K, V>( lca, lateralService, this.monitor );
+        LateralCache<K, V> cache = new LateralCache<>( lca, lateralService, this.monitor );
         cache.setCacheEventLogger( cacheEventLogger );
         cache.setElementSerializer( elementSerializer );
 
@@ -147,7 +147,7 @@ public class LateralTCPCacheFactory
             log.debug( "Created cache for noWait, cache [" + cache + "]" );
         }
 
-        LateralCacheNoWait<K, V> lateralNoWait = new LateralCacheNoWait<K, V>( cache );
+        LateralCacheNoWait<K, V> lateralNoWait = new LateralCacheNoWait<>( cache );
         lateralNoWait.setCacheEventLogger( cacheEventLogger );
         lateralNoWait.setElementSerializer( elementSerializer );
 
@@ -166,8 +166,8 @@ public class LateralTCPCacheFactory
     @Override
     public void initialize()
     {
-        this.csnlInstances = new ConcurrentHashMap<String, ICacheServiceNonLocal<?, ?>>();
-        this.lTCPDLInstances = new ConcurrentHashMap<String, LateralTCPDiscoveryListener>();
+        this.csnlInstances = new ConcurrentHashMap<>();
+        this.lTCPDLInstances = new ConcurrentHashMap<>();
 
         // Create the monitoring daemon thread
         this.monitor = new LateralCacheMonitor(this);
@@ -253,7 +253,7 @@ public class LateralTCPCacheFactory
                             log.info( "Creating TCP service, lca = " + lca );
                         }
 
-                        return new LateralTCPService<K, V>( lca );
+                        return new LateralTCPService<>( lca );
                     }
                     catch ( IOException ex )
                     {
@@ -263,7 +263,7 @@ public class LateralTCPCacheFactory
                         log.error( "Failure, lateral instance will use zombie service", ex );
 
                         ICacheServiceNonLocal<K, V> zombieService =
-                                new ZombieCacheServiceNonLocal<K, V>( lca.getZombieQueueMaxSize() );
+                                new ZombieCacheServiceNonLocal<>( lca.getZombieQueueMaxSize() );
 
                         // Notify the cache monitor about the error, and kick off
                         // the recovery process.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java
index 4d6fd73..60170f1 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java
@@ -54,14 +54,14 @@ public class LateralTCPDiscoveryListener
      * use laterals.
      */
     private final Map<String, LateralCacheNoWaitFacade<?, ?>> facades =
-        Collections.synchronizedMap( new HashMap<String, LateralCacheNoWaitFacade<?, ?>>() );
+        Collections.synchronizedMap( new HashMap<>() );
 
     /**
      * 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 final Set<String> knownDifferentlyConfiguredRegions =
-        Collections.synchronizedSet( new HashSet<String>() );
+        Collections.synchronizedSet( new HashSet<>() );
 
     /** The name of the cache factory */
     private String factoryName;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
index 12373ae..9506a34 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
@@ -70,7 +70,7 @@ public class LateralTCPListener<K, V>
 
     /** Map of available instances, keyed by port */
     private static final HashMap<String, ILateralCacheListener<?, ?>> instances =
-        new HashMap<String, ILateralCacheListener<?, ?>>();
+        new HashMap<>();
 
     /** The socket listener */
     private ListenerThread receiver;
@@ -120,7 +120,7 @@ public class LateralTCPListener<K, V>
 
         if ( ins == null )
         {
-            ins = new LateralTCPListener<K, V>( ilca );
+            ins = new LateralTCPListener<>( ilca );
 
             ins.init();
             ins.setCacheManager( cacheMgr );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
index 5f346c9..ac90834 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
@@ -125,7 +125,7 @@ public class LateralTCPService<K, V>
         // if we shouldn't remove on put, then put
         if ( !this.issueRemoveOnPut )
         {
-            LateralElementDescriptor<K, V> led = new LateralElementDescriptor<K, V>( item );
+            LateralElementDescriptor<K, V> led = new LateralElementDescriptor<>( item );
             led.requesterId = requesterId;
             led.command = LateralCommand.UPDATE;
             sender.send( led );
@@ -139,8 +139,8 @@ public class LateralTCPService<K, V>
                 log.debug( "Issuing a remove for a put" );
             }
             // set the value to null so we don't send the item
-            CacheElement<K, V> ce = new CacheElement<K, V>( item.getCacheName(), item.getKey(), null );
-            LateralElementDescriptor<K, V> led = new LateralElementDescriptor<K, V>( ce );
+            CacheElement<K, V> ce = new CacheElement<>( item.getCacheName(), item.getKey(), null );
+            LateralElementDescriptor<K, V> led = new LateralElementDescriptor<>( ce );
             led.requesterId = requesterId;
             led.command = LateralCommand.REMOVE;
             led.valHashCode = item.getVal().hashCode();
@@ -169,8 +169,8 @@ public class LateralTCPService<K, V>
     public void remove( String cacheName, K key, long requesterId )
         throws IOException
     {
-        CacheElement<K, V> ce = new CacheElement<K, V>( cacheName, key, null );
-        LateralElementDescriptor<K, V> led = new LateralElementDescriptor<K, V>( ce );
+        CacheElement<K, V> ce = new CacheElement<>( cacheName, key, null );
+        LateralElementDescriptor<K, V> led = new LateralElementDescriptor<>( ce );
         led.requesterId = requesterId;
         led.command = LateralCommand.REMOVE;
         sender.send( led );
@@ -230,8 +230,8 @@ public class LateralTCPService<K, V>
         // if get is not allowed return
         if ( this.allowGet )
         {
-            CacheElement<K, V> ce = new CacheElement<K, V>( cacheName, key, null );
-            LateralElementDescriptor<K, V> led = new LateralElementDescriptor<K, V>( ce );
+            CacheElement<K, V> ce = new CacheElement<>( cacheName, key, null );
+            LateralElementDescriptor<K, V> led = new LateralElementDescriptor<>( ce );
             // led.requesterId = requesterId; // later
             led.command = LateralCommand.GET;
             @SuppressWarnings("unchecked") // Need to cast from Object
@@ -283,8 +283,8 @@ public class LateralTCPService<K, V>
         // if get is not allowed return
         if ( this.allowGet )
         {
-            CacheElement<String, String> ce = new CacheElement<String, String>( cacheName, pattern, null );
-            LateralElementDescriptor<String, String> led = new LateralElementDescriptor<String, String>( ce );
+            CacheElement<String, String> ce = new CacheElement<>( cacheName, pattern, null );
+            LateralElementDescriptor<String, String> led = new LateralElementDescriptor<>( ce );
             // led.requesterId = requesterId; // later
             led.command = LateralCommand.GET_MATCHING;
 
@@ -334,7 +334,7 @@ public class LateralTCPService<K, V>
     public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
         throws IOException
     {
-        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<>();
 
         if ( keys != null && !keys.isEmpty() )
         {
@@ -361,8 +361,8 @@ public class LateralTCPService<K, V>
     @SuppressWarnings("unchecked") // Need cast from Object
     public Set<K> getKeySet(String cacheName) throws IOException
     {
-        CacheElement<String, String> ce = new CacheElement<String, String>(cacheName, null, null);
-        LateralElementDescriptor<String, String> led = new LateralElementDescriptor<String, String>(ce);
+        CacheElement<String, String> ce = new CacheElement<>(cacheName, null, null);
+        LateralElementDescriptor<String, String> led = new LateralElementDescriptor<>(ce);
         // led.requesterId = requesterId; // later
         led.command = LateralCommand.GET_KEYSET;
         Object response = sender.sendAndReceive(led);
@@ -394,8 +394,8 @@ public class LateralTCPService<K, V>
     public void removeAll( String cacheName, long requesterId )
         throws IOException
     {
-        CacheElement<String, String> ce = new CacheElement<String, String>( cacheName, "ALL", null );
-        LateralElementDescriptor<String, String> led = new LateralElementDescriptor<String, String>( ce );
+        CacheElement<String, String> ce = new CacheElement<>( cacheName, "ALL", null );
+        LateralElementDescriptor<String, String> led = new LateralElementDescriptor<>( ce );
         led.requesterId = requesterId;
         led.command = LateralCommand.REMOVEALL;
         sender.send( led );
@@ -427,8 +427,8 @@ public class LateralTCPService<K, V>
                     continue;
                 }
 
-                CacheElement<String, String> ce = new CacheElement<String, String>( "test", "test", message );
-                LateralElementDescriptor<String, String> led = new LateralElementDescriptor<String, String>( ce );
+                CacheElement<String, String> ce = new CacheElement<>( "test", "test", message );
+                LateralElementDescriptor<String, String> led = new LateralElementDescriptor<>( ce );
                 sender.send( led );
             }
         }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
index 080b850..0a50d0f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
@@ -270,7 +270,7 @@ public abstract class AbstractRemoteAuxiliaryCache<K, V>
     public Map<K, ICacheElement<K, V>> processGetMatching( String pattern )
         throws IOException
     {
-        Map<K, ICacheElement<K, V>> results = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> results = new HashMap<>();
         try
         {
             Map<K, ICacheElement<K, V>> rawResults = getRemoteCacheService().getMatching( cacheName, pattern, getListenerId() );
@@ -529,25 +529,25 @@ public abstract class AbstractRemoteAuxiliaryCache<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "AbstractRemoteAuxiliaryCache" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        elems.add(new StatElement<String>( "Remote Type", this.getRemoteCacheAttributes().getRemoteTypeName() ) );
+        elems.add(new StatElement<>( "Remote Type", this.getRemoteCacheAttributes().getRemoteTypeName() ) );
 
 //      if ( this.getRemoteCacheAttributes().getRemoteType() == RemoteType.CLUSTER )
 //      {
 //          // something cluster specific
 //      }
 
-        elems.add(new StatElement<Boolean>( "UsePoolForGet", Boolean.valueOf(usePoolForGet) ) );
+        elems.add(new StatElement<>( "UsePoolForGet", Boolean.valueOf(usePoolForGet) ) );
 
         if ( pool != null )
         {
-            elems.add(new StatElement<ExecutorService>( "Pool", pool ) );
+            elems.add(new StatElement<>( "Pool", pool ) );
         }
 
         if ( getRemoteCacheService() instanceof ZombieCacheServiceNonLocal )
         {
-            elems.add(new StatElement<Integer>( "Zombie Queue Size",
+            elems.add(new StatElement<>( "Zombie Queue Size",
                     Integer.valueOf(( (ZombieCacheServiceNonLocal<K, V>) getRemoteCacheService() ).getQueueSize()) ) );
         }
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
index da541d5..9ae49ee 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
@@ -71,7 +71,7 @@ public abstract class AbstractRemoteCacheNoWaitFacade<K, V>
         this.remoteCacheAttributes = rca;
         setCacheEventLogger( cacheEventLogger );
         setElementSerializer( elementSerializer );
-        this.noWaits = new ArrayList<RemoteCacheNoWait<K,V>>(noWaits);
+        this.noWaits = new ArrayList<>(noWaits);
         for (RemoteCacheNoWait<K,V> nw : this.noWaits)
         {
             // FIXME: This cast is very brave. Remove this.
@@ -219,7 +219,7 @@ public abstract class AbstractRemoteCacheNoWaitFacade<K, V>
     @Override
     public Set<K> getKeySet() throws IOException
     {
-        HashSet<K> allKeys = new HashSet<K>();
+        HashSet<K> allKeys = new HashSet<>();
         for (RemoteCacheNoWait<K, V> nw : noWaits)
         {
             if ( nw != null )
@@ -407,11 +407,11 @@ public abstract class AbstractRemoteCacheNoWaitFacade<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Remote Cache No Wait Facade" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
         if ( noWaits != null )
         {
-            elems.add(new StatElement<Integer>( "Number of No Waits", Integer.valueOf(noWaits.size()) ) );
+            elems.add(new StatElement<>( "Number of No Waits", Integer.valueOf(noWaits.size()) ) );
 
             for ( RemoteCacheNoWait<K, V> rcnw : noWaits )
             {
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCache.java
index ec0a269..2db1577 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCache.java
@@ -83,10 +83,10 @@ public class RemoteCache<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Remote Cache" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        elems.add(new StatElement<String>( "Remote Host:Port", getIPAddressForService() ) );
-        elems.add(new StatElement<String>( "Remote Type", this.getRemoteCacheAttributes().getRemoteTypeName() ) );
+        elems.add(new StatElement<>( "Remote Host:Port", getIPAddressForService() ) );
+        elems.add(new StatElement<>( "Remote Type", this.getRemoteCacheAttributes().getRemoteTypeName() ) );
 
 //      if ( this.getRemoteCacheAttributes().getRemoteType() == RemoteType.CLUSTER )
 //      {
@@ -144,7 +144,7 @@ public class RemoteCache<K, V>
         if ( getRemoteCacheService() == null || !( getRemoteCacheService() instanceof ZombieCacheServiceNonLocal ) )
         {
             // TODO make configurable
-            setRemoteCacheService( new ZombieCacheServiceNonLocal<K, V>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
+            setRemoteCacheService( new ZombieCacheServiceNonLocal<>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
         }
         // may want to flush if region specifies
         // Notify the cache monitor about the error, and kick off the recovery
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java
index 3c1ef01..25f18d6 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java
@@ -74,13 +74,13 @@ public class RemoteCacheFactory
     {
         RemoteCacheAttributes rca = (RemoteCacheAttributes) iaca;
 
-        ArrayList<RemoteCacheNoWait<K,V>> noWaits = new ArrayList<RemoteCacheNoWait<K,V>>();
+        ArrayList<RemoteCacheNoWait<K,V>> noWaits = new ArrayList<>();
 
         switch (rca.getRemoteType())
         {
             case LOCAL:
                 // a list to be turned into an array of failover server information
-                ArrayList<RemoteLocation> failovers = new ArrayList<RemoteLocation>();
+                ArrayList<RemoteLocation> failovers = new ArrayList<>();
 
                 // not necessary if a failover list is defined
                 // REGISTER PRIMARY LISTENER
@@ -152,7 +152,7 @@ public class RemoteCacheFactory
         }
 
         RemoteCacheNoWaitFacade<K, V> rcnwf =
-            new RemoteCacheNoWaitFacade<K, V>(noWaits, rca, cacheEventLogger, elementSerializer, this );
+            new RemoteCacheNoWaitFacade<>(noWaits, rca, cacheEventLogger, elementSerializer, this );
 
         return rcnwf;
     }
@@ -233,7 +233,7 @@ public class RemoteCacheFactory
 	{
 		super.initialize();
 
-		managers = new ConcurrentHashMap<RemoteLocation, RemoteCacheManager>();
+		managers = new ConcurrentHashMap<>();
 		managerLock = new ReentrantLock();
 
         monitor = new RemoteCacheMonitor();
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java
index 90a9e79..d3960c4 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java
@@ -54,7 +54,7 @@ public class RemoteCacheManager
 
     /** Contains instances of RemoteCacheNoWait managed by a RemoteCacheManager instance. */
     private final ConcurrentMap<String, RemoteCacheNoWait<?, ?>> caches =
-            new ConcurrentHashMap<String, RemoteCacheNoWait<?, ?>>();
+            new ConcurrentHashMap<>();
 
     /** The event logger. */
     private final ICacheEventLogger cacheEventLogger;
@@ -151,7 +151,7 @@ public class RemoteCacheManager
             // Failed to connect to the remote server.
             // Configure this RemoteCacheManager instance to use the "zombie"
             // services.
-            this.remoteService = new ZombieCacheServiceNonLocal<String, String>();
+            this.remoteService = new ZombieCacheServiceNonLocal<>();
             remoteWatch.setCacheWatch( new ZombieCacheWatch() );
             throw new IOException( "Problem finding server at [" + registry + "]", ex );
         }
@@ -268,7 +268,7 @@ public class RemoteCacheManager
         RemoteCacheListener<K, V> listener = null;
         try
         {
-            listener = new RemoteCacheListener<K, V>( cattr, cacheMgr, elementSerializer );
+            listener = new RemoteCacheListener<>( cattr, cacheMgr, elementSerializer );
             addRemoteCacheListener( cattr, listener );
         }
         catch ( IOException ioe )
@@ -283,11 +283,11 @@ public class RemoteCacheManager
         }
 
         IRemoteCacheClient<K, V> remoteCacheClient =
-            new RemoteCache<K, V>( cattr, (ICacheServiceNonLocal<K, V>) remoteService, listener, monitor );
+            new RemoteCache<>( cattr, (ICacheServiceNonLocal<K, V>) remoteService, listener, monitor );
         remoteCacheClient.setCacheEventLogger( cacheEventLogger );
         remoteCacheClient.setElementSerializer( elementSerializer );
 
-        remoteCacheNoWait = new RemoteCacheNoWait<K, V>( remoteCacheClient );
+        remoteCacheNoWait = new RemoteCacheNoWait<>( remoteCacheClient );
         remoteCacheNoWait.setCacheEventLogger( cacheEventLogger );
         remoteCacheNoWait.setElementSerializer( elementSerializer );
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java
index 3894f4b..d33ad53 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java
@@ -44,7 +44,7 @@ public class RemoteCacheMonitor extends AbstractAuxiliaryCacheMonitor
     public RemoteCacheMonitor()
     {
         super("JCS-RemoteCacheMonitor");
-        this.managers = new ConcurrentHashMap<RemoteCacheManager, RemoteCacheManager>();
+        this.managers = new ConcurrentHashMap<>();
         setIdlePeriod(30000L);
     }
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java
index 122dbaa..1721ded 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java
@@ -113,9 +113,9 @@ public class RemoteCacheNoWait<K, V>
      */
     private ICacheEventQueue<K, V> createCacheEventQueue( IRemoteCacheClient<K, V> client )
     {
-        CacheEventQueueFactory<K, V> factory = new CacheEventQueueFactory<K, V>();
+        CacheEventQueueFactory<K, V> factory = new CacheEventQueueFactory<>();
         ICacheEventQueue<K, V> ceq = factory.createCacheEventQueue(
-            new CacheAdaptor<K, V>( client ),
+            new CacheAdaptor<>( client ),
             client.getListenerId(),
             client.getCacheName(),
             client.getAuxiliaryCacheAttributes().getEventQueuePoolName(),
@@ -282,7 +282,7 @@ public class RemoteCacheNoWait<K, V>
             throw ex;
         }
 
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -498,9 +498,9 @@ public class RemoteCacheNoWait<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Remote Cache No Wait" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        elems.add(new StatElement<CacheStatus>( "Status", getStatus() ) );
+        elems.add(new StatElement<>( "Status", getStatus() ) );
 
         // get the stats from the cache queue too
         IStats cStats = this.remoteCacheClient.getStatistics();
@@ -513,11 +513,11 @@ public class RemoteCacheNoWait<K, V>
         IStats eqStats = this.cacheEventQueue.getStatistics();
         elems.addAll(eqStats.getStatElements());
 
-        elems.add(new StatElement<Integer>( "Get Count", Integer.valueOf(this.getCount) ) );
-        elems.add(new StatElement<Integer>( "GetMatching Count", Integer.valueOf(this.getMatchingCount) ) );
-        elems.add(new StatElement<Integer>( "GetMultiple Count", Integer.valueOf(this.getMultipleCount) ) );
-        elems.add(new StatElement<Integer>( "Remove Count", Integer.valueOf(this.removeCount) ) );
-        elems.add(new StatElement<Integer>( "Put Count", Integer.valueOf(this.putCount) ) );
+        elems.add(new StatElement<>( "Get Count", Integer.valueOf(this.getCount) ) );
+        elems.add(new StatElement<>( "GetMatching Count", Integer.valueOf(this.getMatchingCount) ) );
+        elems.add(new StatElement<>( "GetMultiple Count", Integer.valueOf(this.getMultipleCount) ) );
+        elems.add(new StatElement<>( "Remove Count", Integer.valueOf(this.removeCount) ) );
+        elems.add(new StatElement<>( "Put Count", Integer.valueOf(this.putCount) ) );
 
         stats.setStatElements( elems );
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
index 3fd4e46..5b7fa04 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
@@ -83,7 +83,7 @@ public class RemoteCacheNoWaitFacade<K, V>
             if ( rcnw.getStatus() == CacheStatus.ERROR )
             {
                 // start failover, primary recovery process
-                RemoteCacheFailoverRunner<K, V> runner = new RemoteCacheFailoverRunner<K, V>( this, this.cacheFactory );
+                RemoteCacheFailoverRunner<K, V> runner = new RemoteCacheFailoverRunner<>( this, this.cacheFactory );
                 runner.setDaemon( true );
                 runner.start();
                 runner.notifyError();
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCache.java
index 54ead3b..1622b8f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCache.java
@@ -82,7 +82,7 @@ public class RemoteHttpCache<K, V>
             logError( cacheName, "", message );
             log.error( message, ex );
 
-            setRemoteCacheService( new ZombieCacheServiceNonLocal<K, V>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
+            setRemoteCacheService( new ZombieCacheServiceNonLocal<>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
 
             monitor.notifyError( this );
         }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java
index 67d243e..d8ad200 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java
@@ -70,16 +70,16 @@ public class RemoteHttpCacheFactory
         // TODO, use the configured value.
         rca.setRemoteType( RemoteType.LOCAL );
 
-        RemoteHttpClientListener<K, V> listener = new RemoteHttpClientListener<K, V>( rca, cacheMgr, elementSerializer );
+        RemoteHttpClientListener<K, V> listener = new RemoteHttpClientListener<>( rca, cacheMgr, elementSerializer );
 
         IRemoteHttpCacheClient<K, V> remoteService = createRemoteHttpCacheClientForAttributes(rca);
 
         IRemoteCacheClient<K, V> remoteCacheClient =
-                new RemoteHttpCache<K, V>( rca, remoteService, listener, monitor );
+                new RemoteHttpCache<>( rca, remoteService, listener, monitor );
         remoteCacheClient.setCacheEventLogger( cacheEventLogger );
         remoteCacheClient.setElementSerializer( elementSerializer );
 
-        RemoteCacheNoWait<K, V> remoteCacheNoWait = new RemoteCacheNoWait<K, V>( remoteCacheClient );
+        RemoteCacheNoWait<K, V> remoteCacheNoWait = new RemoteCacheNoWait<>( remoteCacheClient );
         remoteCacheNoWait.setCacheEventLogger( cacheEventLogger );
         remoteCacheNoWait.setElementSerializer( elementSerializer );
 
@@ -104,7 +104,7 @@ public class RemoteHttpCacheFactory
             {
                 log.info( "Creating the default client for " + cattr.getCacheName());
             }
-            remoteService = new RemoteHttpCacheClient<K, V>( );
+            remoteService = new RemoteHttpCacheClient<>( );
         }
 
         remoteService.initialize( cattr );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
index feb1210..6a5a2a7 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
@@ -49,7 +49,7 @@ public class RemoteHttpCacheMonitor extends AbstractAuxiliaryCacheMonitor
     {
         super("JCS-RemoteHttpCacheMonitor");
         this.factory = factory;
-        this.remoteHttpCaches = new ConcurrentHashMap<RemoteHttpCache<?, ?>, RemoteHttpCache<?, ?>>();
+        this.remoteHttpCaches = new ConcurrentHashMap<>();
         setIdlePeriod(3000L);
     }
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
index dca2e37..4541986 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
@@ -495,7 +495,7 @@ public abstract class AbstractRemoteCacheService<K, V>
     {
         if ( cacheEventLogger == null )
         {
-            return new CacheEvent<ICacheElement<K, V>>();
+            return new CacheEvent<>();
         }
         String ipAddress = getExtraInfoForRequesterId( requesterId );
         return cacheEventLogger.createICacheEvent( getEventLogSourceName(), item.getCacheName(), eventName, ipAddress,
@@ -515,7 +515,7 @@ public abstract class AbstractRemoteCacheService<K, V>
     {
         if ( cacheEventLogger == null )
         {
-            return new CacheEvent<T>();
+            return new CacheEvent<>();
         }
         String ipAddress = getExtraInfoForRequesterId( requesterId );
         return cacheEventLogger.createICacheEvent( getEventLogSourceName(), cacheName, eventName, ipAddress, key );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
index 761efe9..10f8e1d 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
@@ -214,7 +214,7 @@ public class RemoteHttpCacheServlet
      */
     protected RemoteCacheResponse<Object> processRequest( RemoteCacheRequest<Serializable, Serializable> request )
     {
-        RemoteCacheResponse<Object> response = new RemoteCacheResponse<Object>();
+        RemoteCacheResponse<Object> response = new RemoteCacheResponse<>();
 
         if ( request == null )
         {
@@ -239,7 +239,7 @@ public class RemoteHttpCacheServlet
                             remoteCacheService.getMultiple( request.getCacheName(), request.getKeySet(), request.getRequesterId() );
                         if ( elementMap != null )
                         {
-                            Map<Serializable, ICacheElement<Serializable, Serializable>> map = new HashMap<Serializable, ICacheElement<Serializable, Serializable>>();
+                            Map<Serializable, ICacheElement<Serializable, Serializable>> map = new HashMap<>();
                             map.putAll(elementMap);
                             response.setPayload(map);
                         }
@@ -249,7 +249,7 @@ public class RemoteHttpCacheServlet
                             remoteCacheService.getMatching( request.getCacheName(), request.getPattern(), request.getRequesterId() );
                         if ( elementMapMatching != null )
                         {
-                            Map<Serializable, ICacheElement<Serializable, Serializable>> map = new HashMap<Serializable, ICacheElement<Serializable, Serializable>>();
+                            Map<Serializable, ICacheElement<Serializable, Serializable>> map = new HashMap<>();
                             map.putAll(elementMapMatching);
                             response.setPayload(map);
                         }
@@ -304,7 +304,7 @@ public class RemoteHttpCacheServlet
         ICacheEventLogger cacheEventLogger = configureCacheEventLogger( props );
         RemoteHttpCacheServerAttributes attributes = configureRemoteHttpCacheServerAttributes( props );
 
-        RemoteHttpCacheService<K, V> service = new RemoteHttpCacheService<K, V>( cacheManager, attributes, cacheEventLogger );
+        RemoteHttpCacheService<K, V> service = new RemoteHttpCacheService<>( cacheManager, attributes, cacheEventLogger );
         if ( log.isInfoEnabled() )
         {
             log.info( "Created new RemoteHttpCacheService " + service );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
index b1a241a..829b4e2 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
@@ -86,20 +86,20 @@ public class RemoteCacheServer<K, V>
 
     /** Maps cache name to CacheListeners object. association of listeners (regions). */
     private final transient ConcurrentMap<String, CacheListeners<K, V>> cacheListenersMap =
-        new ConcurrentHashMap<String, CacheListeners<K, V>>();
+        new ConcurrentHashMap<>();
 
     /** maps cluster listeners to regions. */
     private final transient ConcurrentMap<String, CacheListeners<K, V>> clusterListenersMap =
-        new ConcurrentHashMap<String, CacheListeners<K, V>>();
+        new ConcurrentHashMap<>();
 
     /** The central hub */
     private transient CompositeCacheManager cacheManager;
 
     /** relates listener id with a type */
-    private final ConcurrentMap<Long, RemoteType> idTypeMap = new ConcurrentHashMap<Long, RemoteType>();
+    private final ConcurrentMap<Long, RemoteType> idTypeMap = new ConcurrentHashMap<>();
 
     /** relates listener id with an ip address */
-    private final ConcurrentMap<Long, String> idIPMap = new ConcurrentHashMap<Long, String>();
+    private final ConcurrentMap<Long, String> idIPMap = new ConcurrentHashMap<>();
 
     /** Used to get the next listener id. */
     private final int[] listenerId = new int[1];
@@ -171,7 +171,7 @@ public class RemoteCacheServer<K, V>
         {
             String name = list[i];
             CompositeCache<K, V> cache = cacheManager.getCache( name );
-            cacheListenersMap.put( name, new CacheListeners<K, V>( cache ) );
+            cacheListenersMap.put( name, new CacheListeners<>( cache ) );
         }
     }
 
@@ -1152,7 +1152,7 @@ public class RemoteCacheServer<K, V>
     {
         CacheListeners<K, V> cacheListeners = cacheListenersMap.computeIfAbsent(cacheName, key -> {
             CompositeCache<K, V> cache = cacheManager.getCache(key);
-            return new CacheListeners<K, V>( cache );
+            return new CacheListeners<>( cache );
         });
 
         return cacheListeners;
@@ -1169,7 +1169,7 @@ public class RemoteCacheServer<K, V>
     {
         CacheListeners<K, V> cacheListeners = clusterListenersMap.computeIfAbsent(cacheName, key -> {
             CompositeCache<K, V> cache = cacheManager.getCache( cacheName );
-            return new CacheListeners<K, V>( cache );
+            return new CacheListeners<>( cache );
         });
 
         return cacheListeners;
@@ -1342,7 +1342,7 @@ public class RemoteCacheServer<K, V>
                 }
             }
 
-            CacheEventQueueFactory<KK, VV> fact = new CacheEventQueueFactory<KK, VV>();
+            CacheEventQueueFactory<KK, VV> fact = new CacheEventQueueFactory<>();
             ICacheEventQueue<KK, VV> q = fact.createCacheEventQueue( listener, id, cacheName, remoteCacheServerAttributes
                 .getEventQueuePoolName(), remoteCacheServerAttributes.getEventQueueType() );
 
@@ -1594,7 +1594,7 @@ public class RemoteCacheServer<K, V>
     {
         if ( cacheEventLogger == null )
         {
-            return new CacheEvent<ICacheElement<K, V>>();
+            return new CacheEvent<>();
         }
         String ipAddress = getExtraInfoForRequesterId( requesterId );
         return cacheEventLogger
@@ -1614,7 +1614,7 @@ public class RemoteCacheServer<K, V>
     {
         if ( cacheEventLogger == null )
         {
-            return new CacheEvent<T>();
+            return new CacheEvent<>();
         }
         String ipAddress = getExtraInfoForRequesterId( requesterId );
         return cacheEventLogger.createICacheEvent( "RemoteCacheServer", cacheName, eventName, ipAddress, key );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
index 60a0fa0..4668772 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
@@ -139,11 +139,11 @@ public class RemoteCacheServerFactory
             // CREATE SERVER
             if ( customRMISocketFactory != null )
             {
-                remoteCacheServer = new RemoteCacheServer<Serializable, Serializable>( rcsa, props, customRMISocketFactory );
+                remoteCacheServer = new RemoteCacheServer<>( rcsa, props, customRMISocketFactory );
             }
             else
             {
-                remoteCacheServer = new RemoteCacheServer<Serializable, Serializable>( rcsa, props );
+                remoteCacheServer = new RemoteCacheServer<>( rcsa, props );
             }
 
             remoteCacheServer.setCacheEventLogger( cacheEventLogger );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java
index fc90ca9..4c09a95 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java
@@ -45,7 +45,7 @@ public class RemoteCacheRequestFactory
      */
     private static <K, V> RemoteCacheRequest<K, V> createRequest(String cacheName, RemoteRequestType requestType, long requesterId)
     {
-        RemoteCacheRequest<K, V> request = new RemoteCacheRequest<K, V>();
+        RemoteCacheRequest<K, V> request = new RemoteCacheRequest<>();
         request.setCacheName( cacheName );
         request.setRequestType( requestType );
         request.setRequesterId( requesterId );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheEventQueueFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheEventQueueFactory.java
index 24b5dc2..12201ec 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheEventQueueFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheEventQueueFactory.java
@@ -75,11 +75,11 @@ public class CacheEventQueueFactory<K, V>
         ICacheEventQueue<K, V> eventQueue = null;
         if ( poolType == null || ICacheEventQueue.QueueType.SINGLE == poolType )
         {
-            eventQueue = new CacheEventQueue<K, V>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
+            eventQueue = new CacheEventQueue<>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
         }
         else if ( ICacheEventQueue.QueueType.POOLED == poolType )
         {
-            eventQueue = new PooledCacheEventQueue<K, V>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry,
+            eventQueue = new PooledCacheEventQueue<>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry,
                                                     threadPoolName );
         }
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java
index 1c10a58..c4e3ba0 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java
@@ -17,7 +17,7 @@ public class CacheListeners<K, V>
 
     /** Map ICacheListener to ICacheEventQueue */
     public final ConcurrentMap<Long, ICacheEventQueue<K, V>> eventQMap =
-        new ConcurrentHashMap<Long, ICacheEventQueue<K, V>>();
+        new ConcurrentHashMap<>();
 
     /**
      * Constructs with the given cache.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheWatchRepairable.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheWatchRepairable.java
index f3acfab..649edf2 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheWatchRepairable.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheWatchRepairable.java
@@ -47,7 +47,7 @@ public class CacheWatchRepairable
 
     /** Map of cache regions. */
     private final ConcurrentMap<String, Set<ICacheListener<?, ?>>> cacheMap =
-        new ConcurrentHashMap<String, Set<ICacheListener<?, ?>>>();
+        new ConcurrentHashMap<>();
 
     /**
      * Replaces the underlying cache watch service and re-attaches all existing listeners to the new
@@ -95,7 +95,7 @@ public class CacheWatchRepairable
         // Record the added cache listener locally, regardless of whether the
         // remote add-listener operation succeeds or fails.
         Set<ICacheListener<?, ?>> listenerSet = cacheMap.computeIfAbsent(cacheName, key -> {
-            return new CopyOnWriteArraySet<ICacheListener<?, ?>>();
+            return new CopyOnWriteArraySet<>();
         });
 
         listenerSet.add( obj );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java
index e0dd6b8..053fefc 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java
@@ -365,7 +365,7 @@ public class ElementAttributes
         // lazy here, no concurrency problems expected
         if ( this.eventHandlers == null )
         {
-            this.eventHandlers = new ArrayList<IElementEventHandler>();
+            this.eventHandlers = new ArrayList<>();
         }
         this.eventHandlers.add( eventHandler );
     }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/PooledCacheEventQueue.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/PooledCacheEventQueue.java
index e4b1089..a602cfa 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/PooledCacheEventQueue.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/PooledCacheEventQueue.java
@@ -145,15 +145,15 @@ public class PooledCacheEventQueue<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Pooled Cache Event Queue" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        elems.add(new StatElement<Boolean>( "Working", Boolean.valueOf(isWorking()) ) );
-        elems.add(new StatElement<Boolean>( "Empty", Boolean.valueOf(this.isEmpty()) ) );
+        elems.add(new StatElement<>( "Working", Boolean.valueOf(isWorking()) ) );
+        elems.add(new StatElement<>( "Empty", Boolean.valueOf(this.isEmpty()) ) );
 
         if ( queue != null )
         {
-            elems.add(new StatElement<Integer>( "Queue Size", Integer.valueOf(queue.size()) ) );
-            elems.add(new StatElement<Integer>( "Queue Capacity", Integer.valueOf(queue.remainingCapacity()) ) );
+            elems.add(new StatElement<>( "Queue Size", Integer.valueOf(queue.size()) ) );
+            elems.add(new StatElement<>( "Queue Capacity", Integer.valueOf(queue.remainingCapacity()) ) );
         }
 
         stats.setStatElements( elems );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java
index 1c8b34c..313c534 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java
@@ -59,7 +59,7 @@ public class ZombieCacheServiceNonLocal<K, V>
      */
     public ZombieCacheServiceNonLocal()
     {
-        queue = new ConcurrentLinkedQueue<ZombieEvent>();
+        queue = new ConcurrentLinkedQueue<>();
     }
 
     /**
@@ -70,7 +70,7 @@ public class ZombieCacheServiceNonLocal<K, V>
     public ZombieCacheServiceNonLocal( int maxQueueSize )
     {
         this.maxQueueSize = maxQueueSize;
-        queue = new ConcurrentLinkedQueue<ZombieEvent>();
+        queue = new ConcurrentLinkedQueue<>();
     }
 
     /**
@@ -103,7 +103,7 @@ public class ZombieCacheServiceNonLocal<K, V>
     {
         if ( maxQueueSize > 0 )
         {
-            PutEvent<K, V> event = new PutEvent<K, V>( item, listenerId );
+            PutEvent<K, V> event = new PutEvent<>( item, listenerId );
             addQueue( event );
         }
         // Zombies have no inner life
@@ -121,7 +121,7 @@ public class ZombieCacheServiceNonLocal<K, V>
     {
         if ( maxQueueSize > 0 )
         {
-            RemoveEvent<K> event = new RemoveEvent<K>( cacheName, key, listenerId );
+            RemoveEvent<K> event = new RemoveEvent<>( cacheName, key, listenerId );
             addQueue( event );
         }
         // Zombies have no inner life
@@ -186,7 +186,7 @@ public class ZombieCacheServiceNonLocal<K, V>
     @Override
     public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
     {
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
index 8f2efda..3447a73 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
@@ -122,7 +122,7 @@ public class CompositeCache<K, V>
     private IMemoryCache<K, V> memCache;
 
     /** Key matcher used by the getMatching API */
-    private IKeyMatcher<K> keyMatcher = new KeyMatcherPatternImpl<K>();
+    private IKeyMatcher<K> keyMatcher = new KeyMatcherPatternImpl<>();
 
     private ScheduledFuture<?> future;
 
@@ -181,7 +181,7 @@ public class CompositeCache<K, V>
         if (cacheAttr.isUseMemoryShrinker())
         {
             future = scheduledExecutor.scheduleAtFixedRate(
-                    new ShrinkerThread<K, V>(this), 0, cacheAttr.getShrinkerIntervalSeconds(),
+                    new ShrinkerThread<>(this), 0, cacheAttr.getShrinkerIntervalSeconds(),
                     TimeUnit.SECONDS);
         }
     }
@@ -675,7 +675,7 @@ public class CompositeCache<K, V>
      */
     protected Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys, boolean localOnly)
     {
-        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<>();
 
         if (log.isDebugEnabled())
         {
@@ -763,15 +763,15 @@ public class CompositeCache<K, V>
     private Map<K, ICacheElement<K, V>> getMultipleFromAuxiliaryCaches(Set<K> keys, boolean localOnly)
         throws IOException
     {
-        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
-        Set<K> remainingKeys = new HashSet<K>(keys);
+        Map<K, ICacheElement<K, V>> elements = new HashMap<>();
+        Set<K> remainingKeys = new HashSet<>(keys);
 
         for (AuxiliaryCache<K, V> aux : auxCaches)
         {
             if (aux != null)
             {
                 Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
-                    new HashMap<K, ICacheElement<K, V>>();
+                    new HashMap<>();
 
                 CacheType cacheType = aux.getCacheType();
 
@@ -877,7 +877,7 @@ public class CompositeCache<K, V>
             log.error("Problem encountered getting elements.", e);
         }
 
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -916,7 +916,7 @@ public class CompositeCache<K, V>
     private Map<K, ICacheElement<K, V>> getMatchingFromAuxiliaryCaches(String pattern, boolean localOnly)
         throws IOException
     {
-        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<>();
 
         for (int i = auxCaches.length - 1; i >= 0; i--)
         {
@@ -925,7 +925,7 @@ public class CompositeCache<K, V>
             if (aux != null)
             {
                 Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
-                    new HashMap<K, ICacheElement<K, V>>();
+                    new HashMap<>();
 
                 CacheType cacheType = aux.getCacheType();
 
@@ -1048,7 +1048,7 @@ public class CompositeCache<K, V>
      */
     private Set<K> pruneKeysFound(Set<K> keys, Map<K, ICacheElement<K, V>> foundElements)
     {
-        Set<K> remainingKeys = new HashSet<K>(keys);
+        Set<K> remainingKeys = new HashSet<>(keys);
         remainingKeys.removeAll(foundElements.keySet());
 
         return remainingKeys;
@@ -1073,7 +1073,7 @@ public class CompositeCache<K, V>
      */
     public Set<K> getKeySet(boolean localOnly)
     {
-        HashSet<K> allKeys = new HashSet<K>();
+        HashSet<K> allKeys = new HashSet<>();
 
         allKeys.addAll(memCache.getKeySet());
         for (AuxiliaryCache<K, V> aux : auxCaches)
@@ -1473,16 +1473,16 @@ public class CompositeCache<K, V>
         stats.setRegionName(this.getCacheName());
 
         // store the composite cache stats first
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        elems.add(new StatElement<Long>("HitCountRam", Long.valueOf(getHitCountRam())));
-        elems.add(new StatElement<Long>("HitCountAux", Long.valueOf(getHitCountAux())));
+        elems.add(new StatElement<>("HitCountRam", Long.valueOf(getHitCountRam())));
+        elems.add(new StatElement<>("HitCountAux", Long.valueOf(getHitCountAux())));
 
         stats.setStatElements(elems);
 
         // memory + aux, memory is not considered an auxiliary internally
         int total = auxCaches.length + 1;
-        ArrayList<IStats> auxStats = new ArrayList<IStats>(total);
+        ArrayList<IStats> auxStats = new ArrayList<>(total);
 
         auxStats.add(getMemoryCache().getStatistics());
 
@@ -1674,7 +1674,7 @@ public class CompositeCache<K, V>
                 log.warn("No element event queue available for cache " + getCacheName());
                 return;
             }
-            IElementEvent<ICacheElement<K, V>> event = new ElementEvent<ICacheElement<K, V>>(element, eventType);
+            IElementEvent<ICacheElement<K, V>> event = new ElementEvent<>(element, eventType);
             for (IElementEventHandler hand : eventHandlers)
             {
                 try
@@ -1712,7 +1712,7 @@ public class CompositeCache<K, V>
             {
                 log.warn("Failed to init mem cache, using: LRUMemoryCache", e);
 
-                this.memCache = new LRUMemoryCache<K, V>();
+                this.memCache = new LRUMemoryCache<>();
                 this.memCache.initialize(this);
             }
         }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
index 453976c..0a0444c 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
@@ -121,7 +121,7 @@ public class CompositeCacheConfigurator
      */
     protected void parseRegions( Properties props, CompositeCacheManager ccm )
     {
-        List<String> regionNames = new ArrayList<String>();
+        List<String> regionNames = new ArrayList<>();
 
         for (String key : props.stringPropertyNames() )
         {
@@ -225,7 +225,7 @@ public class CompositeCacheConfigurator
         if (auxiliaries != null)
         {
             // Next, create the auxiliaries for the new cache
-            List<AuxiliaryCache<K, V>> auxList = new ArrayList<AuxiliaryCache<K, V>>();
+            List<AuxiliaryCache<K, V>> auxList = new ArrayList<>();
 
             if ( log.isDebugEnabled() )
             {
@@ -285,7 +285,7 @@ public class CompositeCacheConfigurator
     protected <K, V> CompositeCache<K, V> newCache(
             ICompositeCacheAttributes cca, IElementAttributes ea)
     {
-        return new CompositeCache<K, V>( cca, ea );
+        return new CompositeCache<>( cca, ea );
     }
 
     /**
@@ -565,7 +565,7 @@ public class CompositeCacheConfigurator
         else
         {
             // use the default standard serializer
-            keyMatcher = new KeyMatcherPatternImpl<K>();
+            keyMatcher = new KeyMatcherPatternImpl<>();
             if ( log.isInfoEnabled() )
             {
                 log.info( "Using standard key matcher [" + keyMatcher + "] for auxiliary [" + auxPrefix + "]" );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
index 54ed1d2..4013082 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
@@ -83,7 +83,7 @@ public class CompositeCacheManager
 
     /** Caches managed by this cache manager */
     private final ConcurrentMap<String, ICache<?, ?>> caches =
-        new ConcurrentHashMap<String, ICache<?, ?>>();
+        new ConcurrentHashMap<>();
 
     /** Number of clients accessing this cache manager */
     private final AtomicInteger clients = new AtomicInteger(0);
@@ -96,15 +96,15 @@ public class CompositeCacheManager
 
     /** Used to keep track of configured auxiliaries */
     private final ConcurrentMap<String, AuxiliaryCacheFactory> auxiliaryFactoryRegistry =
-        new ConcurrentHashMap<String, AuxiliaryCacheFactory>( );
+        new ConcurrentHashMap<>( );
 
     /** Used to keep track of attributes for auxiliaries. */
     private final ConcurrentMap<String, AuxiliaryCacheAttributes> auxiliaryAttributeRegistry =
-        new ConcurrentHashMap<String, AuxiliaryCacheAttributes>( );
+        new ConcurrentHashMap<>( );
 
     /** Used to keep track of configured auxiliaries */
     private final ConcurrentMap<String, AuxiliaryCache<?, ?>> auxiliaryCaches =
-        new ConcurrentHashMap<String, AuxiliaryCache<?, ?>>( );
+        new ConcurrentHashMap<>( );
 
     /** Properties with which this manager was configured. This is exposed for other managers. */
     private Properties configurationProperties;
@@ -122,7 +122,7 @@ public class CompositeCacheManager
     private static final boolean DEFAULT_FORCE_RECONFIGURATION = false;
 
     /** Stack for those waiting for notification of a shutdown. */
-    private final LinkedBlockingDeque<IShutdownObserver> shutdownObservers = new LinkedBlockingDeque<IShutdownObserver>();
+    private final LinkedBlockingDeque<IShutdownObserver> shutdownObservers = new LinkedBlockingDeque<>();
 
     /** The central background scheduler. */
     private ScheduledExecutorService scheduledExecutor;
@@ -839,7 +839,7 @@ public class CompositeCacheManager
      */
     public ICacheStats[] getStatistics()
     {
-        ArrayList<ICacheStats> cacheStats = new ArrayList<ICacheStats>();
+        ArrayList<ICacheStats> cacheStats = new ArrayList<>();
         for (ICache<?, ?> c :  caches.values())
         {
             CompositeCache<?, ?> cache = (CompositeCache<?, ?>) c;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java
index e38a9c5..4f67cb0 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java
@@ -49,7 +49,7 @@ public class CacheEventLoggerDebugLogger
     public <T> ICacheEvent<T> createICacheEvent( String source, String region, String eventName,
             String optionalDetails, T key )
     {
-        ICacheEvent<T> event = new CacheEvent<T>();
+        ICacheEvent<T> event = new CacheEvent<>();
         event.setSource( source );
         event.setRegion( region );
         event.setEventName( eventName );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
index 5f85104..222f504 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
@@ -61,7 +61,7 @@ public abstract class AbstractDoubleLinkedListMemoryCache<K, V> extends Abstract
     public void initialize(CompositeCache<K, V> hub)
     {
         super.initialize(hub);
-        list = new DoubleLinkedList<MemoryElementDescriptor<K, V>>();
+        list = new DoubleLinkedList<>();
         log.info("initialized MemoryCache for " + getCacheName());
     }
 
@@ -77,7 +77,7 @@ public abstract class AbstractDoubleLinkedListMemoryCache<K, V> extends Abstract
     @Override
     public ConcurrentMap<K, MemoryElementDescriptor<K, V>> createMap()
     {
-        return new ConcurrentHashMap<K, MemoryElementDescriptor<K, V>>();
+        return new ConcurrentHashMap<>();
     }
 
     /**
@@ -341,7 +341,7 @@ public abstract class AbstractDoubleLinkedListMemoryCache<K, V> extends Abstract
         lock.lock();
         try
         {
-            MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<K, V>(ce);
+            MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<>(ce);
             list.addFirst(me);
             if ( log.isDebugEnabled() )
             {
@@ -368,7 +368,7 @@ public abstract class AbstractDoubleLinkedListMemoryCache<K, V> extends Abstract
         lock.lock();
         try
         {
-            MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<K, V>(ce);
+            MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<>(ce);
             list.addLast(me);
             if ( log.isDebugEnabled() )
             {
@@ -517,7 +517,7 @@ public abstract class AbstractDoubleLinkedListMemoryCache<K, V> extends Abstract
 
         List<IStatElement<?>> elems = stats.getStatElements();
 
-        elems.add(new StatElement<Integer>("List Size", Integer.valueOf(list.size())));
+        elems.add(new StatElement<>("List Size", Integer.valueOf(list.size())));
 
         return stats;
     }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
index 0bc69d4..b984756 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
@@ -135,7 +135,7 @@ public abstract class AbstractMemoryCache<K, V>
                         element -> element));
         }
 
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -231,13 +231,13 @@ public abstract class AbstractMemoryCache<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "Abstract Memory Cache" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
         stats.setStatElements(elems);
 
-        elems.add(new StatElement<AtomicLong>("Put Count", putCnt));
-        elems.add(new StatElement<AtomicLong>("Hit Count", hitCnt));
-        elems.add(new StatElement<AtomicLong>("Miss Count", missCnt));
-        elems.add(new StatElement<Integer>( "Map Size", Integer.valueOf(getSize()) ) );
+        elems.add(new StatElement<>("Put Count", putCnt));
+        elems.add(new StatElement<>("Hit Count", hitCnt));
+        elems.add(new StatElement<>("Miss Count", missCnt));
+        elems.add(new StatElement<>( "Map Size", Integer.valueOf(getSize()) ) );
 
         return stats;
     }
@@ -457,7 +457,7 @@ public abstract class AbstractMemoryCache<K, V>
     @Override
     public Set<K> getKeySet()
     {
-        return new LinkedHashSet<K>(map.keySet());
+        return new LinkedHashSet<>(map.keySet());
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
index 2f90285..4221b99 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
@@ -74,7 +74,7 @@ public class LHMLRUMemoryCache<K, V>
         throws IOException
     {
         putCnt.incrementAndGet();
-        map.put( ce.getKey(), new MemoryElementDescriptor<K, V>(ce) );
+        map.put( ce.getKey(), new MemoryElementDescriptor<>(ce) );
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java
index b5c703b..f471995 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java
@@ -74,7 +74,7 @@ public class SoftReferenceMemoryCache<K, V> extends AbstractMemoryCache<K, V>
     public synchronized void initialize( CompositeCache<K, V> hub )
     {
         super.initialize( hub );
-        strongReferences = new LinkedBlockingQueue<ICacheElement<K, V>>();
+        strongReferences = new LinkedBlockingQueue<>();
         log.info( "initialized Soft Reference Memory Cache for " + getCacheName() );
     }
 
@@ -84,7 +84,7 @@ public class SoftReferenceMemoryCache<K, V> extends AbstractMemoryCache<K, V>
     @Override
     public ConcurrentMap<K, MemoryElementDescriptor<K, V>> createMap()
     {
-        return new ConcurrentHashMap<K, MemoryElementDescriptor<K, V>>();
+        return new ConcurrentHashMap<>();
     }
 
     /**
@@ -93,7 +93,7 @@ public class SoftReferenceMemoryCache<K, V> extends AbstractMemoryCache<K, V>
     @Override
     public Set<K> getKeySet()
     {
-        Set<K> keys = new HashSet<K>();
+        Set<K> keys = new HashSet<>();
         for (Map.Entry<K, MemoryElementDescriptor<K, V>> e : map.entrySet())
         {
             SoftReferenceElementDescriptor<K, V> sred = (SoftReferenceElementDescriptor<K, V>) e.getValue();
@@ -137,8 +137,8 @@ public class SoftReferenceMemoryCache<K, V> extends AbstractMemoryCache<K, V>
 
         List<IStatElement<?>> elems = stats.getStatElements();
         int emptyrefs = map.size() - getSize();
-        elems.add(new StatElement<Integer>("Empty References", Integer.valueOf(emptyrefs)));
-        elems.add(new StatElement<Integer>("Strong References", Integer.valueOf(strongReferences.size())));
+        elems.add(new StatElement<>("Empty References", Integer.valueOf(emptyrefs)));
+        elems.add(new StatElement<>("Strong References", Integer.valueOf(strongReferences.size())));
 
         return stats;
     }
@@ -198,7 +198,7 @@ public class SoftReferenceMemoryCache<K, V> extends AbstractMemoryCache<K, V>
 
         try
         {
-            map.put(ce.getKey(), new SoftReferenceElementDescriptor<K, V>(ce));
+            map.put(ce.getKey(), new SoftReferenceElementDescriptor<>(ce));
             strongReferences.add(ce);
             trimStrongReferences();
         }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java
index 32050e7..89edf02 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java
@@ -43,7 +43,7 @@ public class SoftReferenceElementDescriptor<K, V>
     public SoftReferenceElementDescriptor( ICacheElement<K, V> ce )
     {
         super( null );
-        this.srce = new SoftReference<ICacheElement<K, V>>(ce);
+        this.srce = new SoftReference<>(ce);
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/access/JCSWorker.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/access/JCSWorker.java
index 12395ab..58d5a6a 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/access/JCSWorker.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/access/JCSWorker.java
@@ -105,7 +105,7 @@ public class JCSWorker<K, V>
     /**
      * Map to hold who's doing work presently.
      */
-    private volatile ConcurrentMap<String, JCSWorkerHelper<V>> map = new ConcurrentHashMap<String, JCSWorkerHelper<V>>();
+    private volatile ConcurrentMap<String, JCSWorkerHelper<V>> map = new ConcurrentHashMap<>();
 
     /**
      * Region for the JCS cache.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPCleanupRunner.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPCleanupRunner.java
index d000f20..fc06fd0 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPCleanupRunner.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPCleanupRunner.java
@@ -72,7 +72,7 @@ public class UDPCleanupRunner
         // html
         // TODO this should get a copy.  you can't simply remove from this.
         // the listeners need to be notified.
-        Set<DiscoveredService> toRemove = new HashSet<DiscoveredService>();
+        Set<DiscoveredService> toRemove = new HashSet<>();
         // can't remove via the iterator. must remove directly
         for (DiscoveredService service : discoveryService.getDiscoveredServices())
         {
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryManager.java
index 79300fa..9042923 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryManager.java
@@ -42,7 +42,7 @@ public class UDPDiscoveryManager
     private static UDPDiscoveryManager INSTANCE = new UDPDiscoveryManager();
 
     /** Known services */
-    private final Map<String, UDPDiscoveryService> services = new HashMap<String, UDPDiscoveryService>();
+    private final Map<String, UDPDiscoveryService> services = new HashMap<>();
 
     /** private for singleton */
     private UDPDiscoveryManager()
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryMessage.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryMessage.java
index efe424c..b71e6e0 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryMessage.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryMessage.java
@@ -63,7 +63,7 @@ public class UDPDiscoveryMessage
     private long requesterId;
 
     /** Names of regions */
-    private ArrayList<String> cacheNames = new ArrayList<String>();
+    private ArrayList<String> cacheNames = new ArrayList<>();
 
     /**
      * @param port The port to set.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderThread.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderThread.java
index 8a3ab80..ba56cd9 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderThread.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderThread.java
@@ -40,7 +40,7 @@ public class UDPDiscoverySenderThread
     private final UDPDiscoveryAttributes attributes;
 
     /** List of known regions. */
-    private ArrayList<String> cacheNames = new ArrayList<String>();
+    private ArrayList<String> cacheNames = new ArrayList<>();
 
     /**
      * @param cacheNames The cacheNames to set.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
index 15b635f..a8a364b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
@@ -66,13 +66,13 @@ public class UDPDiscoveryService
     private boolean shutdown = false;
 
     /** This is a set of services that have been discovered. */
-    private Set<DiscoveredService> discoveredServices = new CopyOnWriteArraySet<DiscoveredService>();
+    private Set<DiscoveredService> discoveredServices = new CopyOnWriteArraySet<>();
 
     /** This a list of regions that are configured to use discovery. */
-    private final Set<String> cacheNames = new CopyOnWriteArraySet<String>();
+    private final Set<String> cacheNames = new CopyOnWriteArraySet<>();
 
     /** Set of listeners. */
-    private final Set<IDiscoveryListener> discoveryListeners = new CopyOnWriteArraySet<IDiscoveryListener>();
+    private final Set<IDiscoveryListener> discoveryListeners = new CopyOnWriteArraySet<>();
 
     /**
      * @param attributes
@@ -274,7 +274,7 @@ public class UDPDiscoveryService
      */
     protected ArrayList<String> getCacheNames()
     {
-        ArrayList<String> names = new ArrayList<String>();
+        ArrayList<String> names = new ArrayList<>();
         names.addAll( cacheNames );
         return names;
     }
@@ -378,7 +378,7 @@ public class UDPDiscoveryService
      */
     public Set<IDiscoveryListener> getCopyOfDiscoveryListeners()
     {
-        Set<IDiscoveryListener> copy = new HashSet<IDiscoveryListener>();
+        Set<IDiscoveryListener> copy = new HashSet<>();
         copy.addAll( getDiscoveryListeners() );
         return copy;
     }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java
index 3eb7cb8..6b1f374 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java
@@ -89,7 +89,7 @@ public class SerializationConversionUtil
                 throw new IOException( "Could not serialize object.  The ElementSerializer is null." );
             }
         }
-        ICacheElementSerialized<K, V> serialized = new CacheElementSerialized<K, V>(
+        ICacheElementSerialized<K, V> serialized = new CacheElementSerialized<>(
                 element.getCacheName(), element.getKey(), serializedValue, element.getElementAttributes() );
 
         return serialized;
@@ -142,7 +142,7 @@ public class SerializationConversionUtil
             // we could just use the default.
             log.warn( "ElementSerializer is null.  Could not serialize object." );
         }
-        ICacheElement<K, V> deSerialized = new CacheElement<K, V>( serialized.getCacheName(), serialized.getKey(), deSerializedValue );
+        ICacheElement<K, V> deSerialized = new CacheElement<>( serialized.getCacheName(), serialized.getKey(), deSerializedValue );
         deSerialized.setElementAttributes( serialized.getElementAttributes() );
 
         return deSerialized;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
index c069a6c..becb4bb 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
@@ -62,11 +62,11 @@ public abstract class AbstractLRUMap<K, V>
      */
     public AbstractLRUMap()
     {
-        list = new DoubleLinkedList<LRUElementDescriptor<K, V>>();
+        list = new DoubleLinkedList<>();
 
         // normal hashtable is faster for
         // sequential keys.
-        map = new ConcurrentHashMap<K, LRUElementDescriptor<K, V>>();
+        map = new ConcurrentHashMap<>();
     }
 
 
@@ -278,7 +278,7 @@ public abstract class AbstractLRUMap<K, V>
         putCnt++;
 
         LRUElementDescriptor<K, V> old = null;
-        LRUElementDescriptor<K, V> me = new LRUElementDescriptor<K, V>(key, value);
+        LRUElementDescriptor<K, V> me = new LRUElementDescriptor<>(key, value);
 
         lock.lock();
         try
@@ -490,13 +490,13 @@ public abstract class AbstractLRUMap<K, V>
         IStats stats = new Stats();
         stats.setTypeName( "LRUMap" );
 
-        ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
+        ArrayList<IStatElement<?>> elems = new ArrayList<>();
 
-        elems.add(new StatElement<Integer>( "List Size", Integer.valueOf(list.size()) ) );
-        elems.add(new StatElement<Integer>( "Map Size", Integer.valueOf(map.size()) ) );
-        elems.add(new StatElement<Long>( "Put Count", Long.valueOf(putCnt) ) );
-        elems.add(new StatElement<Long>( "Hit Count", Long.valueOf(hitCnt) ) );
-        elems.add(new StatElement<Long>( "Miss Count", Long.valueOf(missCnt) ) );
+        elems.add(new StatElement<>( "List Size", Integer.valueOf(list.size()) ) );
+        elems.add(new StatElement<>( "Map Size", Integer.valueOf(map.size()) ) );
+        elems.add(new StatElement<>( "Put Count", Long.valueOf(putCnt) ) );
+        elems.add(new StatElement<>( "Hit Count", Long.valueOf(hitCnt) ) );
+        elems.add(new StatElement<>( "Miss Count", Long.valueOf(missCnt) ) );
 
         stats.setStatElements( elems );
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java
index 40ab90c..34c5d1f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java
@@ -91,8 +91,8 @@ public class ThreadPoolManager
      */
     private ThreadPoolManager()
     {
-        this.pools = new ConcurrentHashMap<String, ExecutorService>();
-        this.schedulerPools = new ConcurrentHashMap<String, ScheduledExecutorService>();
+        this.pools = new ConcurrentHashMap<>();
+        this.schedulerPools = new ConcurrentHashMap<>();
         configure();
     }
 
@@ -126,7 +126,7 @@ public class ThreadPoolManager
                 log.debug( "Creating a Bounded Buffer to use for the pool" );
             }
 
-            queue = new LinkedBlockingQueue<Runnable>(config.getBoundarySize());
+            queue = new LinkedBlockingQueue<>(config.getBoundarySize());
         }
         else
         {
@@ -134,7 +134,7 @@ public class ThreadPoolManager
             {
                 log.debug( "Creating a non bounded Linked Queue to use for the pool" );
             }
-            queue = new LinkedBlockingQueue<Runnable>();
+            queue = new LinkedBlockingQueue<>();
         }
 
         ThreadPoolExecutor pool = new ThreadPoolExecutor(
@@ -295,7 +295,7 @@ public class ThreadPoolManager
      */
     public ArrayList<String> getPoolNames()
     {
-        return new ArrayList<String>(pools.keySet());
+        return new ArrayList<>(pools.keySet());
     }
 
     /**
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
index 7a1d7c2..0775fc0 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
@@ -37,7 +37,7 @@ import org.apache.commons.jcs.access.exception.CacheException;
  */
 public class JCSConcurrentCacheAccessUnitTest extends TestCase
 {
-    private final static int THREADS = 10;
+    private final static int THREADS = 20;
     private final static int LOOPS = 10000;
 
     /**
@@ -67,7 +67,7 @@ public class JCSConcurrentCacheAccessUnitTest extends TestCase
         JCS.setConfigFilename( "/TestJCS-73.ccf" );
         cache = JCS.getGroupCacheInstance( "cache" );
         errcount = new AtomicInteger(0);
-        valueMismatchList = Collections.synchronizedList(new ArrayList<String>());
+        valueMismatchList = Collections.synchronizedList(new ArrayList<>());
 	}
 
     @Override
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java
index 6b2ac3d..9fc85c0 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java
@@ -169,7 +169,7 @@ public class JCSThrashTest
         jcs.put( key, value );
 
         // Create 15 threads that read the keys;
-        final List<Executable> executables = new ArrayList<Executable>();
+        final List<Executable> executables = new ArrayList<>();
         for ( int i = 0; i < 15; i++ )
         {
             final JCSThrashTest.Executable executable = new JCSThrashTest.Executable()
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSUnitTest.java
index e945da4..9bf1c31 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSUnitTest.java
@@ -82,7 +82,7 @@ public class JCSUnitTest
      */
     private LinkedList<HashMap<String, String>> buildList()
     {
-        LinkedList<HashMap<String, String>> list = new LinkedList<HashMap<String,String>>();
+        LinkedList<HashMap<String, String>> list = new LinkedList<>();
 
         for ( int i = 0; i < 100; i++ )
         {
@@ -97,7 +97,7 @@ public class JCSUnitTest
      */
     private HashMap<String, String> buildMap()
     {
-        HashMap<String, String> map = new HashMap<String, String>();
+        HashMap<String, String> map = new HashMap<>();
 
         byte[] keyBytes = new byte[32];
         byte[] valBytes = new byte[128];
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java
index ee600ab..aab6627 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java
@@ -144,7 +144,7 @@ public class JCSvsHashtablePerformanceTest
 
                 // /////////////////////////////////////////////////////////////
                 name = "Hashtable";
-                Hashtable<String, String> cache2 = new Hashtable<String, String>();
+                Hashtable<String, String> cache2 = new Hashtable<>();
                 start = System.currentTimeMillis();
                 for ( int i = 0; i < tries; i++ )
                 {
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/access/CacheAccessUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/access/CacheAccessUnitTest.java
index 7e5b30a..2a508c1 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/access/CacheAccessUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/access/CacheAccessUnitTest.java
@@ -177,7 +177,7 @@ public class CacheAccessUnitTest
         access.put( keyTwo, valueTwo );
         access.put( keyThree, valueThree );
 
-        Set<String> input = new HashSet<String>();
+        Set<String> input = new HashSet<>();
         input.add( keyOne );
         input.add( keyTwo );
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java
index eee805e..f17d430 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java
@@ -80,7 +80,7 @@ public class MockAuxiliaryCache<K, V>
         throws IOException
     {
         getMatchingCallCount++;
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -93,7 +93,7 @@ public class MockAuxiliaryCache<K, V>
     @Override
     public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
     {
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java
index 2ae7c4f..26677e4 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java
@@ -44,7 +44,7 @@ public class MockAuxiliaryCacheFactory
         createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr,
            ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
-        MockAuxiliaryCache<K, V> auxCache = new MockAuxiliaryCache<K, V>();
+        MockAuxiliaryCache<K, V> auxCache = new MockAuxiliaryCache<>();
         auxCache.setCacheEventLogger( cacheEventLogger );
         auxCache.setElementSerializer( elementSerializer );
         return auxCache;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java
index 562e33a..e049ca0 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java
@@ -46,7 +46,7 @@ public class MockCacheEventLogger
     public int errorEventCalls = 0;
 
     /** list of messages */
-    public List<String> errorMessages = new ArrayList<String>();
+    public List<String> errorMessages = new ArrayList<>();
 
     /**
      * @param source
@@ -93,6 +93,6 @@ public class MockCacheEventLogger
             String eventName, String optionalDetails, T key )
     {
         startICacheEventCalls++;
-        return new CacheEvent<T>();
+        return new CacheEvent<>();
     }
 }
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
index efc9791..14f6445 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
@@ -56,12 +56,12 @@ public class AbstractDiskCacheUnitTest
         IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
         diskCacheAttributes.setCacheName( cacheName );
 
-        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
+        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<>( diskCacheAttributes );
 
         String key = "myKey";
         String value = "myValue";
         IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+        ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
 
         diskCache.update( cacheElement );
 
@@ -86,12 +86,12 @@ public class AbstractDiskCacheUnitTest
         IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
         diskCacheAttributes.setCacheName( cacheName );
 
-        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
+        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<>( diskCacheAttributes );
 
         String key = "myKey";
         String value = "myValue";
         IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+        ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
 
         diskCache.update( cacheElement );
 
@@ -118,13 +118,13 @@ public class AbstractDiskCacheUnitTest
         IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
         diskCacheAttributes.setAllowRemoveAll( false );
 
-        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
+        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<>( diskCacheAttributes );
 
         String cacheName = "testRemoveAll_notAllowed";
         String key = "myKey";
         String value = "myValue";
         IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+        ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
 
         diskCache.update( cacheElement );
 
@@ -149,13 +149,13 @@ public class AbstractDiskCacheUnitTest
         IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
         diskCacheAttributes.setAllowRemoveAll( true );
 
-        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
+        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<>( diskCacheAttributes );
 
         String cacheName = "testRemoveAll_allowed";
         String key = "myKey";
         String value = "myValue";
         IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+        ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
 
         diskCache.update( cacheElement );
 
@@ -171,7 +171,7 @@ public class AbstractDiskCacheUnitTest
         extends AbstractDiskCache<K, V>
     {
         /** Internal map */
-        protected Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K, V>>();
+        protected Map<K, ICacheElement<K, V>> map = new HashMap<>();
 
         /** used by the abstract aux class */
         protected IDiskCacheAttributes diskCacheAttributes;
@@ -207,7 +207,7 @@ public class AbstractDiskCacheUnitTest
         @Override
         public Set<K> getKeySet() throws IOException
         {
-            return new HashSet<K>(map.keySet());
+            return new HashSet<>(map.keySet());
         }
 
         /**
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java
index 55f41d8..5b937d2 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java
@@ -37,8 +37,8 @@ public class PurgatoryElementUnitTest
         String key = "myKey";
         String value = "myValue";
         IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
-        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
+        ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
+        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<>( cacheElement );
         purgatoryElement.setSpoolable( false );
 
         // DO WORK
@@ -57,8 +57,8 @@ public class PurgatoryElementUnitTest
         String value = "myValue";
         IElementAttributes elementAttributes = new ElementAttributes();
 
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value );
-        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
+        ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value );
+        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<>( cacheElement );
         purgatoryElement.setElementAttributes( elementAttributes );
 
         // DO WORK
@@ -76,8 +76,8 @@ public class PurgatoryElementUnitTest
         String key = "myKey";
         String value = "myValue";
         IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
-        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
+        ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
+        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<>( cacheElement );
 
         // DO WORK
         String result = purgatoryElement.toString();
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java
index 05969cf..1a4f4dc 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java
@@ -164,7 +164,7 @@ public class BlockDiskCacheConcurrentUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
@@ -225,7 +225,7 @@ public class BlockDiskCacheConcurrentUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = start; i <= end; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java
index a6d5f70..8e3da94 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java
@@ -70,8 +70,8 @@ public class BlockDiskCacheKeyStoreUnitTest
 
     private void innerTestPutKeys(BlockDiskCacheAttributes attributes)
     {
-        BlockDiskCache<String, String> blockDiskCache = new BlockDiskCache<String, String>(attributes);
-        BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<String>(attributes, blockDiskCache);
+        BlockDiskCache<String, String> blockDiskCache = new BlockDiskCache<>(attributes);
+        BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<>(attributes, blockDiskCache);
 
         // DO WORK
         int numElements = 100;
@@ -125,7 +125,7 @@ public class BlockDiskCacheKeyStoreUnitTest
 
     private void testSaveLoadKeysInner(BlockDiskCacheAttributes attributes)
     {
-        BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<String>(attributes, null);
+        BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<>(attributes, null);
 
         // DO WORK
         int numElements = 1000;
@@ -180,7 +180,7 @@ public class BlockDiskCacheKeyStoreUnitTest
         attributes.setDiskLimitType(DiskLimitType.SIZE);
 
         @SuppressWarnings({ "unchecked", "rawtypes" })
-        BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<String>(attributes, new BlockDiskCache(attributes));
+        BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<>(attributes, new BlockDiskCache(attributes));
 
         keyStore.put("1", new int[1000]);
         keyStore.put("2", new int[1000]);
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java
index ffca43e..1cb9656 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java
@@ -155,7 +155,7 @@ public class BlockDiskCacheSameRegionConcurrentUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = start; i <= end; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheUnitTestAbstract.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheUnitTestAbstract.java
index 7de0d2a..5254dbc 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheUnitTestAbstract.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheUnitTestAbstract.java
@@ -1,572 +1,572 @@
-package org.apache.commons.jcs.auxiliary.disk.block;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.ElementAttributes;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.IElementAttributes;
-import org.apache.commons.jcs.engine.control.group.GroupAttrName;
-import org.apache.commons.jcs.engine.control.group.GroupId;
-import org.apache.commons.jcs.utils.serialization.StandardSerializer;
-
-/** Unit tests for the Block Disk Cache */
-public abstract class BlockDiskCacheUnitTestAbstract extends TestCase
-{
-    public abstract BlockDiskCacheAttributes getCacheAttributes();
-
-    public void testPutGetMatching_SmallWait() throws Exception
-    {
-        // SETUP
-        int items = 200;
-
-        String cacheName = "testPutGetMatching_SmallWait";
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>(cattr);
-
-        // DO WORK
-        for (int i = 0; i <= items; i++)
-        {
-            diskCache.update(new CacheElement<String, String>(cacheName, i + ":key", cacheName + " data " + i));
-        }
-        Thread.sleep(500);
-
-        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
-
-        // VERIFY
-        assertEquals("Wrong number returned", 10, matchingResults.size());
-        // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() );
-        // System.out.println( "\nAFTER TEST \n" + diskCache.getStats() );
-    }
-
-    /**
-     * Test the basic get matching. With no wait this will all come from purgatory.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testPutGetMatching_NoWait() throws Exception
-    {
-        // SETUP
-        int items = 200;
-
-        String cacheName = "testPutGetMatching_NoWait";
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>(cattr);
-
-        // DO WORK
-        for (int i = 0; i <= items; i++)
-        {
-            diskCache.update(new CacheElement<String, String>(cacheName, i + ":key", cacheName + " data " + i));
-        }
-
-        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
-
-        // VERIFY
-        assertEquals("Wrong number returned", 10, matchingResults.size());
-        // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() );
-        // System.out.println( "\nAFTER TEST \n" + diskCache.getStats() );
-    }
-
-    /**
-     * Verify that the block disk cache can handle a big string.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testChunk_BigString() throws Exception
-    {
-        String string = "This is my big string ABCDEFGH";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append("|" + i + ":" + sb.toString()); // big string
-        }
-        string = sb.toString();
-
-        StandardSerializer elementSerializer = new StandardSerializer();
-        byte[] data = elementSerializer.serialize(string);
-
-        File file = new File("target/test-sandbox/BlockDiskCacheUnitTest/testChunk_BigString.data");
-
-        BlockDisk blockDisk = new BlockDisk(file, 200, elementSerializer);
-
-        int numBlocksNeeded = blockDisk.calculateTheNumberOfBlocksNeeded(data);
-        // System.out.println( numBlocksNeeded );
-
-        // get the individual sub arrays.
-        byte[][] chunks = blockDisk.getBlockChunks(data, numBlocksNeeded);
-
-        byte[] resultData = new byte[0];
-
-        for (short i = 0; i < chunks.length; i++)
-        {
-            byte[] chunk = chunks[i];
-            byte[] newTotal = new byte[data.length + chunk.length];
-            // copy data into the new array
-            System.arraycopy(data, 0, newTotal, 0, data.length);
-            // copy the chunk into the new array
-            System.arraycopy(chunk, 0, newTotal, data.length, chunk.length);
-            // swap the new and old.
-            resultData = newTotal;
-        }
-
-        Serializable result = elementSerializer.deSerialize(resultData, null);
-        // System.out.println( result );
-        assertEquals("wrong string after retrieval", string, result);
-    }
-
-    /**
-     * Verify that the block disk cache can handle a big string.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testPutGet_BigString() throws Exception
-    {
-        String string = "This is my big string ABCDEFGH";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append(" " + i + sb.toString()); // big string
-        }
-        string = sb.toString();
-
-        String cacheName = "testPutGet_BigString";
-
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setBlockSizeBytes(200);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>(cattr);
-
-        // DO WORK
-        diskCache.update(new CacheElement<String, String>(cacheName, "x", string));
-
-        // VERIFY
-        assertNotNull(diskCache.get("x"));
-        Thread.sleep(1000);
-        ICacheElement<String, String> afterElement = diskCache.get("x");
-        assertNotNull(afterElement);
-        // System.out.println( "afterElement = " + afterElement );
-        String after = afterElement.getVal();
-
-        assertNotNull(after);
-        assertEquals("wrong string after retrieval", string, after);
-    }
-
-    /**
-     * Verify that the block disk cache can handle utf encoded strings.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testUTF8String() throws Exception
-    {
-        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append(sb.toString()); // big string
-        }
-        string = sb.toString();
-
-        // System.out.println( "The string contains " + string.length() + " characters" );
-
-        String cacheName = "testUTF8String";
-
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setBlockSizeBytes(200);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>(cattr);
-
-        // DO WORK
-        diskCache.update(new CacheElement<String, String>(cacheName, "x", string));
-
-        // VERIFY
-        assertNotNull(diskCache.get("x"));
-        Thread.sleep(1000);
-        ICacheElement<String, String> afterElement = diskCache.get("x");
-        assertNotNull(afterElement);
-        // System.out.println( "afterElement = " + afterElement );
-        String after = afterElement.getVal();
-
-        assertNotNull(after);
-        assertEquals("wrong string after retrieval", string, after);
-    }
-
-    /**
-     * Verify that the block disk cache can handle utf encoded strings.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testUTF8ByteArray() throws Exception
-    {
-        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append(sb.toString()); // big string
-        }
-        string = sb.toString();
-        // System.out.println( "The string contains " + string.length() + " characters" );
-        String UTF8 = "UTF-8";
-        byte[] bytes = string.getBytes(UTF8);
-
-        String cacheName = "testUTF8ByteArray";
-
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setBlockSizeBytes(200);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, byte[]> diskCache = new BlockDiskCache<String, byte[]>(cattr);
-
-        // DO WORK
-        diskCache.update(new CacheElement<String, byte[]>(cacheName, "x", bytes));
-
-        // VERIFY
-        assertNotNull(diskCache.get("x"));
-        Thread.sleep(1000);
-        ICacheElement<String, byte[]> afterElement = diskCache.get("x");
-        assertNotNull(afterElement);
-        // System.out.println( "afterElement = " + afterElement );
-        byte[] after = afterElement.getVal();
-
-        assertNotNull(after);
-        assertEquals("wrong bytes after retrieval", bytes.length, after.length);
-        // assertEquals( "wrong bytes after retrieval", bytes, after );
-        // assertEquals( "wrong bytes after retrieval", string, new String( after, UTF8 ) );
-
-    }
-
-    /**
-     * Verify that the block disk cache can handle utf encoded strings.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testUTF8StringAndBytes() throws Exception
-    {
-        X before = new X();
-        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append(sb.toString()); // big string
-        }
-        string = sb.toString();
-        // System.out.println( "The string contains " + string.length() + " characters" );
-        String UTF8 = "UTF-8";
-        before.string = string;
-        before.bytes = string.getBytes(UTF8);
-
-        String cacheName = "testUTF8StringAndBytes";
-
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setBlockSizeBytes(500);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, X> diskCache = new BlockDiskCache<String, X>(cattr);
-
-        // DO WORK
-        diskCache.update(new CacheElement<String, X>(cacheName, "x", before));
-
-        // VERIFY
-        assertNotNull(diskCache.get("x"));
-        Thread.sleep(1000);
-        ICacheElement<String, X> afterElement = diskCache.get("x");
-        // System.out.println( "afterElement = " + afterElement );
-        X after = (afterElement.getVal());
-
-        assertNotNull(after);
-        assertEquals("wrong string after retrieval", string, after.string);
-        assertEquals("wrong bytes after retrieval", string, new String(after.bytes, UTF8));
-
-    }
-
-    public void testLoadFromDisk() throws Exception
-    {
-        for (int i = 0; i < 20; i++)
-        { // usually after 2 time it fails
-            oneLoadFromDisk();
-        }
-    }
-
-    public void testAppendToDisk() throws Exception
-    {
-        String cacheName = "testAppendToDisk";
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setBlockSizeBytes(500);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, X> diskCache = new BlockDiskCache<String, X>(cattr);
-        diskCache.removeAll();
-        X value1 = new X();
-        value1.string = "1234567890";
-        X value2 = new X();
-        value2.string = "0987654321";
-        diskCache.update(new CacheElement<String, X>(cacheName, "1", value1));
-        diskCache.dispose();
-        diskCache = new BlockDiskCache<String, X>(cattr);
-        diskCache.update(new CacheElement<String, X>(cacheName, "2", value2));
-        diskCache.dispose();
-        diskCache = new BlockDiskCache<String, X>(cattr);
-        assertTrue(diskCache.verifyDisk());
-        assertEquals(2, diskCache.getKeySet().size());
-        assertEquals(value1.string, diskCache.get("1").getVal().string);
-        assertEquals(value2.string, diskCache.get("2").getVal().string);
-    }
-
-    public void oneLoadFromDisk() throws Exception
-    {
-        // initialize object to be stored
-        X before = new X();
-        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append(sb.toString()); // big string
-        }
-        string = sb.toString();
-        String UTF8 = "UTF-8";
-        before.string = string;
-        before.bytes = string.getBytes(UTF8);
-
-        // initialize cache
-        String cacheName = "testLoadFromDisk";
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setBlockSizeBytes(500);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, X> diskCache = new BlockDiskCache<String, X>(cattr);
-
-        // DO WORK
-        for (int i = 0; i < 50; i++)
-        {
-            diskCache.update(new CacheElement<String, X>(cacheName, "x" + i, before));
-        }
-        diskCache.dispose();
-
-        // VERIFY
-        diskCache = new BlockDiskCache<String, X>(cattr);
-
-        for (int i = 0; i < 50; i++)
-        {
-            ICacheElement<String, X> afterElement = diskCache.get("x" + i);
-            assertNotNull("Missing element from cache. Cache size: " + diskCache.getSize() + " element: x" + i, afterElement);
-            X after = (afterElement.getVal());
-
-            assertNotNull(after);
-            assertEquals("wrong string after retrieval", string, after.string);
-            assertEquals("wrong bytes after retrieval", string, new String(after.bytes, UTF8));
-        }
-
-        diskCache.dispose();
-    }
-
-    /**
-     * Add some items to the disk cache and then remove them one by one.
-     *
-     * @throws IOException
-     */
-    public void testRemoveItems() throws IOException
-    {
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRemoveItems");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, String> disk = new BlockDiskCache<String, String>(cattr);
-
-        disk.processRemoveAll();
-
-        int cnt = 25;
-        for (int i = 0; i < cnt; i++)
-        {
-            IElementAttributes eAttr = new ElementAttributes();
-            eAttr.setIsSpool(true);
-            ICacheElement<String, String> element = new CacheElement<String, String>("testRemoveItems", "key:" + i, "data:" + i);
-            element.setElementAttributes(eAttr);
-            disk.processUpdate(element);
-        }
-
-        // remove each
-        for (int i = 0; i < cnt; i++)
-        {
-            disk.remove("key:" + i);
-            ICacheElement<String, String> element = disk.processGet("key:" + i);
-            assertNull("Should not have received an element.", element);
-        }
-    }
-
-    /**
-     * Add some items to the disk cache and then remove them one by one.
-     * <p>
-     *
-     * @throws IOException
-     */
-    public void testRemove_PartialKey() throws IOException
-    {
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRemove_PartialKey");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<String, String> disk = new BlockDiskCache<String, String>(cattr);
-
-        disk.processRemoveAll();
-
-        int cnt = 25;
-        for (int i = 0; i < cnt; i++)
-        {
-            IElementAttributes eAttr = new ElementAttributes();
-            eAttr.setIsSpool(true);
-            ICacheElement<String, String> element = new CacheElement<String, String>("testRemove_PartialKey", i + ":key", "data:"
-                + i);
-            element.setElementAttributes(eAttr);
-            disk.processUpdate(element);
-        }
-
-        // verify each
-        for (int i = 0; i < cnt; i++)
-        {
-            ICacheElement<String, String> element = disk.processGet(i + ":key");
-            assertNotNull("Shoulds have received an element.", element);
-        }
-
-        // remove each
-        for (int i = 0; i < cnt; i++)
-        {
-            disk.remove(i + ":");
-            ICacheElement<String, String> element = disk.processGet(i + ":key");
-            assertNull("Should not have received an element.", element);
-        }
-    }
-
-
-    /**
-     * Verify that group members are removed if we call remove with a group.
-     *
-     * @throws IOException
-     */
-    public void testRemove_Group() throws IOException
-    {
-        // SETUP
-        BlockDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRemove_Group");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        BlockDiskCache<GroupAttrName<String>, String> disk = new BlockDiskCache<GroupAttrName<String>, String>(cattr);
-
-        disk.processRemoveAll();
-
-        String cacheName = "testRemove_Group_Region";
-        String groupName = "testRemove_Group";
-
-        int cnt = 25;
-        for (int i = 0; i < cnt; i++)
-        {
-            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
-            CacheElement<GroupAttrName<String>, String> element = new CacheElement<GroupAttrName<String>, String>(cacheName,
-                groupAttrName, "data:" + i);
-
-            IElementAttributes eAttr = new ElementAttributes();
-            eAttr.setIsSpool(true);
-            element.setElementAttributes(eAttr);
-
-            disk.processUpdate(element);
-        }
-
-        // verify each
-        for (int i = 0; i < cnt; i++)
-        {
-            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
-            ICacheElement<GroupAttrName<String>, String> element = disk.processGet(groupAttrName);
-            assertNotNull("Should have received an element.", element);
-        }
-
-        // DO WORK
-        // remove the group
-        disk.remove(getGroupAttrName(cacheName, groupName, null));
-
-        for (int i = 0; i < cnt; i++)
-        {
-            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
-            ICacheElement<GroupAttrName<String>, String> element = disk.processGet(groupAttrName);
-
-            // VERIFY
-            assertNull("Should not have received an element.", element);
-        }
-
-    }
-
-    /**
-     * Internal method used for group functionality.
-     * <p>
-     *
-     * @param cacheName
-     * @param group
-     * @param name
-     * @return GroupAttrName
-     */
-    private GroupAttrName<String> getGroupAttrName(String cacheName, String group, String name)
-    {
-        GroupId gid = new GroupId(cacheName, group);
-        return new GroupAttrName<String>(gid, name);
-    }
-
-    /** Holder for a string and byte array. */
-    static class X implements Serializable
-    {
-        /** ignore */
-        private static final long serialVersionUID = 1L;
-
-        /** Test string */
-        String string;
-
-        /*** test byte array. */
-        byte[] bytes;
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk.block;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.ElementAttributes;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.IElementAttributes;
+import org.apache.commons.jcs.engine.control.group.GroupAttrName;
+import org.apache.commons.jcs.engine.control.group.GroupId;
+import org.apache.commons.jcs.utils.serialization.StandardSerializer;
+
+/** Unit tests for the Block Disk Cache */
+public abstract class BlockDiskCacheUnitTestAbstract extends TestCase
+{
+    public abstract BlockDiskCacheAttributes getCacheAttributes();
+
+    public void testPutGetMatching_SmallWait() throws Exception
+    {
+        // SETUP
+        int items = 200;
+
+        String cacheName = "testPutGetMatching_SmallWait";
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, String> diskCache = new BlockDiskCache<>(cattr);
+
+        // DO WORK
+        for (int i = 0; i <= items; i++)
+        {
+            diskCache.update(new CacheElement<>(cacheName, i + ":key", cacheName + " data " + i));
+        }
+        Thread.sleep(500);
+
+        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
+
+        // VERIFY
+        assertEquals("Wrong number returned", 10, matchingResults.size());
+        // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() );
+        // System.out.println( "\nAFTER TEST \n" + diskCache.getStats() );
+    }
+
+    /**
+     * Test the basic get matching. With no wait this will all come from purgatory.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testPutGetMatching_NoWait() throws Exception
+    {
+        // SETUP
+        int items = 200;
+
+        String cacheName = "testPutGetMatching_NoWait";
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, String> diskCache = new BlockDiskCache<>(cattr);
+
+        // DO WORK
+        for (int i = 0; i <= items; i++)
+        {
+            diskCache.update(new CacheElement<>(cacheName, i + ":key", cacheName + " data " + i));
+        }
+
+        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
+
+        // VERIFY
+        assertEquals("Wrong number returned", 10, matchingResults.size());
+        // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() );
+        // System.out.println( "\nAFTER TEST \n" + diskCache.getStats() );
+    }
+
+    /**
+     * Verify that the block disk cache can handle a big string.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testChunk_BigString() throws Exception
+    {
+        String string = "This is my big string ABCDEFGH";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append("|" + i + ":" + sb.toString()); // big string
+        }
+        string = sb.toString();
+
+        StandardSerializer elementSerializer = new StandardSerializer();
+        byte[] data = elementSerializer.serialize(string);
+
+        File file = new File("target/test-sandbox/BlockDiskCacheUnitTest/testChunk_BigString.data");
+
+        BlockDisk blockDisk = new BlockDisk(file, 200, elementSerializer);
+
+        int numBlocksNeeded = blockDisk.calculateTheNumberOfBlocksNeeded(data);
+        // System.out.println( numBlocksNeeded );
+
+        // get the individual sub arrays.
+        byte[][] chunks = blockDisk.getBlockChunks(data, numBlocksNeeded);
+
+        byte[] resultData = new byte[0];
+
+        for (short i = 0; i < chunks.length; i++)
+        {
+            byte[] chunk = chunks[i];
+            byte[] newTotal = new byte[data.length + chunk.length];
+            // copy data into the new array
+            System.arraycopy(data, 0, newTotal, 0, data.length);
+            // copy the chunk into the new array
+            System.arraycopy(chunk, 0, newTotal, data.length, chunk.length);
+            // swap the new and old.
+            resultData = newTotal;
+        }
+
+        Serializable result = elementSerializer.deSerialize(resultData, null);
+        // System.out.println( result );
+        assertEquals("wrong string after retrieval", string, result);
+    }
+
+    /**
+     * Verify that the block disk cache can handle a big string.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testPutGet_BigString() throws Exception
+    {
+        String string = "This is my big string ABCDEFGH";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append(" " + i + sb.toString()); // big string
+        }
+        string = sb.toString();
+
+        String cacheName = "testPutGet_BigString";
+
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setBlockSizeBytes(200);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, String> diskCache = new BlockDiskCache<>(cattr);
+
+        // DO WORK
+        diskCache.update(new CacheElement<>(cacheName, "x", string));
+
+        // VERIFY
+        assertNotNull(diskCache.get("x"));
+        Thread.sleep(1000);
+        ICacheElement<String, String> afterElement = diskCache.get("x");
+        assertNotNull(afterElement);
+        // System.out.println( "afterElement = " + afterElement );
+        String after = afterElement.getVal();
+
+        assertNotNull(after);
+        assertEquals("wrong string after retrieval", string, after);
+    }
+
+    /**
+     * Verify that the block disk cache can handle utf encoded strings.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testUTF8String() throws Exception
+    {
+        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append(sb.toString()); // big string
+        }
+        string = sb.toString();
+
+        // System.out.println( "The string contains " + string.length() + " characters" );
+
+        String cacheName = "testUTF8String";
+
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setBlockSizeBytes(200);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, String> diskCache = new BlockDiskCache<>(cattr);
+
+        // DO WORK
+        diskCache.update(new CacheElement<>(cacheName, "x", string));
+
+        // VERIFY
+        assertNotNull(diskCache.get("x"));
+        Thread.sleep(1000);
+        ICacheElement<String, String> afterElement = diskCache.get("x");
+        assertNotNull(afterElement);
+        // System.out.println( "afterElement = " + afterElement );
+        String after = afterElement.getVal();
+
+        assertNotNull(after);
+        assertEquals("wrong string after retrieval", string, after);
+    }
+
+    /**
+     * Verify that the block disk cache can handle utf encoded strings.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testUTF8ByteArray() throws Exception
+    {
+        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append(sb.toString()); // big string
+        }
+        string = sb.toString();
+        // System.out.println( "The string contains " + string.length() + " characters" );
+        String UTF8 = "UTF-8";
+        byte[] bytes = string.getBytes(UTF8);
+
+        String cacheName = "testUTF8ByteArray";
+
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setBlockSizeBytes(200);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, byte[]> diskCache = new BlockDiskCache<>(cattr);
+
+        // DO WORK
+        diskCache.update(new CacheElement<>(cacheName, "x", bytes));
+
+        // VERIFY
+        assertNotNull(diskCache.get("x"));
+        Thread.sleep(1000);
+        ICacheElement<String, byte[]> afterElement = diskCache.get("x");
+        assertNotNull(afterElement);
+        // System.out.println( "afterElement = " + afterElement );
+        byte[] after = afterElement.getVal();
+
+        assertNotNull(after);
+        assertEquals("wrong bytes after retrieval", bytes.length, after.length);
+        // assertEquals( "wrong bytes after retrieval", bytes, after );
+        // assertEquals( "wrong bytes after retrieval", string, new String( after, UTF8 ) );
+
+    }
+
+    /**
+     * Verify that the block disk cache can handle utf encoded strings.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testUTF8StringAndBytes() throws Exception
+    {
+        X before = new X();
+        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append(sb.toString()); // big string
+        }
+        string = sb.toString();
+        // System.out.println( "The string contains " + string.length() + " characters" );
+        String UTF8 = "UTF-8";
+        before.string = string;
+        before.bytes = string.getBytes(UTF8);
+
+        String cacheName = "testUTF8StringAndBytes";
+
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setBlockSizeBytes(500);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, X> diskCache = new BlockDiskCache<>(cattr);
+
+        // DO WORK
+        diskCache.update(new CacheElement<>(cacheName, "x", before));
+
+        // VERIFY
+        assertNotNull(diskCache.get("x"));
+        Thread.sleep(1000);
+        ICacheElement<String, X> afterElement = diskCache.get("x");
+        // System.out.println( "afterElement = " + afterElement );
+        X after = (afterElement.getVal());
+
+        assertNotNull(after);
+        assertEquals("wrong string after retrieval", string, after.string);
+        assertEquals("wrong bytes after retrieval", string, new String(after.bytes, UTF8));
+
+    }
+
+    public void testLoadFromDisk() throws Exception
+    {
+        for (int i = 0; i < 20; i++)
+        { // usually after 2 time it fails
+            oneLoadFromDisk();
+        }
+    }
+
+    public void testAppendToDisk() throws Exception
+    {
+        String cacheName = "testAppendToDisk";
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setBlockSizeBytes(500);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, X> diskCache = new BlockDiskCache<>(cattr);
+        diskCache.removeAll();
+        X value1 = new X();
+        value1.string = "1234567890";
+        X value2 = new X();
+        value2.string = "0987654321";
+        diskCache.update(new CacheElement<>(cacheName, "1", value1));
+        diskCache.dispose();
+        diskCache = new BlockDiskCache<>(cattr);
+        diskCache.update(new CacheElement<>(cacheName, "2", value2));
+        diskCache.dispose();
+        diskCache = new BlockDiskCache<>(cattr);
+        assertTrue(diskCache.verifyDisk());
+        assertEquals(2, diskCache.getKeySet().size());
+        assertEquals(value1.string, diskCache.get("1").getVal().string);
+        assertEquals(value2.string, diskCache.get("2").getVal().string);
+    }
+
+    public void oneLoadFromDisk() throws Exception
+    {
+        // initialize object to be stored
+        X before = new X();
+        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append(sb.toString()); // big string
+        }
+        string = sb.toString();
+        String UTF8 = "UTF-8";
+        before.string = string;
+        before.bytes = string.getBytes(UTF8);
+
+        // initialize cache
+        String cacheName = "testLoadFromDisk";
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setBlockSizeBytes(500);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, X> diskCache = new BlockDiskCache<>(cattr);
+
+        // DO WORK
+        for (int i = 0; i < 50; i++)
+        {
+            diskCache.update(new CacheElement<>(cacheName, "x" + i, before));
+        }
+        diskCache.dispose();
+
+        // VERIFY
+        diskCache = new BlockDiskCache<>(cattr);
+
+        for (int i = 0; i < 50; i++)
+        {
+            ICacheElement<String, X> afterElement = diskCache.get("x" + i);
+            assertNotNull("Missing element from cache. Cache size: " + diskCache.getSize() + " element: x" + i, afterElement);
+            X after = (afterElement.getVal());
+
+            assertNotNull(after);
+            assertEquals("wrong string after retrieval", string, after.string);
+            assertEquals("wrong bytes after retrieval", string, new String(after.bytes, UTF8));
+        }
+
+        diskCache.dispose();
+    }
+
+    /**
+     * Add some items to the disk cache and then remove them one by one.
+     *
+     * @throws IOException
+     */
+    public void testRemoveItems() throws IOException
+    {
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemoveItems");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, String> disk = new BlockDiskCache<>(cattr);
+
+        disk.processRemoveAll();
+
+        int cnt = 25;
+        for (int i = 0; i < cnt; i++)
+        {
+            IElementAttributes eAttr = new ElementAttributes();
+            eAttr.setIsSpool(true);
+            ICacheElement<String, String> element = new CacheElement<>("testRemoveItems", "key:" + i, "data:" + i);
+            element.setElementAttributes(eAttr);
+            disk.processUpdate(element);
+        }
+
+        // remove each
+        for (int i = 0; i < cnt; i++)
+        {
+            disk.remove("key:" + i);
+            ICacheElement<String, String> element = disk.processGet("key:" + i);
+            assertNull("Should not have received an element.", element);
+        }
+    }
+
+    /**
+     * Add some items to the disk cache and then remove them one by one.
+     * <p>
+     *
+     * @throws IOException
+     */
+    public void testRemove_PartialKey() throws IOException
+    {
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemove_PartialKey");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<String, String> disk = new BlockDiskCache<>(cattr);
+
+        disk.processRemoveAll();
+
+        int cnt = 25;
+        for (int i = 0; i < cnt; i++)
+        {
+            IElementAttributes eAttr = new ElementAttributes();
+            eAttr.setIsSpool(true);
+            ICacheElement<String, String> element = new CacheElement<>("testRemove_PartialKey", i + ":key", "data:"
+                + i);
+            element.setElementAttributes(eAttr);
+            disk.processUpdate(element);
+        }
+
+        // verify each
+        for (int i = 0; i < cnt; i++)
+        {
+            ICacheElement<String, String> element = disk.processGet(i + ":key");
+            assertNotNull("Shoulds have received an element.", element);
+        }
+
+        // remove each
+        for (int i = 0; i < cnt; i++)
+        {
+            disk.remove(i + ":");
+            ICacheElement<String, String> element = disk.processGet(i + ":key");
+            assertNull("Should not have received an element.", element);
+        }
+    }
+
+
+    /**
+     * Verify that group members are removed if we call remove with a group.
+     *
+     * @throws IOException
+     */
+    public void testRemove_Group() throws IOException
+    {
+        // SETUP
+        BlockDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemove_Group");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        BlockDiskCache<GroupAttrName<String>, String> disk = new BlockDiskCache<>(cattr);
+
+        disk.processRemoveAll();
+
+        String cacheName = "testRemove_Group_Region";
+        String groupName = "testRemove_Group";
+
+        int cnt = 25;
+        for (int i = 0; i < cnt; i++)
+        {
+            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
+            CacheElement<GroupAttrName<String>, String> element = new CacheElement<>(cacheName,
+                groupAttrName, "data:" + i);
+
+            IElementAttributes eAttr = new ElementAttributes();
+            eAttr.setIsSpool(true);
+            element.setElementAttributes(eAttr);
+
+            disk.processUpdate(element);
+        }
+
+        // verify each
+        for (int i = 0; i < cnt; i++)
+        {
+            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
+            ICacheElement<GroupAttrName<String>, String> element = disk.processGet(groupAttrName);
+            assertNotNull("Should have received an element.", element);
+        }
+
+        // DO WORK
+        // remove the group
+        disk.remove(getGroupAttrName(cacheName, groupName, null));
+
+        for (int i = 0; i < cnt; i++)
+        {
+            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
+            ICacheElement<GroupAttrName<String>, String> element = disk.processGet(groupAttrName);
+
+            // VERIFY
+            assertNull("Should not have received an element.", element);
+        }
+
+    }
+
+    /**
+     * Internal method used for group functionality.
+     * <p>
+     *
+     * @param cacheName
+     * @param group
+     * @param name
+     * @return GroupAttrName
+     */
+    private GroupAttrName<String> getGroupAttrName(String cacheName, String group, String name)
+    {
+        GroupId gid = new GroupId(cacheName, group);
+        return new GroupAttrName<>(gid, name);
+    }
+
+    /** Holder for a string and byte array. */
+    static class X implements Serializable
+    {
+        /** ignore */
+        private static final long serialVersionUID = 1L;
+
+        /** Test string */
+        String string;
+
+        /*** test byte array. */
+        byte[] bytes;
+    }
+}
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
index 3cab3eb..336b101 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
@@ -53,7 +53,7 @@ public class BlockDiskElementDescriptorUnitTest
         // DO WORK
         for ( int i = 0; i < numElements; i++ )
         {
-            BlockDiskElementDescriptor<Integer> descriptor = new BlockDiskElementDescriptor<Integer>();
+            BlockDiskElementDescriptor<Integer> descriptor = new BlockDiskElementDescriptor<>();
             descriptor.setKey( Integer.valueOf( i ) );
             descriptor.setBlocks( new int[] { 1, 2 } );
             elements[i] = descriptor;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java
index 3021d1d..eca8864 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java
@@ -109,7 +109,7 @@ public class DiskTestObjectUtil
             int size = bytes * 1024;
             DiskTestObject tile = new DiskTestObject( Integer.valueOf( i ), new byte[size] );
 
-            ICacheElement<Integer, DiskTestObject> element = new CacheElement<Integer, DiskTestObject>( cacheName, tile.id, tile );
+            ICacheElement<Integer, DiskTestObject> element = new CacheElement<>( cacheName, tile.id, tile );
             elements[i] = element;
         }
         return elements;
@@ -134,7 +134,7 @@ public class DiskTestObjectUtil
             int size = ( bytes + 4 ) * 1024;
             DiskTestObject tile = new DiskTestObject( Integer.valueOf( i ), new byte[size] );
 
-            ICacheElement<Integer, DiskTestObject> element = new CacheElement<Integer, DiskTestObject>( cacheName, tile.id, tile );
+            ICacheElement<Integer, DiskTestObject> element = new CacheElement<>( cacheName, tile.id, tile );
             elements[i] = element;
         }
         return elements;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java
index db9ae10..ef8eea3 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java
@@ -1,109 +1,109 @@
-package org.apache.commons.jcs.auxiliary.disk.indexed;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes.DiskLimitType;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-
-public class IndexDiskCacheCountUnitTest extends IndexDiskCacheUnitTestAbstract {
-
-	@Override
-	public IndexedDiskCacheAttributes getCacheAttributes() {
-		IndexedDiskCacheAttributes ret = new IndexedDiskCacheAttributes();
-		ret.setDiskLimitType(DiskLimitType.COUNT);
-		return ret;
-	}
-	  public void testRecycleBin()
-		        throws IOException
-		    {
-		        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-		        cattr.setCacheName( "testRemoveItems" );
-		        cattr.setOptimizeAtRemoveCount( 7 );
-		        cattr.setMaxKeySize( 5 );
-		        cattr.setMaxPurgatorySize( 0 );
-		        cattr.setDiskPath( "target/test-sandbox/BreakIndexTest" );
-		        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
-
-		        String[] test = { "a", "bb", "ccc", "dddd", "eeeee", "ffffff", "ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
-		        String[] expect = { null, "bb", "ccc", null, null, "ffffff", null, "hhhhhhhhh", "iiiiiiiiii" };
-
-		        //System.out.println( "------------------------- testRecycleBin " );
-
-		        for ( int i = 0; i < 6; i++ )
-		        {
-		            ICacheElement<String, String> element = new CacheElement<String, String>( "testRecycleBin", "key:" + test[i], test[i] );
-		            //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
-		            disk.processUpdate( element );
-		        }
-
-		        for ( int i = 3; i < 5; i++ )
-		        {
-		            //System.out.println( "About to remove " + "key:" + test[i] + " i = " + i );
-		            disk.remove( "key:" + test[i] );
-		        }
-
-		        // there was a bug where 7 would try to be put in the empty slot left by 4's removal, but it
-		        // will not fit.
-		        for ( int i = 7; i < 9; i++ )
-		        {
-		            ICacheElement<String, String> element = new CacheElement<String, String>( "testRecycleBin", "key:" + test[i], test[i] );
-		            //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
-		            disk.processUpdate( element );
-		        }
-
-		        try
-		        {
-		            for ( int i = 0; i < 9; i++ )
-		            {
-		                ICacheElement<String, String> element = disk.get( "key:" + test[i] );
-		                if ( element != null )
-		                {
-		                    //System.out.println( "element = " + element.getVal() );
-		                }
-		                else
-		                {
-		                    //System.out.println( "null --" + "key:" + test[i] );
-		                }
-
-		                String expectedValue = expect[i];
-		                if ( expectedValue == null )
-		                {
-		                    assertNull( "Expected a null element", element );
-		                }
-		                else
-		                {
-		                    assertNotNull( "The element for key [" + "key:" + test[i] + "] should not be null. i = " + i,
-		                                   element );
-		                    assertEquals( "Elements contents do not match expected", element.getVal(), expectedValue );
-		                }
-		            }
-		        }
-		        catch ( Exception e )
-		        {
-		            e.printStackTrace();
-		            fail( "Should not get an exception: " + e.toString() );
-		        }
-
-		        disk.removeAll();
-		    }
-}
+package org.apache.commons.jcs.auxiliary.disk.indexed;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+
+import org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes.DiskLimitType;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+
+public class IndexDiskCacheCountUnitTest extends IndexDiskCacheUnitTestAbstract {
+
+	@Override
+	public IndexedDiskCacheAttributes getCacheAttributes() {
+		IndexedDiskCacheAttributes ret = new IndexedDiskCacheAttributes();
+		ret.setDiskLimitType(DiskLimitType.COUNT);
+		return ret;
+	}
+	  public void testRecycleBin()
+		        throws IOException
+		    {
+		        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+		        cattr.setCacheName( "testRemoveItems" );
+		        cattr.setOptimizeAtRemoveCount( 7 );
+		        cattr.setMaxKeySize( 5 );
+		        cattr.setMaxPurgatorySize( 0 );
+		        cattr.setDiskPath( "target/test-sandbox/BreakIndexTest" );
+		        IndexedDiskCache<String, String> disk = new IndexedDiskCache<>( cattr );
+
+		        String[] test = { "a", "bb", "ccc", "dddd", "eeeee", "ffffff", "ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
+		        String[] expect = { null, "bb", "ccc", null, null, "ffffff", null, "hhhhhhhhh", "iiiiiiiiii" };
+
+		        //System.out.println( "------------------------- testRecycleBin " );
+
+		        for ( int i = 0; i < 6; i++ )
+		        {
+		            ICacheElement<String, String> element = new CacheElement<>( "testRecycleBin", "key:" + test[i], test[i] );
+		            //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
+		            disk.processUpdate( element );
+		        }
+
+		        for ( int i = 3; i < 5; i++ )
+		        {
+		            //System.out.println( "About to remove " + "key:" + test[i] + " i = " + i );
+		            disk.remove( "key:" + test[i] );
+		        }
+
+		        // there was a bug where 7 would try to be put in the empty slot left by 4's removal, but it
+		        // will not fit.
+		        for ( int i = 7; i < 9; i++ )
+		        {
+		            ICacheElement<String, String> element = new CacheElement<>( "testRecycleBin", "key:" + test[i], test[i] );
+		            //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
+		            disk.processUpdate( element );
+		        }
+
+		        try
+		        {
+		            for ( int i = 0; i < 9; i++ )
+		            {
+		                ICacheElement<String, String> element = disk.get( "key:" + test[i] );
+		                if ( element != null )
+		                {
+		                    //System.out.println( "element = " + element.getVal() );
+		                }
+		                else
+		                {
+		                    //System.out.println( "null --" + "key:" + test[i] );
+		                }
+
+		                String expectedValue = expect[i];
+		                if ( expectedValue == null )
+		                {
+		                    assertNull( "Expected a null element", element );
+		                }
+		                else
+		                {
+		                    assertNotNull( "The element for key [" + "key:" + test[i] + "] should not be null. i = " + i,
+		                                   element );
+		                    assertEquals( "Elements contents do not match expected", element.getVal(), expectedValue );
+		                }
+		            }
+		        }
+		        catch ( Exception e )
+		        {
+		            e.printStackTrace();
+		            fail( "Should not get an exception: " + e.toString() );
+		        }
+
+		        disk.removeAll();
+		    }
+}
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
index 66975c6..1a3456b 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
@@ -1,110 +1,110 @@
-package org.apache.commons.jcs.auxiliary.disk.indexed;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import org.apache.commons.jcs.auxiliary.disk.DiskTestObject;
-import org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes.DiskLimitType;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-
-public class IndexDiskCacheSizeUnitTest extends IndexDiskCacheUnitTestAbstract {
-
-	@Override
-	public IndexedDiskCacheAttributes getCacheAttributes() {
-		IndexedDiskCacheAttributes ret = new IndexedDiskCacheAttributes();
-		ret.setDiskLimitType(DiskLimitType.SIZE);
-		return ret;
-	}
-	  public void testRecycleBin()
-		        throws IOException
-		    {
-		        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-		        cattr.setCacheName( "testRemoveItems" );
-		        cattr.setOptimizeAtRemoveCount( 7 );
-		        cattr.setMaxKeySize( 8); // 1kb DiskTestObject takes 1420 bytes, so 5*1420 = 7100, so to keep 5 ojbects, we need max key size of 8
-		        cattr.setMaxPurgatorySize( 0 );
-		        cattr.setDiskPath( "target/test-sandbox/BreakIndexTest" );
-		        IndexedDiskCache<String, DiskTestObject> disk = new IndexedDiskCache<String, DiskTestObject>( cattr );
-
-		        String[] test = { "a", "bb", "ccc", "dddd", "eeeee", "ffffff", "ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
-		        String[] expect = { null, "bb", "ccc", null, null, "ffffff", null, "hhhhhhhhh", "iiiiiiiiii" };
-		        DiskTestObject value = DiskTestObjectUtil.createCacheElementsWithTestObjects( 1, 1, cattr .getCacheName())[0].getVal();
-		        //System.out.println( "------------------------- testRecycleBin " );
-
-		        for ( int i = 0; i < 6; i++ )
-		        {
-		            ICacheElement<String, DiskTestObject> element = new CacheElement<String, DiskTestObject>( "testRecycleBin", "key:" + test[i], value);
-		            //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
-		            disk.processUpdate( element );
-		        }
-
-		        for ( int i = 3; i < 5; i++ )
-		        {
-		            //System.out.println( "About to remove " + "key:" + test[i] + " i = " + i );
-		            disk.remove( "key:" + test[i] );
-		        }
-
-		        // there was a bug where 7 would try to be put in the empty slot left by 4's removal, but it
-		        // will not fit.
-		        for ( int i = 7; i < 9; i++ )
-		        {
-		            ICacheElement<String, DiskTestObject> element = new CacheElement<String, DiskTestObject>( "testRecycleBin", "key:" + test[i], value);
-		            //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
-		            disk.processUpdate( element );
-		        }
-
-		        try
-		        {
-		            for ( int i = 0; i < 9; i++ )
-		            {
-		                ICacheElement<String, DiskTestObject> element = disk.get( "key:" + test[i] );
-		                if ( element != null )
-		                {
-		                    //System.out.println( "element = " + element.getVal() );
-		                }
-		                else
-		                {
-		                    //System.out.println( "null --" + "key:" + test[i] );
-		                }
-
-		                String expectedValue = expect[i];
-		                if ( expectedValue == null )
-		                {
-		                    assertNull( "Expected a null element", element );
-		                }
-		                else
-		                {
-		                    assertNotNull( "The element for key [" + "key:" + test[i] + "] should not be null. i = " + i,
-		                                   element );
-		                    assertEquals( "Elements contents do not match expected", element.getVal(), value );
-		                }
-		            }
-		        }
-		        catch ( Exception e )
-		        {
-		            e.printStackTrace();
-		            fail( "Should not get an exception: " + e.toString() );
-		        }
-
-		        disk.removeAll();
-		    }
-}
+package org.apache.commons.jcs.auxiliary.disk.indexed;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+
+import org.apache.commons.jcs.auxiliary.disk.DiskTestObject;
+import org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes.DiskLimitType;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+
+public class IndexDiskCacheSizeUnitTest extends IndexDiskCacheUnitTestAbstract {
+
+	@Override
+	public IndexedDiskCacheAttributes getCacheAttributes() {
+		IndexedDiskCacheAttributes ret = new IndexedDiskCacheAttributes();
+		ret.setDiskLimitType(DiskLimitType.SIZE);
+		return ret;
+	}
+	  public void testRecycleBin()
+		        throws IOException
+		    {
+		        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+		        cattr.setCacheName( "testRemoveItems" );
+		        cattr.setOptimizeAtRemoveCount( 7 );
+		        cattr.setMaxKeySize( 8); // 1kb DiskTestObject takes 1420 bytes, so 5*1420 = 7100, so to keep 5 ojbects, we need max key size of 8
+		        cattr.setMaxPurgatorySize( 0 );
+		        cattr.setDiskPath( "target/test-sandbox/BreakIndexTest" );
+		        IndexedDiskCache<String, DiskTestObject> disk = new IndexedDiskCache<>( cattr );
+
+		        String[] test = { "a", "bb", "ccc", "dddd", "eeeee", "ffffff", "ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
+		        String[] expect = { null, "bb", "ccc", null, null, "ffffff", null, "hhhhhhhhh", "iiiiiiiiii" };
+		        DiskTestObject value = DiskTestObjectUtil.createCacheElementsWithTestObjects( 1, 1, cattr .getCacheName())[0].getVal();
+		        //System.out.println( "------------------------- testRecycleBin " );
+
+		        for ( int i = 0; i < 6; i++ )
+		        {
+		            ICacheElement<String, DiskTestObject> element = new CacheElement<>( "testRecycleBin", "key:" + test[i], value);
+		            //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
+		            disk.processUpdate( element );
+		        }
+
+		        for ( int i = 3; i < 5; i++ )
+		        {
+		            //System.out.println( "About to remove " + "key:" + test[i] + " i = " + i );
+		            disk.remove( "key:" + test[i] );
+		        }
+
+		        // there was a bug where 7 would try to be put in the empty slot left by 4's removal, but it
+		        // will not fit.
+		        for ( int i = 7; i < 9; i++ )
+		        {
+		            ICacheElement<String, DiskTestObject> element = new CacheElement<>( "testRecycleBin", "key:" + test[i], value);
+		            //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
+		            disk.processUpdate( element );
+		        }
+
+		        try
+		        {
+		            for ( int i = 0; i < 9; i++ )
+		            {
+		                ICacheElement<String, DiskTestObject> element = disk.get( "key:" + test[i] );
+		                if ( element != null )
+		                {
+		                    //System.out.println( "element = " + element.getVal() );
+		                }
+		                else
+		                {
+		                    //System.out.println( "null --" + "key:" + test[i] );
+		                }
+
+		                String expectedValue = expect[i];
+		                if ( expectedValue == null )
+		                {
+		                    assertNull( "Expected a null element", element );
+		                }
+		                else
+		                {
+		                    assertNotNull( "The element for key [" + "key:" + test[i] + "] should not be null. i = " + i,
+		                                   element );
+		                    assertEquals( "Elements contents do not match expected", element.getVal(), value );
+		                }
+		            }
+		        }
+		        catch ( Exception e )
+		        {
+		            e.printStackTrace();
+		            fail( "Should not get an exception: " + e.toString() );
+		        }
+
+		        disk.removeAll();
+		    }
+}
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTestAbstract.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTestAbstract.java
index f6fc6df..da4f5b3 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTestAbstract.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTestAbstract.java
@@ -1,989 +1,989 @@
-package org.apache.commons.jcs.auxiliary.disk.indexed;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.jcs.auxiliary.MockCacheEventLogger;
-import org.apache.commons.jcs.auxiliary.disk.DiskTestObject;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.ElementAttributes;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.IElementAttributes;
-import org.apache.commons.jcs.engine.control.group.GroupAttrName;
-import org.apache.commons.jcs.engine.control.group.GroupId;
-import org.apache.commons.jcs.utils.timing.SleepUtil;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for common functionality.
- * <p>
- *
- * @author Aaron Smuts
- */
-public abstract class IndexDiskCacheUnitTestAbstract extends TestCase
-{
-    public abstract IndexedDiskCacheAttributes getCacheAttributes();
-
-    /**
-     * Simply verify that we can put items in the disk cache and retrieve them.
-     *
-     * @throws IOException
-     */
-    public void testSimplePutAndGet() throws IOException
-    {
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testSimplePutAndGet");
-        cattr.setMaxKeySize(1000);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>(cattr);
-
-        disk.processRemoveAll();
-
-        int cnt = 999;
-        for (int i = 0; i < cnt; i++)
-        {
-            IElementAttributes eAttr = new ElementAttributes();
-            eAttr.setIsSpool(true);
-            ICacheElement<String, String> element = new CacheElement<String, String>("testSimplePutAndGet", "key:" + i, "data:" + i);
-            element.setElementAttributes(eAttr);
-            disk.processUpdate(element);
-        }
-
-        for (int i = 0; i < cnt; i++)
-        {
-            ICacheElement<String, String> element = disk.processGet("key:" + i);
-            assertNotNull("Should have received an element.", element);
-            assertEquals("Element is wrong.", "data:" + i, element.getVal());
-        }
-
-        // Test that getMultiple returns all the expected values
-        Set<String> keys = new HashSet<String>();
-        for (int i = 0; i < cnt; i++)
-        {
-            keys.add("key:" + i);
-        }
-
-        Map<String, ICacheElement<String, String>> elements = disk.getMultiple(keys);
-        for (int i = 0; i < cnt; i++)
-        {
-            ICacheElement<String, String> element = elements.get("key:" + i);
-            assertNotNull("element " + i + ":key is missing", element);
-            assertEquals("value key:" + i, "data:" + i, element.getVal());
-        }
-        // System.out.println( disk.getStats() );
-    }
-
-    /**
-     * Add some items to the disk cache and then remove them one by one.
-     *
-     * @throws IOException
-     */
-    public void testRemoveItems() throws IOException
-    {
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRemoveItems");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>(cattr);
-
-        disk.processRemoveAll();
-
-        int cnt = 25;
-        for (int i = 0; i < cnt; i++)
-        {
-            IElementAttributes eAttr = new ElementAttributes();
-            eAttr.setIsSpool(true);
-            ICacheElement<String, String> element = new CacheElement<String, String>("testRemoveItems", "key:" + i, "data:" + i);
-            element.setElementAttributes(eAttr);
-            disk.processUpdate(element);
-        }
-
-        // remove each
-        for (int i = 0; i < cnt; i++)
-        {
-            disk.remove("key:" + i);
-            ICacheElement<String, String> element = disk.processGet("key:" + i);
-            assertNull("Should not have received an element.", element);
-        }
-    }
-
-    /**
-     * Verify that we don't override the largest item.
-     * <p>
-     *
-     * @throws IOException
-     */
-
-    /**
-     * Verify that the overlap check returns true when there are no overlaps.
-     */
-    public void testCheckForDedOverlaps_noOverlap()
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testCheckForDedOverlaps_noOverlap");
-        cattr.setDiskPath("target/test-sandbox/UnitTest");
-        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>(cattr);
-
-        int numDescriptors = 5;
-        int pos = 0;
-        IndexedDiskElementDescriptor[] sortedDescriptors = new IndexedDiskElementDescriptor[numDescriptors];
-        for (int i = 0; i < numDescriptors; i++)
-        {
-            IndexedDiskElementDescriptor descriptor = new IndexedDiskElementDescriptor(pos, i * 2);
-            pos = pos + (i * 2) + IndexedDisk.HEADER_SIZE_BYTES;
-            sortedDescriptors[i] = descriptor;
-        }
-
-        // DO WORK
-        boolean result = disk.checkForDedOverlaps(sortedDescriptors);
-
-        // VERIFY
-        assertTrue("There should be no overlap. it should be ok", result);
-    }
-
-    /**
-     * Verify that the overlap check returns false when there are overlaps.
-     */
-    public void testCheckForDedOverlaps_overlaps()
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testCheckForDedOverlaps_overlaps");
-        cattr.setDiskPath("target/test-sandbox/UnitTest");
-        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>(cattr);
-
-        int numDescriptors = 5;
-        int pos = 0;
-        IndexedDiskElementDescriptor[] sortedDescriptors = new IndexedDiskElementDescriptor[numDescriptors];
-        for (int i = 0; i < numDescriptors; i++)
-        {
-            IndexedDiskElementDescriptor descriptor = new IndexedDiskElementDescriptor(pos, i * 2);
-            // don't add the header + IndexedDisk.RECORD_HEADER;
-            pos = pos + (i * 2);
-            sortedDescriptors[i] = descriptor;
-        }
-
-        // DO WORK
-        boolean result = disk.checkForDedOverlaps(sortedDescriptors);
-
-        // VERIFY
-        assertFalse("There should be overlaps. it should be not ok", result);
-    }
-
-    /**
-     * Verify that the file size is as expected.
-     * <p>
-     *
-     * @throws IOException
-     * @throws InterruptedException
-     */
-    public void testFileSize() throws IOException, InterruptedException
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testFileSize");
-        cattr.setDiskPath("target/test-sandbox/UnitTest");
-        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>(cattr);
-
-        int numberToInsert = 20;
-        int bytes = 24;
-        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects(numberToInsert,
-            bytes, cattr.getCacheName());
-
-        for (int i = 0; i < elements.length; i++)
-        {
-            disk.processUpdate(elements[i]);
-        }
-
-        Thread.yield();
-        Thread.sleep(100);
-        Thread.yield();
-
-        long expectedSize = DiskTestObjectUtil.totalSize(elements, numberToInsert);
-        long resultSize = disk.getDataFileSize();
-
-        // System.out.println( "testFileSize stats " + disk.getStats() );
-
-        assertEquals("Wrong file size", expectedSize, resultSize);
-    }
-
-    /**
-     * Verify that items are added to the recycle bin on removal.
-     * <p>
-     *
-     * @throws IOException
-     * @throws InterruptedException
-     */
-    public void testRecyleBinSize() throws IOException, InterruptedException
-    {
-        // SETUP
-        int numberToInsert = 20;
-
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRecyleBinSize");
-        cattr.setDiskPath("target/test-sandbox/UnitTest");
-        cattr.setOptimizeAtRemoveCount(numberToInsert);
-        cattr.setMaxKeySize(numberToInsert * 2);
-        cattr.setMaxPurgatorySize(numberToInsert);
-        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>(cattr);
-
-        int bytes = 1;
-        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects(numberToInsert,
-            bytes, cattr.getCacheName());
-
-        for (int i = 0; i < elements.length; i++)
-        {
-            disk.processUpdate(elements[i]);
-        }
-
-        Thread.yield();
-        Thread.sleep(100);
-        Thread.yield();
-
-        // remove half
-        int numberToRemove = elements.length / 2;
-        for (int i = 0; i < numberToRemove; i++)
-        {
-            disk.processRemove(elements[i].getKey());
-        }
-
-        // verify that the recycle bin has the correct amount.
-        assertEquals("The recycle bin should have the number removed.", numberToRemove, disk.getRecyleBinSize());
-    }
-
-    /**
-     * Verify that items of the same size use recycle bin spots. Setup the recycle bin by removing
-     * some items. Add some of the same size. Verify that the recycle count is the number added.
-     * <p>
-     *
-     * @throws IOException
-     * @throws InterruptedException
-     */
-    public void testRecyleBinUsage() throws IOException, InterruptedException
-    {
-        // SETUP
-        int numberToInsert = 20;
-
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRecyleBinUsage");
-        cattr.setDiskPath("target/test-sandbox/UnitTest");
-        cattr.setOptimizeAtRemoveCount(numberToInsert);
-        cattr.setMaxKeySize(numberToInsert * 2);
-        cattr.setMaxPurgatorySize(numberToInsert);
-        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>(cattr);
-
-        // we will reuse these
-        int bytes = 1;
-        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects(numberToInsert,
-            bytes, cattr.getCacheName());
-
-        // Add some to the disk
-        for (int i = 0; i < elements.length; i++)
-        {
-            disk.processUpdate(elements[i]);
-        }
-
-        Thread.yield();
-        Thread.sleep(100);
-        Thread.yield();
-
-        // remove half of those added
-        int numberToRemove = elements.length / 2;
-        for (int i = 0; i < numberToRemove; i++)
-        {
-            disk.processRemove(elements[i].getKey());
-        }
-
-        // verify that the recycle bin has the correct amount.
-        assertEquals("The recycle bin should have the number removed.", numberToRemove, disk.getRecyleBinSize());
-
-        // add half as many as we removed. These should all use spots in the recycle bin.
-        int numberToAdd = numberToRemove / 2;
-        for (int i = 0; i < numberToAdd; i++)
-        {
-            disk.processUpdate(elements[i]);
-        }
-
-        // verify that we used the correct number of spots
-        assertEquals("The recycle bin should have the number removed." + disk.getStats(), numberToAdd, disk.getRecyleCount());
-    }
-
-    /**
-     * Verify that the data size is as expected after a remove and after a put that should use the
-     * spots.
-     * <p>
-     *
-     * @throws IOException
-     * @throws InterruptedException
-     */
-    public void testBytesFreeSize() throws IOException, InterruptedException
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testBytesFreeSize");
-        cattr.setDiskPath("target/test-sandbox/UnitTest");
-        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>(cattr);
-
-        int numberToInsert = 20;
-        int bytes = 24;
-        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects(numberToInsert,
-            bytes, cattr.getCacheName());
-
-        for (int i = 0; i < elements.length; i++)
-        {
-            disk.processUpdate(elements[i]);
-        }
-
-        Thread.yield();
-        Thread.sleep(100);
-        Thread.yield();
-
-        // remove half of those added
-        int numberToRemove = elements.length / 2;
-        for (int i = 0; i < numberToRemove; i++)
-        {
-            disk.processRemove(elements[i].getKey());
-        }
-
-        long expectedSize = DiskTestObjectUtil.totalSize(elements, numberToRemove);
-        long resultSize = disk.getBytesFree();
-
-        // System.out.println( "testBytesFreeSize stats " + disk.getStats() );
-
-        assertEquals("Wrong bytes free size" + disk.getStats(), expectedSize, resultSize);
-
-        // add half as many as we removed. These should all use spots in the recycle bin.
-        int numberToAdd = numberToRemove / 2;
-        for (int i = 0; i < numberToAdd; i++)
-        {
-            disk.processUpdate(elements[i]);
-        }
-
-        long expectedSize2 = DiskTestObjectUtil.totalSize(elements, numberToAdd);
-        long resultSize2 = disk.getBytesFree();
-        assertEquals("Wrong bytes free size" + disk.getStats(), expectedSize2, resultSize2);
-    }
-
-    /**
-     * Add some items to the disk cache and then remove them one by one.
-     * <p>
-     *
-     * @throws IOException
-     */
-    public void testRemove_PartialKey() throws IOException
-    {
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRemove_PartialKey");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>(cattr);
-
-        disk.processRemoveAll();
-
-        int cnt = 25;
-        for (int i = 0; i < cnt; i++)
-        {
-            IElementAttributes eAttr = new ElementAttributes();
-            eAttr.setIsSpool(true);
-            ICacheElement<String, String> element = new CacheElement<String, String>("testRemove_PartialKey", i + ":key", "data:"
-                + i);
-            element.setElementAttributes(eAttr);
-            disk.processUpdate(element);
-        }
-
-        // verif each
-        for (int i = 0; i < cnt; i++)
-        {
-            ICacheElement<String, String> element = disk.processGet(i + ":key");
-            assertNotNull("Shoulds have received an element.", element);
-        }
-
-        // remove each
-        for (int i = 0; i < cnt; i++)
-        {
-            disk.remove(i + ":");
-            ICacheElement<String, String> element = disk.processGet(i + ":key");
-            assertNull("Should not have received an element.", element);
-        }
-        // https://issues.apache.org/jira/browse/JCS-67
-        assertEquals("Recylenbin should not have more elements than we removed. Check for JCS-67", cnt, disk.getRecyleBinSize());
-    }
-
-    /**
-     * Verify that group members are removed if we call remove with a group.
-     *
-     * @throws IOException
-     */
-    public void testRemove_Group() throws IOException
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRemove_Group");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<GroupAttrName<String>, String> disk = new IndexedDiskCache<GroupAttrName<String>, String>(cattr);
-
-        disk.processRemoveAll();
-
-        String cacheName = "testRemove_Group_Region";
-        String groupName = "testRemove_Group";
-
-        int cnt = 25;
-        for (int i = 0; i < cnt; i++)
-        {
-            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
-            CacheElement<GroupAttrName<String>, String> element = new CacheElement<GroupAttrName<String>, String>(cacheName,
-                groupAttrName, "data:" + i);
-
-            IElementAttributes eAttr = new ElementAttributes();
-            eAttr.setIsSpool(true);
-            element.setElementAttributes(eAttr);
-
-            disk.processUpdate(element);
-        }
-
-        // verify each
-        for (int i = 0; i < cnt; i++)
-        {
-            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
-            ICacheElement<GroupAttrName<String>, String> element = disk.processGet(groupAttrName);
-            assertNotNull("Should have received an element.", element);
-        }
-
-        // DO WORK
-        // remove the group
-        disk.remove(getGroupAttrName(cacheName, groupName, null));
-
-        for (int i = 0; i < cnt; i++)
-        {
-            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
-            ICacheElement<GroupAttrName<String>, String> element = disk.processGet(groupAttrName);
-
-            // VERIFY
-            assertNull("Should not have received an element.", element);
-        }
-
-    }
-
-    /**
-     * Internal method used for group functionality.
-     * <p>
-     *
-     * @param cacheName
-     * @param group
-     * @param name
-     * @return GroupAttrName
-     */
-    private GroupAttrName<String> getGroupAttrName(String cacheName, String group, String name)
-    {
-        GroupId gid = new GroupId(cacheName, group);
-        return new GroupAttrName<String>(gid, name);
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testUpdate_EventLogging_simple() throws Exception
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testUpdate_EventLogging_simple");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-        diskCache.processRemoveAll();
-
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-        diskCache.setCacheEventLogger(cacheEventLogger);
-
-        ICacheElement<String, String> item = new CacheElement<String, String>("region", "key", "value");
-
-        // DO WORK
-        diskCache.update(item);
-
-        SleepUtil.sleepAtLeast(200);
-
-        // VERIFY
-        assertEquals("Start should have been called.", 1, cacheEventLogger.startICacheEventCalls);
-        assertEquals("End should have been called.", 1, cacheEventLogger.endICacheEventCalls);
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testGet_EventLogging_simple() throws Exception
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testGet_EventLogging_simple");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-        diskCache.processRemoveAll();
-
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-        diskCache.setCacheEventLogger(cacheEventLogger);
-
-        // DO WORK
-        diskCache.get("key");
-
-        // VERIFY
-        assertEquals("Start should have been called.", 1, cacheEventLogger.startICacheEventCalls);
-        assertEquals("End should have been called.", 1, cacheEventLogger.endICacheEventCalls);
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testGetMultiple_EventLogging_simple() throws Exception
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testGetMultiple_EventLogging_simple");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-        diskCache.processRemoveAll();
-
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-        diskCache.setCacheEventLogger(cacheEventLogger);
-
-        Set<String> keys = new HashSet<String>();
-        keys.add("junk");
-
-        // DO WORK
-        diskCache.getMultiple(keys);
-
-        // VERIFY
-        // 1 for get multiple and 1 for get.
-        assertEquals("Start should have been called.", 2, cacheEventLogger.startICacheEventCalls);
-        assertEquals("End should have been called.", 2, cacheEventLogger.endICacheEventCalls);
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testRemove_EventLogging_simple() throws Exception
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRemoveAll_EventLogging_simple");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-        diskCache.processRemoveAll();
-
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-        diskCache.setCacheEventLogger(cacheEventLogger);
-
-        // DO WORK
-        diskCache.remove("key");
-
-        // VERIFY
-        assertEquals("Start should have been called.", 1, cacheEventLogger.startICacheEventCalls);
-        assertEquals("End should have been called.", 1, cacheEventLogger.endICacheEventCalls);
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testRemoveAll_EventLogging_simple() throws Exception
-    {
-        // SETUP
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName("testRemoveAll_EventLogging_simple");
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-        diskCache.processRemoveAll();
-
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-        diskCache.setCacheEventLogger(cacheEventLogger);
-
-        // DO WORK
-        diskCache.remove("key");
-
-        // VERIFY
-        assertEquals("Start should have been called.", 1, cacheEventLogger.startICacheEventCalls);
-        assertEquals("End should have been called.", 1, cacheEventLogger.endICacheEventCalls);
-    }
-
-    /**
-     * Test the basic get matching.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testPutGetMatching_SmallWait() throws Exception
-    {
-        // SETUP
-        int items = 200;
-
-        String cacheName = "testPutGetMatching_SmallWait";
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        // DO WORK
-        for (int i = 0; i <= items; i++)
-        {
-            diskCache.update(new CacheElement<String, String>(cacheName, i + ":key", cacheName + " data " + i));
-        }
-        Thread.sleep(500);
-
-        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
-
-        // VERIFY
-        assertEquals("Wrong number returned", 10, matchingResults.size());
-        // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() );
-        // System.out.println( "\nAFTER TEST \n" + diskCache.getStats() );
-    }
-
-    /**
-     * Test the basic get matching. With no wait this will all come from purgatory.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testPutGetMatching_NoWait() throws Exception
-    {
-        // SETUP
-        int items = 200;
-
-        String cacheName = "testPutGetMatching_NoWait";
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        // DO WORK
-        for (int i = 0; i <= items; i++)
-        {
-            diskCache.update(new CacheElement<String, String>(cacheName, i + ":key", cacheName + " data " + i));
-        }
-
-        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
-
-        // VERIFY
-        assertEquals("Wrong number returned", 10, matchingResults.size());
-        // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() );
-        // System.out.println( "\nAFTER TEST \n" + diskCache.getStats() );
-    }
-
-    /**
-     * Verify that the block disk cache can handle utf encoded strings.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testUTF8String() throws Exception
-    {
-        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append(sb.toString()); // big string
-        }
-        string = sb.toString();
-
-        // System.out.println( "The string contains " + string.length() + " characters" );
-
-        String cacheName = "testUTF8String";
-
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        // DO WORK
-        diskCache.update(new CacheElement<String, String>(cacheName, "x", string));
-
-        // VERIFY
-        assertNotNull(diskCache.get("x"));
-        Thread.sleep(1000);
-        ICacheElement<String, String> afterElement = diskCache.get("x");
-        assertNotNull(afterElement);
-        // System.out.println( "afterElement = " + afterElement );
-        String after = afterElement.getVal();
-
-        assertNotNull(after);
-        assertEquals("wrong string after retrieval", string, after);
-    }
-
-    /**
-     * Verify that the block disk cache can handle utf encoded strings.
-     * <p>
-     *
-     * @throws Exception
-     */
-    public void testUTF8ByteArray() throws Exception
-    {
-        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append(sb.toString()); // big string
-        }
-        string = sb.toString();
-        // System.out.println( "The string contains " + string.length() + " characters" );
-        String UTF8 = "UTF-8";
-        byte[] bytes = string.getBytes(UTF8);
-
-        String cacheName = "testUTF8ByteArray";
-
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, byte[]> diskCache = new IndexedDiskCache<String, byte[]>(cattr);
-
-        // DO WORK
-        diskCache.update(new CacheElement<String, byte[]>(cacheName, "x", bytes));
-
-        // VERIFY
-        assertNotNull(diskCache.get("x"));
-        Thread.sleep(1000);
-        ICacheElement<String, byte[]> afterElement = diskCache.get("x");
-        assertNotNull(afterElement);
-        // System.out.println( "afterElement = " + afterElement );
-        byte[] after = afterElement.getVal();
-
-        assertNotNull(after);
-        assertEquals("wrong bytes after retrieval", string, new String(after, UTF8));
-    }
-
-    /**
-     * Verify the item makes it to disk.
-     * <p>
-     *
-     * @throws IOException
-     */
-    public void testProcessUpdate_Simple() throws IOException
-    {
-        // SETUP
-        String cacheName = "testProcessUpdate_Simple";
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        String key = "myKey";
-        String value = "myValue";
-        ICacheElement<String, String> ce = new CacheElement<String, String>(cacheName, key, value);
-
-        // DO WORK
-        diskCache.processUpdate(ce);
-        ICacheElement<String, String> result = diskCache.processGet(key);
-
-        // VERIFY
-        assertNotNull("Should have a result", result);
-        long fileSize = diskCache.getDataFileSize();
-        assertTrue("File should be greater than 0", fileSize > 0);
-    }
-
-    /**
-     * Verify the item makes it to disk.
-     * <p>
-     *
-     * @throws IOException
-     */
-    public void testProcessUpdate_SameKeySameSize() throws IOException
-    {
-        // SETUP
-        String cacheName = "testProcessUpdate_SameKeySameSize";
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        String key = "myKey";
-        String value = "myValue";
-        ICacheElement<String, String> ce1 = new CacheElement<String, String>(cacheName, key, value);
-
-        // DO WORK
-        diskCache.processUpdate(ce1);
-        long fileSize1 = diskCache.getDataFileSize();
-
-        // DO WORK
-        ICacheElement<String, String> ce2 = new CacheElement<String, String>(cacheName, key, value);
-        diskCache.processUpdate(ce2);
-        ICacheElement<String, String> result = diskCache.processGet(key);
-
-        // VERIFY
-        assertNotNull("Should have a result", result);
-        long fileSize2 = diskCache.getDataFileSize();
-        assertEquals("File should be the same", fileSize1, fileSize2);
-        int binSize = diskCache.getRecyleBinSize();
-        assertEquals("Should be nothing in the bin.", 0, binSize);
-    }
-
-    /**
-     * Verify the item makes it to disk.
-     * <p>
-     *
-     * @throws IOException
-     */
-    public void testProcessUpdate_SameKeySmallerSize() throws IOException
-    {
-        // SETUP
-        String cacheName = "testProcessUpdate_SameKeySmallerSize";
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        String key = "myKey";
-        String value = "myValue";
-        String value2 = "myValu";
-        ICacheElement<String, String> ce1 = new CacheElement<String, String>(cacheName, key, value);
-
-        // DO WORK
-        diskCache.processUpdate(ce1);
-        long fileSize1 = diskCache.getDataFileSize();
-
-        // DO WORK
-        ICacheElement<String, String> ce2 = new CacheElement<String, String>(cacheName, key, value2);
-        diskCache.processUpdate(ce2);
-        ICacheElement<String, String> result = diskCache.processGet(key);
-
-        // VERIFY
-        assertNotNull("Should have a result", result);
-        long fileSize2 = diskCache.getDataFileSize();
-        assertEquals("File should be the same", fileSize1, fileSize2);
-        int binSize = diskCache.getRecyleBinSize();
-        assertEquals("Should be nothing in the bin.", 0, binSize);
-    }
-
-    /**
-     * Verify that the old slot gets in the recycle bin.
-     * <p>
-     *
-     * @throws IOException
-     */
-    public void testProcessUpdate_SameKeyBiggerSize() throws IOException
-    {
-        // SETUP
-        String cacheName = "testProcessUpdate_SameKeyBiggerSize";
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        String key = "myKey";
-        String value = "myValue";
-        String value2 = "myValue2";
-        ICacheElement<String, String> ce1 = new CacheElement<String, String>(cacheName, key, value);
-
-        // DO WORK
-        diskCache.processUpdate(ce1);
-        long fileSize1 = diskCache.getDataFileSize();
-
-        // DO WORK
-        ICacheElement<String, String> ce2 = new CacheElement<String, String>(cacheName, key, value2);
-        diskCache.processUpdate(ce2);
-        ICacheElement<String, String> result = diskCache.processGet(key);
-
-        // VERIFY
-        assertNotNull("Should have a result", result);
-        long fileSize2 = diskCache.getDataFileSize();
-        assertTrue("File should be greater.", fileSize1 < fileSize2);
-        int binSize = diskCache.getRecyleBinSize();
-        assertEquals("Should be one in the bin.", 1, binSize);
-    }
-
-    public void testLoadFromDisk() throws Exception
-    {
-        for (int i = 0; i < 15; i++)
-        { // usually after 2 time it fails
-            oneLoadFromDisk();
-        }
-    }
-
-    public void oneLoadFromDisk() throws Exception
-    {
-        // initialize object to be stored
-        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
-        StringBuilder sb = new StringBuilder();
-        sb.append(string);
-        for (int i = 0; i < 4; i++)
-        {
-            sb.append(sb.toString()); // big string
-        }
-        string = sb.toString();
-
-        // initialize cache
-        String cacheName = "testLoadFromDisk";
-        IndexedDiskCacheAttributes cattr = getCacheAttributes();
-        cattr.setCacheName(cacheName);
-        cattr.setMaxKeySize(100);
-        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
-        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        // DO WORK
-        for (int i = 0; i < 50; i++)
-        {
-            diskCache.update(new CacheElement<String, String>(cacheName, "x" + i, string));
-        }
-        // Thread.sleep(1000);
-        // VERIFY
-        diskCache.dispose();
-        // Thread.sleep(1000);
-
-        diskCache = new IndexedDiskCache<String, String>(cattr);
-
-        for (int i = 0; i < 50; i++)
-        {
-            ICacheElement<String, String> afterElement = diskCache.get("x" + i);
-            assertNotNull("Missing element from cache. Cache size: " + diskCache.getSize() + " element: x" + i, afterElement);
-            assertEquals("wrong string after retrieval", string, afterElement.getVal());
-        }
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk.indexed;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.auxiliary.MockCacheEventLogger;
+import org.apache.commons.jcs.auxiliary.disk.DiskTestObject;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.ElementAttributes;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.IElementAttributes;
+import org.apache.commons.jcs.engine.control.group.GroupAttrName;
+import org.apache.commons.jcs.engine.control.group.GroupId;
+import org.apache.commons.jcs.utils.timing.SleepUtil;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for common functionality.
+ * <p>
+ *
+ * @author Aaron Smuts
+ */
+public abstract class IndexDiskCacheUnitTestAbstract extends TestCase
+{
+    public abstract IndexedDiskCacheAttributes getCacheAttributes();
+
+    /**
+     * Simply verify that we can put items in the disk cache and retrieve them.
+     *
+     * @throws IOException
+     */
+    public void testSimplePutAndGet() throws IOException
+    {
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testSimplePutAndGet");
+        cattr.setMaxKeySize(1000);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<>(cattr);
+
+        disk.processRemoveAll();
+
+        int cnt = 999;
+        for (int i = 0; i < cnt; i++)
+        {
+            IElementAttributes eAttr = new ElementAttributes();
+            eAttr.setIsSpool(true);
+            ICacheElement<String, String> element = new CacheElement<>("testSimplePutAndGet", "key:" + i, "data:" + i);
+            element.setElementAttributes(eAttr);
+            disk.processUpdate(element);
+        }
+
+        for (int i = 0; i < cnt; i++)
+        {
+            ICacheElement<String, String> element = disk.processGet("key:" + i);
+            assertNotNull("Should have received an element.", element);
+            assertEquals("Element is wrong.", "data:" + i, element.getVal());
+        }
+
+        // Test that getMultiple returns all the expected values
+        Set<String> keys = new HashSet<>();
+        for (int i = 0; i < cnt; i++)
+        {
+            keys.add("key:" + i);
+        }
+
+        Map<String, ICacheElement<String, String>> elements = disk.getMultiple(keys);
+        for (int i = 0; i < cnt; i++)
+        {
+            ICacheElement<String, String> element = elements.get("key:" + i);
+            assertNotNull("element " + i + ":key is missing", element);
+            assertEquals("value key:" + i, "data:" + i, element.getVal());
+        }
+        // System.out.println( disk.getStats() );
+    }
+
+    /**
+     * Add some items to the disk cache and then remove them one by one.
+     *
+     * @throws IOException
+     */
+    public void testRemoveItems() throws IOException
+    {
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemoveItems");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<>(cattr);
+
+        disk.processRemoveAll();
+
+        int cnt = 25;
+        for (int i = 0; i < cnt; i++)
+        {
+            IElementAttributes eAttr = new ElementAttributes();
+            eAttr.setIsSpool(true);
+            ICacheElement<String, String> element = new CacheElement<>("testRemoveItems", "key:" + i, "data:" + i);
+            element.setElementAttributes(eAttr);
+            disk.processUpdate(element);
+        }
+
+        // remove each
+        for (int i = 0; i < cnt; i++)
+        {
+            disk.remove("key:" + i);
+            ICacheElement<String, String> element = disk.processGet("key:" + i);
+            assertNull("Should not have received an element.", element);
+        }
+    }
+
+    /**
+     * Verify that we don't override the largest item.
+     * <p>
+     *
+     * @throws IOException
+     */
+
+    /**
+     * Verify that the overlap check returns true when there are no overlaps.
+     */
+    public void testCheckForDedOverlaps_noOverlap()
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testCheckForDedOverlaps_noOverlap");
+        cattr.setDiskPath("target/test-sandbox/UnitTest");
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<>(cattr);
+
+        int numDescriptors = 5;
+        int pos = 0;
+        IndexedDiskElementDescriptor[] sortedDescriptors = new IndexedDiskElementDescriptor[numDescriptors];
+        for (int i = 0; i < numDescriptors; i++)
+        {
+            IndexedDiskElementDescriptor descriptor = new IndexedDiskElementDescriptor(pos, i * 2);
+            pos = pos + (i * 2) + IndexedDisk.HEADER_SIZE_BYTES;
+            sortedDescriptors[i] = descriptor;
+        }
+
+        // DO WORK
+        boolean result = disk.checkForDedOverlaps(sortedDescriptors);
+
+        // VERIFY
+        assertTrue("There should be no overlap. it should be ok", result);
+    }
+
+    /**
+     * Verify that the overlap check returns false when there are overlaps.
+     */
+    public void testCheckForDedOverlaps_overlaps()
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testCheckForDedOverlaps_overlaps");
+        cattr.setDiskPath("target/test-sandbox/UnitTest");
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<>(cattr);
+
+        int numDescriptors = 5;
+        int pos = 0;
+        IndexedDiskElementDescriptor[] sortedDescriptors = new IndexedDiskElementDescriptor[numDescriptors];
+        for (int i = 0; i < numDescriptors; i++)
+        {
+            IndexedDiskElementDescriptor descriptor = new IndexedDiskElementDescriptor(pos, i * 2);
+            // don't add the header + IndexedDisk.RECORD_HEADER;
+            pos = pos + (i * 2);
+            sortedDescriptors[i] = descriptor;
+        }
+
+        // DO WORK
+        boolean result = disk.checkForDedOverlaps(sortedDescriptors);
+
+        // VERIFY
+        assertFalse("There should be overlaps. it should be not ok", result);
+    }
+
+    /**
+     * Verify that the file size is as expected.
+     * <p>
+     *
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public void testFileSize() throws IOException, InterruptedException
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testFileSize");
+        cattr.setDiskPath("target/test-sandbox/UnitTest");
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<>(cattr);
+
+        int numberToInsert = 20;
+        int bytes = 24;
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects(numberToInsert,
+            bytes, cattr.getCacheName());
+
+        for (int i = 0; i < elements.length; i++)
+        {
+            disk.processUpdate(elements[i]);
+        }
+
+        Thread.yield();
+        Thread.sleep(100);
+        Thread.yield();
+
+        long expectedSize = DiskTestObjectUtil.totalSize(elements, numberToInsert);
+        long resultSize = disk.getDataFileSize();
+
+        // System.out.println( "testFileSize stats " + disk.getStats() );
+
+        assertEquals("Wrong file size", expectedSize, resultSize);
+    }
+
+    /**
+     * Verify that items are added to the recycle bin on removal.
+     * <p>
+     *
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public void testRecyleBinSize() throws IOException, InterruptedException
+    {
+        // SETUP
+        int numberToInsert = 20;
+
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRecyleBinSize");
+        cattr.setDiskPath("target/test-sandbox/UnitTest");
+        cattr.setOptimizeAtRemoveCount(numberToInsert);
+        cattr.setMaxKeySize(numberToInsert * 2);
+        cattr.setMaxPurgatorySize(numberToInsert);
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<>(cattr);
+
+        int bytes = 1;
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects(numberToInsert,
+            bytes, cattr.getCacheName());
+
+        for (int i = 0; i < elements.length; i++)
+        {
+            disk.processUpdate(elements[i]);
+        }
+
+        Thread.yield();
+        Thread.sleep(100);
+        Thread.yield();
+
+        // remove half
+        int numberToRemove = elements.length / 2;
+        for (int i = 0; i < numberToRemove; i++)
+        {
+            disk.processRemove(elements[i].getKey());
+        }
+
+        // verify that the recycle bin has the correct amount.
+        assertEquals("The recycle bin should have the number removed.", numberToRemove, disk.getRecyleBinSize());
+    }
+
+    /**
+     * Verify that items of the same size use recycle bin spots. Setup the recycle bin by removing
+     * some items. Add some of the same size. Verify that the recycle count is the number added.
+     * <p>
+     *
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public void testRecyleBinUsage() throws IOException, InterruptedException
+    {
+        // SETUP
+        int numberToInsert = 20;
+
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRecyleBinUsage");
+        cattr.setDiskPath("target/test-sandbox/UnitTest");
+        cattr.setOptimizeAtRemoveCount(numberToInsert);
+        cattr.setMaxKeySize(numberToInsert * 2);
+        cattr.setMaxPurgatorySize(numberToInsert);
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<>(cattr);
+
+        // we will reuse these
+        int bytes = 1;
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects(numberToInsert,
+            bytes, cattr.getCacheName());
+
+        // Add some to the disk
+        for (int i = 0; i < elements.length; i++)
+        {
+            disk.processUpdate(elements[i]);
+        }
+
+        Thread.yield();
+        Thread.sleep(100);
+        Thread.yield();
+
+        // remove half of those added
+        int numberToRemove = elements.length / 2;
+        for (int i = 0; i < numberToRemove; i++)
+        {
+            disk.processRemove(elements[i].getKey());
+        }
+
+        // verify that the recycle bin has the correct amount.
+        assertEquals("The recycle bin should have the number removed.", numberToRemove, disk.getRecyleBinSize());
+
+        // add half as many as we removed. These should all use spots in the recycle bin.
+        int numberToAdd = numberToRemove / 2;
+        for (int i = 0; i < numberToAdd; i++)
+        {
+            disk.processUpdate(elements[i]);
+        }
+
+        // verify that we used the correct number of spots
+        assertEquals("The recycle bin should have the number removed." + disk.getStats(), numberToAdd, disk.getRecyleCount());
+    }
+
+    /**
+     * Verify that the data size is as expected after a remove and after a put that should use the
+     * spots.
+     * <p>
+     *
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public void testBytesFreeSize() throws IOException, InterruptedException
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testBytesFreeSize");
+        cattr.setDiskPath("target/test-sandbox/UnitTest");
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<>(cattr);
+
+        int numberToInsert = 20;
+        int bytes = 24;
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects(numberToInsert,
+            bytes, cattr.getCacheName());
+
+        for (int i = 0; i < elements.length; i++)
+        {
+            disk.processUpdate(elements[i]);
+        }
+
+        Thread.yield();
+        Thread.sleep(100);
+        Thread.yield();
+
+        // remove half of those added
+        int numberToRemove = elements.length / 2;
+        for (int i = 0; i < numberToRemove; i++)
+        {
+            disk.processRemove(elements[i].getKey());
+        }
+
+        long expectedSize = DiskTestObjectUtil.totalSize(elements, numberToRemove);
+        long resultSize = disk.getBytesFree();
+
+        // System.out.println( "testBytesFreeSize stats " + disk.getStats() );
+
+        assertEquals("Wrong bytes free size" + disk.getStats(), expectedSize, resultSize);
+
+        // add half as many as we removed. These should all use spots in the recycle bin.
+        int numberToAdd = numberToRemove / 2;
+        for (int i = 0; i < numberToAdd; i++)
+        {
+            disk.processUpdate(elements[i]);
+        }
+
+        long expectedSize2 = DiskTestObjectUtil.totalSize(elements, numberToAdd);
+        long resultSize2 = disk.getBytesFree();
+        assertEquals("Wrong bytes free size" + disk.getStats(), expectedSize2, resultSize2);
+    }
+
+    /**
+     * Add some items to the disk cache and then remove them one by one.
+     * <p>
+     *
+     * @throws IOException
+     */
+    public void testRemove_PartialKey() throws IOException
+    {
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemove_PartialKey");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<>(cattr);
+
+        disk.processRemoveAll();
+
+        int cnt = 25;
+        for (int i = 0; i < cnt; i++)
+        {
+            IElementAttributes eAttr = new ElementAttributes();
+            eAttr.setIsSpool(true);
+            ICacheElement<String, String> element = new CacheElement<>("testRemove_PartialKey", i + ":key", "data:"
+                + i);
+            element.setElementAttributes(eAttr);
+            disk.processUpdate(element);
+        }
+
+        // verif each
+        for (int i = 0; i < cnt; i++)
+        {
+            ICacheElement<String, String> element = disk.processGet(i + ":key");
+            assertNotNull("Shoulds have received an element.", element);
+        }
+
+        // remove each
+        for (int i = 0; i < cnt; i++)
+        {
+            disk.remove(i + ":");
+            ICacheElement<String, String> element = disk.processGet(i + ":key");
+            assertNull("Should not have received an element.", element);
+        }
+        // https://issues.apache.org/jira/browse/JCS-67
+        assertEquals("Recylenbin should not have more elements than we removed. Check for JCS-67", cnt, disk.getRecyleBinSize());
+    }
+
+    /**
+     * Verify that group members are removed if we call remove with a group.
+     *
+     * @throws IOException
+     */
+    public void testRemove_Group() throws IOException
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemove_Group");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<GroupAttrName<String>, String> disk = new IndexedDiskCache<>(cattr);
+
+        disk.processRemoveAll();
+
+        String cacheName = "testRemove_Group_Region";
+        String groupName = "testRemove_Group";
+
+        int cnt = 25;
+        for (int i = 0; i < cnt; i++)
+        {
+            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
+            CacheElement<GroupAttrName<String>, String> element = new CacheElement<>(cacheName,
+                groupAttrName, "data:" + i);
+
+            IElementAttributes eAttr = new ElementAttributes();
+            eAttr.setIsSpool(true);
+            element.setElementAttributes(eAttr);
+
+            disk.processUpdate(element);
+        }
+
+        // verify each
+        for (int i = 0; i < cnt; i++)
+        {
+            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
+            ICacheElement<GroupAttrName<String>, String> element = disk.processGet(groupAttrName);
+            assertNotNull("Should have received an element.", element);
+        }
+
+        // DO WORK
+        // remove the group
+        disk.remove(getGroupAttrName(cacheName, groupName, null));
+
+        for (int i = 0; i < cnt; i++)
+        {
+            GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
+            ICacheElement<GroupAttrName<String>, String> element = disk.processGet(groupAttrName);
+
+            // VERIFY
+            assertNull("Should not have received an element.", element);
+        }
+
+    }
+
+    /**
+     * Internal method used for group functionality.
+     * <p>
+     *
+     * @param cacheName
+     * @param group
+     * @param name
+     * @return GroupAttrName
+     */
+    private GroupAttrName<String> getGroupAttrName(String cacheName, String group, String name)
+    {
+        GroupId gid = new GroupId(cacheName, group);
+        return new GroupAttrName<>(gid, name);
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testUpdate_EventLogging_simple() throws Exception
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testUpdate_EventLogging_simple");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+        diskCache.processRemoveAll();
+
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+        diskCache.setCacheEventLogger(cacheEventLogger);
+
+        ICacheElement<String, String> item = new CacheElement<>("region", "key", "value");
+
+        // DO WORK
+        diskCache.update(item);
+
+        SleepUtil.sleepAtLeast(200);
+
+        // VERIFY
+        assertEquals("Start should have been called.", 1, cacheEventLogger.startICacheEventCalls);
+        assertEquals("End should have been called.", 1, cacheEventLogger.endICacheEventCalls);
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testGet_EventLogging_simple() throws Exception
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testGet_EventLogging_simple");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+        diskCache.processRemoveAll();
+
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+        diskCache.setCacheEventLogger(cacheEventLogger);
+
+        // DO WORK
+        diskCache.get("key");
+
+        // VERIFY
+        assertEquals("Start should have been called.", 1, cacheEventLogger.startICacheEventCalls);
+        assertEquals("End should have been called.", 1, cacheEventLogger.endICacheEventCalls);
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testGetMultiple_EventLogging_simple() throws Exception
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testGetMultiple_EventLogging_simple");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+        diskCache.processRemoveAll();
+
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+        diskCache.setCacheEventLogger(cacheEventLogger);
+
+        Set<String> keys = new HashSet<>();
+        keys.add("junk");
+
+        // DO WORK
+        diskCache.getMultiple(keys);
+
+        // VERIFY
+        // 1 for get multiple and 1 for get.
+        assertEquals("Start should have been called.", 2, cacheEventLogger.startICacheEventCalls);
+        assertEquals("End should have been called.", 2, cacheEventLogger.endICacheEventCalls);
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testRemove_EventLogging_simple() throws Exception
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemoveAll_EventLogging_simple");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+        diskCache.processRemoveAll();
+
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+        diskCache.setCacheEventLogger(cacheEventLogger);
+
+        // DO WORK
+        diskCache.remove("key");
+
+        // VERIFY
+        assertEquals("Start should have been called.", 1, cacheEventLogger.startICacheEventCalls);
+        assertEquals("End should have been called.", 1, cacheEventLogger.endICacheEventCalls);
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testRemoveAll_EventLogging_simple() throws Exception
+    {
+        // SETUP
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemoveAll_EventLogging_simple");
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTestCEL");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+        diskCache.processRemoveAll();
+
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+        diskCache.setCacheEventLogger(cacheEventLogger);
+
+        // DO WORK
+        diskCache.remove("key");
+
+        // VERIFY
+        assertEquals("Start should have been called.", 1, cacheEventLogger.startICacheEventCalls);
+        assertEquals("End should have been called.", 1, cacheEventLogger.endICacheEventCalls);
+    }
+
+    /**
+     * Test the basic get matching.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testPutGetMatching_SmallWait() throws Exception
+    {
+        // SETUP
+        int items = 200;
+
+        String cacheName = "testPutGetMatching_SmallWait";
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+
+        // DO WORK
+        for (int i = 0; i <= items; i++)
+        {
+            diskCache.update(new CacheElement<>(cacheName, i + ":key", cacheName + " data " + i));
+        }
+        Thread.sleep(500);
+
+        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
+
+        // VERIFY
+        assertEquals("Wrong number returned", 10, matchingResults.size());
+        // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() );
+        // System.out.println( "\nAFTER TEST \n" + diskCache.getStats() );
+    }
+
+    /**
+     * Test the basic get matching. With no wait this will all come from purgatory.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testPutGetMatching_NoWait() throws Exception
+    {
+        // SETUP
+        int items = 200;
+
+        String cacheName = "testPutGetMatching_NoWait";
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+
+        // DO WORK
+        for (int i = 0; i <= items; i++)
+        {
+            diskCache.update(new CacheElement<>(cacheName, i + ":key", cacheName + " data " + i));
+        }
+
+        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
+
+        // VERIFY
+        assertEquals("Wrong number returned", 10, matchingResults.size());
+        // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() );
+        // System.out.println( "\nAFTER TEST \n" + diskCache.getStats() );
+    }
+
+    /**
+     * Verify that the block disk cache can handle utf encoded strings.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testUTF8String() throws Exception
+    {
+        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append(sb.toString()); // big string
+        }
+        string = sb.toString();
+
+        // System.out.println( "The string contains " + string.length() + " characters" );
+
+        String cacheName = "testUTF8String";
+
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+
+        // DO WORK
+        diskCache.update(new CacheElement<>(cacheName, "x", string));
+
+        // VERIFY
+        assertNotNull(diskCache.get("x"));
+        Thread.sleep(1000);
+        ICacheElement<String, String> afterElement = diskCache.get("x");
+        assertNotNull(afterElement);
+        // System.out.println( "afterElement = " + afterElement );
+        String after = afterElement.getVal();
+
+        assertNotNull(after);
+        assertEquals("wrong string after retrieval", string, after);
+    }
+
+    /**
+     * Verify that the block disk cache can handle utf encoded strings.
+     * <p>
+     *
+     * @throws Exception
+     */
+    public void testUTF8ByteArray() throws Exception
+    {
+        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append(sb.toString()); // big string
+        }
+        string = sb.toString();
+        // System.out.println( "The string contains " + string.length() + " characters" );
+        String UTF8 = "UTF-8";
+        byte[] bytes = string.getBytes(UTF8);
+
+        String cacheName = "testUTF8ByteArray";
+
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, byte[]> diskCache = new IndexedDiskCache<>(cattr);
+
+        // DO WORK
+        diskCache.update(new CacheElement<>(cacheName, "x", bytes));
+
+        // VERIFY
+        assertNotNull(diskCache.get("x"));
+        Thread.sleep(1000);
+        ICacheElement<String, byte[]> afterElement = diskCache.get("x");
+        assertNotNull(afterElement);
+        // System.out.println( "afterElement = " + afterElement );
+        byte[] after = afterElement.getVal();
+
+        assertNotNull(after);
+        assertEquals("wrong bytes after retrieval", string, new String(after, UTF8));
+    }
+
+    /**
+     * Verify the item makes it to disk.
+     * <p>
+     *
+     * @throws IOException
+     */
+    public void testProcessUpdate_Simple() throws IOException
+    {
+        // SETUP
+        String cacheName = "testProcessUpdate_Simple";
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+
+        String key = "myKey";
+        String value = "myValue";
+        ICacheElement<String, String> ce = new CacheElement<>(cacheName, key, value);
+
+        // DO WORK
+        diskCache.processUpdate(ce);
+        ICacheElement<String, String> result = diskCache.processGet(key);
+
+        // VERIFY
+        assertNotNull("Should have a result", result);
+        long fileSize = diskCache.getDataFileSize();
+        assertTrue("File should be greater than 0", fileSize > 0);
+    }
+
+    /**
+     * Verify the item makes it to disk.
+     * <p>
+     *
+     * @throws IOException
+     */
+    public void testProcessUpdate_SameKeySameSize() throws IOException
+    {
+        // SETUP
+        String cacheName = "testProcessUpdate_SameKeySameSize";
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+
+        String key = "myKey";
+        String value = "myValue";
+        ICacheElement<String, String> ce1 = new CacheElement<>(cacheName, key, value);
+
+        // DO WORK
+        diskCache.processUpdate(ce1);
+        long fileSize1 = diskCache.getDataFileSize();
+
+        // DO WORK
+        ICacheElement<String, String> ce2 = new CacheElement<>(cacheName, key, value);
+        diskCache.processUpdate(ce2);
+        ICacheElement<String, String> result = diskCache.processGet(key);
+
+        // VERIFY
+        assertNotNull("Should have a result", result);
+        long fileSize2 = diskCache.getDataFileSize();
+        assertEquals("File should be the same", fileSize1, fileSize2);
+        int binSize = diskCache.getRecyleBinSize();
+        assertEquals("Should be nothing in the bin.", 0, binSize);
+    }
+
+    /**
+     * Verify the item makes it to disk.
+     * <p>
+     *
+     * @throws IOException
+     */
+    public void testProcessUpdate_SameKeySmallerSize() throws IOException
+    {
+        // SETUP
+        String cacheName = "testProcessUpdate_SameKeySmallerSize";
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+
+        String key = "myKey";
+        String value = "myValue";
+        String value2 = "myValu";
+        ICacheElement<String, String> ce1 = new CacheElement<>(cacheName, key, value);
+
+        // DO WORK
+        diskCache.processUpdate(ce1);
+        long fileSize1 = diskCache.getDataFileSize();
+
+        // DO WORK
+        ICacheElement<String, String> ce2 = new CacheElement<>(cacheName, key, value2);
+        diskCache.processUpdate(ce2);
+        ICacheElement<String, String> result = diskCache.processGet(key);
+
+        // VERIFY
+        assertNotNull("Should have a result", result);
+        long fileSize2 = diskCache.getDataFileSize();
+        assertEquals("File should be the same", fileSize1, fileSize2);
+        int binSize = diskCache.getRecyleBinSize();
+        assertEquals("Should be nothing in the bin.", 0, binSize);
+    }
+
+    /**
+     * Verify that the old slot gets in the recycle bin.
+     * <p>
+     *
+     * @throws IOException
+     */
+    public void testProcessUpdate_SameKeyBiggerSize() throws IOException
+    {
+        // SETUP
+        String cacheName = "testProcessUpdate_SameKeyBiggerSize";
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/IndexDiskCacheUnitTest");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+
+        String key = "myKey";
+        String value = "myValue";
+        String value2 = "myValue2";
+        ICacheElement<String, String> ce1 = new CacheElement<>(cacheName, key, value);
+
+        // DO WORK
+        diskCache.processUpdate(ce1);
+        long fileSize1 = diskCache.getDataFileSize();
+
+        // DO WORK
+        ICacheElement<String, String> ce2 = new CacheElement<>(cacheName, key, value2);
+        diskCache.processUpdate(ce2);
+        ICacheElement<String, String> result = diskCache.processGet(key);
+
+        // VERIFY
+        assertNotNull("Should have a result", result);
+        long fileSize2 = diskCache.getDataFileSize();
+        assertTrue("File should be greater.", fileSize1 < fileSize2);
+        int binSize = diskCache.getRecyleBinSize();
+        assertEquals("Should be one in the bin.", 1, binSize);
+    }
+
+    public void testLoadFromDisk() throws Exception
+    {
+        for (int i = 0; i < 15; i++)
+        { // usually after 2 time it fails
+            oneLoadFromDisk();
+        }
+    }
+
+    public void oneLoadFromDisk() throws Exception
+    {
+        // initialize object to be stored
+        String string = "IÒtÎrn‚tiÙn‡lizÊti¯n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(string);
+        for (int i = 0; i < 4; i++)
+        {
+            sb.append(sb.toString()); // big string
+        }
+        string = sb.toString();
+
+        // initialize cache
+        String cacheName = "testLoadFromDisk";
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName(cacheName);
+        cattr.setMaxKeySize(100);
+        cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<>(cattr);
+
+        // DO WORK
+        for (int i = 0; i < 50; i++)
+        {
+            diskCache.update(new CacheElement<>(cacheName, "x" + i, string));
+        }
+        // Thread.sleep(1000);
+        // VERIFY
+        diskCache.dispose();
+        // Thread.sleep(1000);
+
+        diskCache = new IndexedDiskCache<>(cattr);
+
+        for (int i = 0; i < 50; i++)
+        {
+            ICacheElement<String, String> afterElement = diskCache.get("x" + i);
+            assertNotNull("Missing element from cache. Cache size: " + diskCache.getSize() + " element: x" + i, afterElement);
+            assertEquals("wrong string after retrieval", string, afterElement.getVal());
+        }
+    }
+}
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java
index 35c2b18..0661254 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java
@@ -157,7 +157,7 @@ public class IndexedDiskCacheConcurrentUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
@@ -218,7 +218,7 @@ public class IndexedDiskCacheConcurrentUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = start; i <= end; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheKeyStoreUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheKeyStoreUnitTest.java
index 644213e..239b575 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheKeyStoreUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheKeyStoreUnitTest.java
@@ -49,7 +49,7 @@ public class IndexedDiskCacheKeyStoreUnitTest
         cattr.setCacheName( "testStoreKeys" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/KeyStoreUnitTest" );
-        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<>( cattr );
 
         disk.processRemoveAll();
 
@@ -58,7 +58,7 @@ public class IndexedDiskCacheKeyStoreUnitTest
         {
             IElementAttributes eAttr = new ElementAttributes();
             eAttr.setIsSpool( true );
-            ICacheElement<String, String> element = new CacheElement<String, String>( cattr.getCacheName(), "key:" + i, "data:" + i );
+            ICacheElement<String, String> element = new CacheElement<>( cattr.getCacheName(), "key:" + i, "data:" + i );
             element.setElementAttributes( eAttr );
             disk.processUpdate( element );
         }
@@ -103,7 +103,7 @@ public class IndexedDiskCacheKeyStoreUnitTest
         cattr.setCacheName( "testOptimize" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/KeyStoreUnitTest" );
-        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<>( cattr );
 
         disk.processRemoveAll();
 
@@ -112,7 +112,7 @@ public class IndexedDiskCacheKeyStoreUnitTest
         {
             IElementAttributes eAttr = new ElementAttributes();
             eAttr.setIsSpool( true );
-            ICacheElement<String, String> element = new CacheElement<String, String>( cattr.getCacheName(), "key:" + i, "data:" + i );
+            ICacheElement<String, String> element = new CacheElement<>( cattr.getCacheName(), "key:" + i, "data:" + i );
             element.setElementAttributes( eAttr );
             disk.processUpdate( element );
         }
@@ -121,7 +121,7 @@ public class IndexedDiskCacheKeyStoreUnitTest
 
         IElementAttributes eAttr = new ElementAttributes();
         eAttr.setIsSpool( true );
-        ICacheElement<String, String> elementSetup = new CacheElement<String, String>( cattr.getCacheName(), "key:" + "A", "data:" + "A" );
+        ICacheElement<String, String> elementSetup = new CacheElement<>( cattr.getCacheName(), "key:" + "A", "data:" + "A" );
         elementSetup.setElementAttributes( eAttr );
         disk.processUpdate( elementSetup );
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java
index 82ad2cc..bbce378 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java
@@ -146,7 +146,7 @@ public class IndexedDiskCacheNoMemoryUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
index 8317505..a76740d 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
@@ -49,7 +49,7 @@ public class IndexedDiskCacheOptimizationUnitTest
         cattr.setMaxKeySize( removeCount * 2 );
         cattr.setOptimizeAtRemoveCount( removeCount );
         cattr.setDiskPath( "target/test-sandbox/testOptimization" );
-        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>( cattr );
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<>( cattr );
 
         disk.removeAll();
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheSameRegionConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheSameRegionConcurrentUnitTest.java
index b9f4771..244410c 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheSameRegionConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCacheSameRegionConcurrentUnitTest.java
@@ -182,7 +182,7 @@ public class IndexedDiskCacheSameRegionConcurrentUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = start; i <= end; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/LRUMapSizeVsCount.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/LRUMapSizeVsCount.java
index 7599f01..587e462 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/LRUMapSizeVsCount.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/LRUMapSizeVsCount.java
@@ -114,7 +114,7 @@ public class LRUMapSizeVsCount
         	cattr.setName("junit");
         	cattr.setCacheName("junit");
         	cattr.setDiskPath(".");
-        	IndexedDiskCache<String, String> idc = new IndexedDiskCache<String, String>(cattr);
+        	IndexedDiskCache<String, String> idc = new IndexedDiskCache<>(cattr);
 
 			Map<String, IndexedDiskElementDescriptor> cacheCount = idc.new LRUMapCountLimited( tries );
 			Map<String, IndexedDiskElementDescriptor> cacheSize = idc.new LRUMapSizeLimited( tries/1024/2 );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDataSourceFactoryUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDataSourceFactoryUnitTest.java
index 821bd3b..9385e87 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDataSourceFactoryUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDataSourceFactoryUnitTest.java
@@ -154,7 +154,7 @@ public class JDBCDataSourceFactoryUnitTest
             {
                 context = new InitialContext(true)
                 {
-                    Map<String, Object> bindings = new HashMap<String, Object>();
+                    Map<String, Object> bindings = new HashMap<>();
 
                     @Override
                     public void bind(String name, Object obj) throws NamingException
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java
index 79f8311..b33ae4d 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java
@@ -112,7 +112,7 @@ public class JDBCDiskCacheSharedPoolUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java
index 2b53ac8..bd79ab9 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java
@@ -116,7 +116,7 @@ public class JDBCDiskCacheUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java
index 33d8957..91a0811 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java
@@ -144,7 +144,7 @@ public class HSQLDiskCacheConcurrentUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheUnitTest.java
index d5bca8a..d6c0294 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheUnitTest.java
@@ -81,7 +81,7 @@ public class HSQLDiskCacheUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java
index 97130f2..7030397 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java
@@ -118,7 +118,7 @@ public class MySQLDiskCacheHsqlBackedUnitTest
         }
 
         // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java
index cd4a217..596252c 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java
@@ -60,7 +60,7 @@ public class MySQLDiskCacheUnitTest
         TableState tableState = new TableState( tableName );
         tableState.setState( TableState.OPTIMIZATION_RUNNING );
 
-        MySQLDiskCache<String, String> cache = new MySQLDiskCache<String, String>( attributes, dsFactory, tableState,
+        MySQLDiskCache<String, String> cache = new MySQLDiskCache<>( attributes, dsFactory, tableState,
         		CompositeCacheManager.getUnconfiguredInstance() );
 
         // DO WORK
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacadeUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacadeUnitTest.java
index cc90583..c36bd4f 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacadeUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacadeUnitTest.java
@@ -39,10 +39,10 @@ public class LateralCacheNoWaitFacadeUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( "testCache1" );
 
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
 
         // DO WORK
         facade.addNoWait( noWait );
@@ -69,11 +69,11 @@ public class LateralCacheNoWaitFacadeUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( "testCache1" );
 
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
-        LateralCacheNoWait<String, String> noWait2 = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
+        LateralCacheNoWait<String, String> noWait2 = new LateralCacheNoWait<>( cache );
 
         // DO WORK
         facade.addNoWait( noWait );
@@ -104,10 +104,10 @@ public class LateralCacheNoWaitFacadeUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( "testCache1" );
 
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
 
         // DO WORK
         facade.addNoWait( noWait );
@@ -129,10 +129,10 @@ public class LateralCacheNoWaitFacadeUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( "testCache1" );
 
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
 
         // DO WORK
         facade.removeNoWait( noWait );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java
index 1f1ae8b..ac2b159 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java
@@ -85,7 +85,7 @@ public class LateralTCPConcurrentRandomTestUtil
         // this service will put and remove using the lateral to
         // the cache instance above
         // the cache thinks it is different since the listenerid is different
-        LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 );
+        LateralTCPService<String, String> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         try
@@ -98,7 +98,7 @@ public class LateralTCPConcurrentRandomTestUtil
                 String key = "key" + kn;
                 if ( n == 1 )
                 {
-                    ICacheElement<String, String> element = new CacheElement<String, String>( region, key, region + ":data" + i
+                    ICacheElement<String, String> element = new CacheElement<>( region, key, region + ":data" + i
                         + " junk asdfffffffadfasdfasf " + kn + ":" + n );
                     service.update( element );
                     if ( show )
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java
index 238ddec..63b74a9 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java
@@ -80,7 +80,7 @@ public class LateralTCPDiscoveryListenerUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( cacheName );
 
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
 
         // DO WORK
         listener.addNoWaitFacade( cacheName, facade );
@@ -102,11 +102,11 @@ public class LateralTCPDiscoveryListenerUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( cacheName );
 
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
         listener.addNoWaitFacade( cacheName, facade );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
 
         // DO WORK
         boolean result = listener.addNoWait( noWait );
@@ -125,8 +125,8 @@ public class LateralTCPDiscoveryListenerUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( cacheName );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
 
         // DO WORK
         boolean result = listener.addNoWait( noWait );
@@ -145,8 +145,8 @@ public class LateralTCPDiscoveryListenerUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( cacheName );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
 
         // DO WORK
         boolean result = listener.removeNoWait( noWait );
@@ -168,11 +168,11 @@ public class LateralTCPDiscoveryListenerUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( cacheName );
 
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
         listener.addNoWaitFacade( cacheName, facade );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
 
         // DO WORK
         boolean result = listener.removeNoWait( noWait );
@@ -194,11 +194,11 @@ public class LateralTCPDiscoveryListenerUnitTest
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( cacheName );
 
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
         listener.addNoWaitFacade( cacheName, facade );
 
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        LateralCache<String, String> cache = new LateralCache<>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<>( cache );
         listener.addNoWait( noWait );
 
         // DO WORK
@@ -216,7 +216,7 @@ public class LateralTCPDiscoveryListenerUnitTest
         // SETUP
         String cacheName = "testAddDiscoveredService_FacadeInList_NoWaitNot";
 
-        ArrayList<String> cacheNames = new ArrayList<String>();
+        ArrayList<String> cacheNames = new ArrayList<>();
         cacheNames.add( cacheName );
 
         DiscoveredService service = new DiscoveredService();
@@ -238,7 +238,7 @@ public class LateralTCPDiscoveryListenerUnitTest
         LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( cacheName );
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
         listener.addNoWaitFacade( cacheName, facade );
 
         // DO WORK
@@ -256,7 +256,7 @@ public class LateralTCPDiscoveryListenerUnitTest
         // SETUP
         String cacheName = "testRemoveDiscoveredService_FacadeInList_NoWaitIs";
 
-        ArrayList<String> cacheNames = new ArrayList<String>();
+        ArrayList<String> cacheNames = new ArrayList<>();
         cacheNames.add( cacheName );
 
         DiscoveredService service = new DiscoveredService();
@@ -278,7 +278,7 @@ public class LateralTCPDiscoveryListenerUnitTest
         LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
         ILateralCacheAttributes cattr = new LateralCacheAttributes();
         cattr.setCacheName( cacheName );
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<>( null, noWaits, cattr );
         listener.addNoWaitFacade( cacheName, facade );
         listener.addDiscoveredService( service );
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java
index 90203f2..2084161 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java
@@ -99,7 +99,7 @@ public class LateralTCPFilterRemoveHashCodeUnitTest
         // this service will put and remove using the lateral to
         // the cache instance above
         // the cache thinks it is different since the listenerid is different
-        LateralTCPService<String, Serializable> service = new LateralTCPService<String, Serializable>( lattr2 );
+        LateralTCPService<String, Serializable> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         String keyToBeRemovedOnPut = "test1";
@@ -122,12 +122,12 @@ public class LateralTCPFilterRemoveHashCodeUnitTest
         // dataToPassHashCodeCompare.hashCode() );
 
         cache.put( keyToBeRemovedOnPut, "this should get removed." );
-        ICacheElement<String, Serializable> element1 = new CacheElement<String, Serializable>( region, keyToBeRemovedOnPut, region
+        ICacheElement<String, Serializable> element1 = new CacheElement<>( region, keyToBeRemovedOnPut, region
             + ":data-this shouldn't get there" );
         service.update( element1 );
 
         cache.put( keyToNotBeRemovedOnPut, dataToPassHashCodeCompare );
-        ICacheElement<String, Serializable> element2 = new CacheElement<String, Serializable>( region, keyToNotBeRemovedOnPut, dataToPassHashCodeCompare );
+        ICacheElement<String, Serializable> element2 = new CacheElement<>( region, keyToNotBeRemovedOnPut, dataToPassHashCodeCompare );
         service.update( element2 );
 
         /*
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java
index 6a11be0..d2cd13e 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java
@@ -96,12 +96,12 @@ public class LateralTCPIssueRemoveOnPutUnitTest
         // Using the lateral, this service will put to and remove from
         // the cache instance above.
         // The cache thinks it is different since the listenerid is different
-        LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 );
+        LateralTCPService<String, String> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         String keyToBeRemovedOnPut = "test1_notremoved";
 
-        ICacheElement<String, String> element1 = new CacheElement<String, String>( region, keyToBeRemovedOnPut, region
+        ICacheElement<String, String> element1 = new CacheElement<>( region, keyToBeRemovedOnPut, region
             + ":data-this shouldn't get removed, it should get to the cache." );
         service.update( element1 );
 
@@ -143,13 +143,13 @@ public class LateralTCPIssueRemoveOnPutUnitTest
         // Using the lateral, this service will put to and remove from
         // the cache instance above.
         // The cache thinks it is different since the listenerid is different
-        LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 );
+        LateralTCPService<String, String> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         String keyToBeRemovedOnPut = "test1";
         cache.put( keyToBeRemovedOnPut, "this should get removed." );
 
-        ICacheElement<String, String> element1 = new CacheElement<String, String>( region, keyToBeRemovedOnPut, region
+        ICacheElement<String, String> element1 = new CacheElement<>( region, keyToBeRemovedOnPut, region
             + ":data-this shouldn't get there" );
         service.update( element1 );
 
@@ -162,7 +162,7 @@ public class LateralTCPIssueRemoveOnPutUnitTest
                 int kn = ran.nextInt( range );
                 String key = "key" + kn;
 
-                ICacheElement<String, String> element = new CacheElement<String, String>( region, key, region + ":data" + i
+                ICacheElement<String, String> element = new CacheElement<>( region, key, region + ":data" + i
                     + " junk asdfffffffadfasdfasf " + kn + ":" + n );
                 service.update( element );
                 if ( show )
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
index eeaa8ee..4f34f80 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
@@ -86,8 +86,8 @@ public class TestTCPLateralUnitTest
         for ( int i = 0; i < numMes; i++ )
         {
             String message = "adsfasasfasfasdasf";
-            CacheElement<String, String> ce = new CacheElement<String, String>( "test", "test", message );
-            LateralElementDescriptor<String, String> led = new LateralElementDescriptor<String, String>( ce );
+            CacheElement<String, String> ce = new CacheElement<>( "test", "test", message );
+            LateralElementDescriptor<String, String> led = new LateralElementDescriptor<>( ce );
             led.command = LateralCommand.UPDATE;
             led.requesterId = 1;
             lur.send( led );
@@ -119,14 +119,14 @@ public class TestTCPLateralUnitTest
         lattr2.setTransmissionTypeName( "TCP" );
         lattr2.setTcpServer( "localhost:1101" );
 
-        LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 );
+        LateralTCPService<String, String> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         // DO WORK
         int cnt = 100;
         for ( int i = 0; i < cnt; i++ )
         {
-            ICacheElement<String, String> element = new CacheElement<String, String>( "test", "key" + i, "value1" );
+            ICacheElement<String, String> element = new CacheElement<>( "test", "key" + i, "value1" );
             service.update( element );
         }
 
@@ -162,16 +162,16 @@ public class TestTCPLateralUnitTest
         lattr2.setTcpListenerPort( 1104 );
         lattr2.setTcpServer( "localhost:1103" );
 
-        LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 );
+        LateralTCPService<String, String> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         // DO WORK
-        ICacheElement<String, String> element = new CacheElement<String, String>( "test", "key", "value1" );
+        ICacheElement<String, String> element = new CacheElement<>( "test", "key", "value1" );
         service.update( element );
 
         SleepUtil.sleepAtLeast( 300 );
 
-        ICacheElement<String, String> element2 = new CacheElement<String, String>( "test", "key", "value2" );
+        ICacheElement<String, String> element2 = new CacheElement<>( "test", "key", "value2" );
         service.update( element2 );
 
         SleepUtil.sleepAtLeast( 1000 );
@@ -206,17 +206,17 @@ public class TestTCPLateralUnitTest
         lattr2.setTransmissionTypeName( "TCP" );
         lattr2.setTcpServer( "localhost:1105" );
 
-        LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 );
+        LateralTCPService<String, String> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         // DO WORK
         String key = "key";
-        ICacheElement<String, String> element = new CacheElement<String, String>( "test", key, "value1" );
+        ICacheElement<String, String> element = new CacheElement<>( "test", key, "value1" );
         service.update( element );
 
         SleepUtil.sleepAtLeast( 300 );
 
-        ICacheElement<String, String> element2 = new CacheElement<String, String>( "test", key, "value2" );
+        ICacheElement<String, String> element2 = new CacheElement<>( "test", key, "value2" );
         service.update( element2 );
 
         SleepUtil.sleepAtLeast( 1000 );
@@ -248,7 +248,7 @@ public class TestTCPLateralUnitTest
         LateralTCPListener.getInstance( lattr, cacheMgr );
 
         // add the item to the listeners cache
-        ICacheElement<String, String> element = new CacheElement<String, String>( "test", "key", "value1" );
+        ICacheElement<String, String> element = new CacheElement<>( "test", "key", "value1" );
         cache.update( element );
 
         // setup a service to talk to the listener started above.
@@ -256,7 +256,7 @@ public class TestTCPLateralUnitTest
         lattr2.setTcpListenerPort( 1108 );
         lattr2.setTcpServer( "localhost:1107" );
 
-        LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 );
+        LateralTCPService<String, String> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         SleepUtil.sleepAtLeast( 300 );
@@ -290,9 +290,9 @@ public class TestTCPLateralUnitTest
         LateralTCPListener.getInstance( lattr, cacheMgr );
 
         // add the item to the listeners cache
-        GroupAttrName<String> groupKey = new GroupAttrName<String>(new GroupId("test", "group"), "key");
+        GroupAttrName<String> groupKey = new GroupAttrName<>(new GroupId("test", "group"), "key");
         ICacheElement<GroupAttrName<String>, String> element =
-            new CacheElement<GroupAttrName<String>, String>( "test", groupKey, "value1" );
+            new CacheElement<>( "test", groupKey, "value1" );
         cache.update( element );
 
         // setup a service to talk to the listener started above.
@@ -301,7 +301,7 @@ public class TestTCPLateralUnitTest
         lattr2.setTcpServer( "localhost:1150" );
 
         LateralTCPService<GroupAttrName<String>, String> service =
-            new LateralTCPService<GroupAttrName<String>, String>( lattr2 );
+            new LateralTCPService<>( lattr2 );
         service.setListenerId( 123459 );
 
         SleepUtil.sleepAtLeast( 500 );
@@ -343,7 +343,7 @@ public class TestTCPLateralUnitTest
         for ( int i = 0; i < numToInsertPrefix1; i++ )
         {
             // add the item to the listeners cache
-            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( "test", keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<>( "test", keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element );
         }
 
@@ -352,7 +352,7 @@ public class TestTCPLateralUnitTest
         lattr2.setTcpListenerPort( 1108 );
         lattr2.setTcpServer( "localhost:1108" );
 
-        LateralTCPService<String, Integer> service = new LateralTCPService<String, Integer>( lattr2 );
+        LateralTCPService<String, Integer> service = new LateralTCPService<>( lattr2 );
         service.setListenerId( 123456 );
 
         SleepUtil.sleepAtLeast( 300 );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheClient.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheClient.java
index b20e979..83c6b44 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheClient.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheClient.java
@@ -50,20 +50,20 @@ public class MockRemoteCacheClient<K, V>
     private static final Log log = LogFactory.getLog( MockRemoteCacheClient.class );
 
     /** List of ICacheElement&lt;K, V&gt; objects passed into update. */
-    public List<ICacheElement<K, V>> updateList = new LinkedList<ICacheElement<K,V>>();
+    public List<ICacheElement<K, V>> updateList = new LinkedList<>();
 
     /** List of key objects passed into remove. */
-    public List<K> removeList = new LinkedList<K>();
+    public List<K> removeList = new LinkedList<>();
 
     /** status to return. */
     public CacheStatus status = CacheStatus.ALIVE;
 
     /** Can setup values to return from get. values must be ICacheElement&lt;K, V&gt; */
-    public Map<K, ICacheElement<K, V>> getSetupMap = new HashMap<K, ICacheElement<K,V>>();
+    public Map<K, ICacheElement<K, V>> getSetupMap = new HashMap<>();
 
     /** Can setup values to return from get. values must be Map&lt;K, ICacheElement&lt;K, V&gt;&gt; */
     public Map<Set<K>, Map<K, ICacheElement<K, V>>> getMultipleSetupMap =
-        new HashMap<Set<K>, Map<K,ICacheElement<K,V>>>();
+        new HashMap<>();
 
     /** The last service passed to fixCache */
     public ICacheServiceNonLocal<K, V> fixed;
@@ -245,7 +245,7 @@ public class MockRemoteCacheClient<K, V>
     public Map<K, ICacheElement<K, V>> getMatching(String pattern)
         throws IOException
     {
-        return new HashMap<K, ICacheElement<K,V>>();
+        return new HashMap<>();
     }
 
     /**
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheListener.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheListener.java
index 65caa0b..4295ec6 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheListener.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheListener.java
@@ -45,10 +45,10 @@ public class MockRemoteCacheListener<K, V>
     public int putCount;
 
     /** List of ICacheElements passed to handlePut. */
-    public List<ICacheElement<K, V>> putItems = new LinkedList<ICacheElement<K,V>>();
+    public List<ICacheElement<K, V>> putItems = new LinkedList<>();
 
     /** List of Serializable objects passed to handleRemove. */
-    public List<K> removedKeys = new LinkedList<K>();
+    public List<K> removedKeys = new LinkedList<>();
 
     /** Number of times handleRemote was called. */
     public int removeCount;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheService.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheService.java
index 1f1b1c5..b004220 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheService.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheService.java
@@ -49,10 +49,10 @@ public class MockRemoteCacheService<K, V>
     public ICacheElement<K, V> lastUpdate;
 
     /** List of updates. */
-    public List<ICacheElement<K, V>> updateRequestList = new ArrayList<ICacheElement<K,V>>();
+    public List<ICacheElement<K, V>> updateRequestList = new ArrayList<>();
 
     /** List of request ids. */
-    public List<Long> updateRequestIdList = new ArrayList<Long>();
+    public List<Long> updateRequestIdList = new ArrayList<>();
 
     /** The key that was last passed to remove. */
     public K lastRemoveKey;
@@ -80,7 +80,7 @@ public class MockRemoteCacheService<K, V>
     @Override
     public Set<K> getKeySet( String cacheName )
     {
-        return new HashSet<K>();
+        return new HashSet<>();
     }
 
     /**
@@ -195,7 +195,7 @@ public class MockRemoteCacheService<K, V>
     public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
     {
         lastGetMultipleKeys = keys;
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -236,6 +236,6 @@ public class MockRemoteCacheService<K, V>
         throws IOException
     {
         lastGetMatchingPattern = pattern;
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 }
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheClientTester.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheClientTester.java
index cdb2686..cc62371 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheClientTester.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheClientTester.java
@@ -158,11 +158,11 @@ public class RemoteCacheClientTester
         p( "subscribing to the server" );
 
         watch.addCacheListener( "testCache", this );
-        ICacheElement<String, String> cb = new CacheElement<String, String>( "testCache", "testKey", "testVal" );
+        ICacheElement<String, String> cb = new CacheElement<>( "testCache", "testKey", "testVal" );
 
         for ( int i = 0; i < count; i++ )
         {
-            cb = new CacheElement<String, String>( "testCache", "" + i, "" + i );
+            cb = new CacheElement<>( "testCache", "" + i, "" + i );
 
             if ( delete )
             {
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java
index db1569b..7cc7e7c 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java
@@ -55,7 +55,7 @@ public class RemoteCacheListenerUnitTest
         IRemoteCacheAttributes irca = new RemoteCacheAttributes();
         irca.setRemoveUponRemotePut( false );
         ICompositeCacheManager cacheMgr = new MockCompositeCacheManager();
-        RemoteCacheListener<String, String> listener = new RemoteCacheListener<String, String>( irca, cacheMgr, new StandardSerializer() );
+        RemoteCacheListener<String, String> listener = new RemoteCacheListener<>( irca, cacheMgr, new StandardSerializer() );
 
         String cacheName = "testName";
         String key = "key";
@@ -66,7 +66,7 @@ public class RemoteCacheListenerUnitTest
         IElementSerializer elementSerializer = new StandardSerializer();
 
         ICacheElementSerialized<String, String> element =
-            new CacheElementSerialized<String, String>( cacheName, key, elementSerializer
+            new CacheElementSerialized<>( cacheName, key, elementSerializer
             .serialize( value ), attr );
 
         // DO WORK
@@ -98,7 +98,7 @@ public class RemoteCacheListenerUnitTest
         IRemoteCacheAttributes irca = new RemoteCacheAttributes();
         irca.setRemoveUponRemotePut( true );
         ICompositeCacheManager cacheMgr = new MockCompositeCacheManager();
-        RemoteCacheListener<String, String> listener = new RemoteCacheListener<String, String>( irca, cacheMgr, new StandardSerializer() );
+        RemoteCacheListener<String, String> listener = new RemoteCacheListener<>( irca, cacheMgr, new StandardSerializer() );
 
         String cacheName = "testName";
         String key = "key";
@@ -109,7 +109,7 @@ public class RemoteCacheListenerUnitTest
         IElementSerializer elementSerializer = new StandardSerializer();
 
         ICacheElementSerialized<String, String> element =
-            new CacheElementSerialized<String, String>( cacheName, key, elementSerializer
+            new CacheElementSerialized<>( cacheName, key, elementSerializer
             .serialize( value ), attr );
 
         // DO WORK
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacadeUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacadeUnitTest.java
index afbeef2..8af3017 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacadeUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacadeUnitTest.java
@@ -1,56 +1,56 @@
-package org.apache.commons.jcs.auxiliary.remote;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-
-/**
- * Tests for RemoteCacheNoWaitFacade.
- */
-public class RemoteCacheNoWaitFacadeUnitTest
-    extends TestCase
-{
-    /**
-     * Verify that we can add an item.
-     */
-    public void testAddNoWait_InList()
-    {
-        // SETUP
-        List<RemoteCacheNoWait<String, String>> noWaits = new ArrayList<RemoteCacheNoWait<String,String>>();
-        IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
-        cattr.setCacheName( "testCache1" );
-
-        RemoteCache<String, String> client = new RemoteCache<String, String>(cattr, null, null, null);
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
-        noWaits.add( noWait );
-
-        RemoteCacheNoWaitFacade<String, String> facade = new RemoteCacheNoWaitFacade<String, String>(noWaits, cattr, null, null, null );
-        
-        // VERIFY
-        assertEquals( "Should have one entry.", 1, facade.noWaits.size() );
-        assertTrue( "Should be in the list.", facade.noWaits.contains( noWait ) );
-        assertSame( "Should have same facade.", facade, ((RemoteCache<String, String>)facade.noWaits.get(0).getRemoteCache()).getFacade() );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for RemoteCacheNoWaitFacade.
+ */
+public class RemoteCacheNoWaitFacadeUnitTest
+    extends TestCase
+{
+    /**
+     * Verify that we can add an item.
+     */
+    public void testAddNoWait_InList()
+    {
+        // SETUP
+        List<RemoteCacheNoWait<String, String>> noWaits = new ArrayList<>();
+        IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
+        cattr.setCacheName( "testCache1" );
+
+        RemoteCache<String, String> client = new RemoteCache<>(cattr, null, null, null);
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<>( client );
+        noWaits.add( noWait );
+
+        RemoteCacheNoWaitFacade<String, String> facade = new RemoteCacheNoWaitFacade<>(noWaits, cattr, null, null, null );
+        
+        // VERIFY
+        assertEquals( "Should have one entry.", 1, facade.noWaits.size() );
+        assertTrue( "Should be in the list.", facade.noWaits.contains( noWait ) );
+        assertSame( "Should have same facade.", facade, ((RemoteCache<String, String>)facade.noWaits.get(0).getRemoteCache()).getFacade() );
+    }
+}
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java
index dbca37e..93a7236 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java
@@ -48,10 +48,10 @@ public class RemoteCacheNoWaitUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<>();
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<>( client );
 
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testUpdate", "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( "testUpdate", "key", "value" );
 
         // DO WORK
         noWait.update( element );
@@ -72,10 +72,10 @@ public class RemoteCacheNoWaitUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<>();
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<>( client );
 
-        ICacheElement<String, String> input = new CacheElement<String, String>( "testUpdate", "key", "value" );
+        ICacheElement<String, String> input = new CacheElement<>( "testUpdate", "key", "value" );
         client.getSetupMap.put( "key", input );
 
         // DO WORK
@@ -94,14 +94,14 @@ public class RemoteCacheNoWaitUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<>();
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<>( client );
 
-        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testUpdate", "key", "value" );
-        Map<String, ICacheElement<String, String>> inputMap = new HashMap<String, ICacheElement<String,String>>();
+        ICacheElement<String, String> inputElement = new CacheElement<>( "testUpdate", "key", "value" );
+        Map<String, ICacheElement<String, String>> inputMap = new HashMap<>();
         inputMap.put( "key", inputElement );
 
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         keys.add( "key" );
 
         client.getMultipleSetupMap.put( keys, inputMap );
@@ -122,8 +122,8 @@ public class RemoteCacheNoWaitUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<>();
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<>( client );
 
         String input = "MyKey";
 
@@ -146,9 +146,9 @@ public class RemoteCacheNoWaitUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<>();
         client.status = CacheStatus.ALIVE;
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<>( client );
 
         // DO WORK
         String result = noWait.getStats();
@@ -166,9 +166,9 @@ public class RemoteCacheNoWaitUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<>();
         client.status = CacheStatus.ERROR;
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<>( client );
 
         // DO WORK
         CacheStatus result = noWait.getStatus();
@@ -187,13 +187,13 @@ public class RemoteCacheNoWaitUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<>();
         client.status = CacheStatus.ALIVE;
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<>( client );
 
-        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<String, String>();
+        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<>();
 
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testUpdate", "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( "testUpdate", "key", "value" );
 
         // DO WORK
         noWait.update( element );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheUnitTest.java
index e46105c..55090d4 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheUnitTest.java
@@ -51,8 +51,8 @@ public class RemoteCacheUnitTest
     {
         super.setUp();
         cattr = new RemoteCacheAttributes();
-        service = new MockRemoteCacheService<String, String>();
-        listener = new MockRemoteCacheListener<String, String>();
+        service = new MockRemoteCacheService<>();
+        listener = new MockRemoteCacheListener<>();
         monitor = new RemoteCacheMonitor();
     }
 
@@ -69,12 +69,12 @@ public class RemoteCacheUnitTest
         long listenerId = 123;
         listener.setListenerId( listenerId );
 
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, listener, monitor );
 
         String cacheName = "testUpdate";
 
         // DO WORK
-        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( cacheName, "key", "value" );
         remoteCache.update( element );
 
         // VERIFY
@@ -96,15 +96,15 @@ public class RemoteCacheUnitTest
         throws Exception
     {
         // SETUP
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 10 );
 
         // set the zombie
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, zombie, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, zombie, listener, monitor );
 
         String cacheName = "testUpdate";
 
         // DO WORK
-        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( cacheName, "key", "value" );
         remoteCache.update( element );
         // set the new service, this should call propagate
         remoteCache.fixCache( service );
@@ -126,12 +126,12 @@ public class RemoteCacheUnitTest
     public void testUpdate_simple()
         throws Exception
     {
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, listener, monitor );
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         remoteCache.setCacheEventLogger( cacheEventLogger );
 
-        ICacheElement<String, String> item = new CacheElement<String, String>( "region", "key", "value" );
+        ICacheElement<String, String> item = new CacheElement<>( "region", "key", "value" );
 
         // DO WORK
         remoteCache.update( item );
@@ -149,7 +149,7 @@ public class RemoteCacheUnitTest
     public void testGet_simple()
         throws Exception
     {
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, listener, monitor );
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         remoteCache.setCacheEventLogger( cacheEventLogger );
@@ -170,13 +170,13 @@ public class RemoteCacheUnitTest
     public void testGetMultiple_simple()
         throws Exception
     {
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, listener, monitor );
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         remoteCache.setCacheEventLogger( cacheEventLogger );
 
         // DO WORK
-        remoteCache.getMultiple( new HashSet<String>() );
+        remoteCache.getMultiple( new HashSet<>() );
 
         // VERIFY
         assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
@@ -191,7 +191,7 @@ public class RemoteCacheUnitTest
     public void testRemove_simple()
         throws Exception
     {
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, listener, monitor );
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         remoteCache.setCacheEventLogger( cacheEventLogger );
@@ -212,7 +212,7 @@ public class RemoteCacheUnitTest
     public void testRemoveAll_simple()
         throws Exception
     {
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, listener, monitor );
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         remoteCache.setCacheEventLogger( cacheEventLogger );
@@ -236,7 +236,7 @@ public class RemoteCacheUnitTest
         // SETUP
         String pattern = "adsfasdfasd.?";
 
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, listener, monitor );
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         remoteCache.setCacheEventLogger( cacheEventLogger );
@@ -258,7 +258,7 @@ public class RemoteCacheUnitTest
     public void testDispose_simple()
         throws Exception
     {
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, listener, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, listener, monitor );
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         remoteCache.setCacheEventLogger( cacheEventLogger );
@@ -280,7 +280,7 @@ public class RemoteCacheUnitTest
         throws Exception
     {
         // SETUP
-        RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, service, null, monitor );
+        RemoteCache<String, String> remoteCache = new RemoteCache<>( cattr, service, null, monitor );
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         remoteCache.setCacheEventLogger( cacheEventLogger );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/TestRemoteCache.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/TestRemoteCache.java
index 694194d..fdc0c3b 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/TestRemoteCache.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/TestRemoteCache.java
@@ -120,7 +120,7 @@ public class TestRemoteCache
         for ( int i = 0; i < numMes; i++ )
         {
             String message = "adsfasasfasfasdasf";
-            CacheElement<String, String> ce = new CacheElement<String, String>( "key" + 1, "data" + i, message );
+            CacheElement<String, String> ce = new CacheElement<>( "key" + 1, "data" + i, message );
             cache.update( ce );
 //            System.out.println( "put " + ce );
         }
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java
index c66e909..84ecc3a 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java
@@ -39,14 +39,14 @@ public class ZombieRemoteCacheServiceUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<String, String>();
+        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<>();
 
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 10 );
 
         String cacheName = "testUpdate";
 
         // DO WORK
-        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( cacheName, "key", "value" );
         zombie.update( element, 123l );
         zombie.propagateEvents( service );
 
@@ -63,14 +63,14 @@ public class ZombieRemoteCacheServiceUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<String, String>();
+        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<>();
 
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 0 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 0 );
 
         String cacheName = "testUpdate";
 
         // DO WORK
-        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( cacheName, "key", "value" );
         zombie.update( element, 123l );
         zombie.propagateEvents( service );
 
@@ -87,9 +87,9 @@ public class ZombieRemoteCacheServiceUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<String, String>();
+        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<>();
 
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 10 );
 
         String cacheName = "testRemoveThenWalk";
         String key = "myKey";
@@ -111,9 +111,9 @@ public class ZombieRemoteCacheServiceUnitTest
         throws Exception
     {
         // SETUP
-        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<String, String>();
+        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<>();
 
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 10 );
 
         String cacheName = "testRemoveThenWalk";
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java
index be8e3e2..7d31c70 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java
@@ -45,7 +45,7 @@ public class RemoteHttpCacheClientUnitTest
     {
         // SETUP
         RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<>( attributes );
 
         MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
         client.setRemoteDispatcher( mockDispatcher );
@@ -74,7 +74,7 @@ public class RemoteHttpCacheClientUnitTest
     {
         // SETUP
         RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<>( attributes );
 
         MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
         client.setRemoteDispatcher( mockDispatcher );
@@ -82,9 +82,9 @@ public class RemoteHttpCacheClientUnitTest
         String cacheName = "test";
         String key = "key";
 
-        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, key, "value" );
+        ICacheElement<String, String> expected = new CacheElement<>( cacheName, key, "value" );
         RemoteCacheResponse<ICacheElement<String, String>> remoteHttpCacheResponse =
-            new RemoteCacheResponse<ICacheElement<String,String>>();
+            new RemoteCacheResponse<>();
         remoteHttpCacheResponse.setPayload( expected );
 
         mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
@@ -108,7 +108,7 @@ public class RemoteHttpCacheClientUnitTest
     {
         // SETUP
         RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<>( attributes );
 
         MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
         client.setRemoteDispatcher( mockDispatcher );
@@ -116,11 +116,11 @@ public class RemoteHttpCacheClientUnitTest
         String cacheName = "test";
         String pattern = "key";
 
-        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, "key", "value" );
-        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<String, ICacheElement<String,String>>();
+        ICacheElement<String, String> expected = new CacheElement<>( cacheName, "key", "value" );
+        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<>();
         expectedMap.put( "key", expected );
         RemoteCacheResponse<Map<String, ICacheElement<String, String>>> remoteHttpCacheResponse =
-            new RemoteCacheResponse<Map<String,ICacheElement<String,String>>>();
+            new RemoteCacheResponse<>();
         remoteHttpCacheResponse.setPayload( expectedMap );
 
         mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
@@ -144,7 +144,7 @@ public class RemoteHttpCacheClientUnitTest
     {
         // SETUP
         RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<>( attributes );
 
         MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
         client.setRemoteDispatcher( mockDispatcher );
@@ -152,11 +152,11 @@ public class RemoteHttpCacheClientUnitTest
         String cacheName = "test";
         Set<String> keys = Collections.emptySet();
 
-        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, "key", "value" );
-        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<String, ICacheElement<String,String>>();
+        ICacheElement<String, String> expected = new CacheElement<>( cacheName, "key", "value" );
+        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<>();
         expectedMap.put( "key", expected );
         RemoteCacheResponse<Map<String, ICacheElement<String, String>>> remoteHttpCacheResponse =
-            new RemoteCacheResponse<Map<String,ICacheElement<String,String>>>();
+            new RemoteCacheResponse<>();
         remoteHttpCacheResponse.setPayload( expectedMap );
 
         mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
@@ -180,7 +180,7 @@ public class RemoteHttpCacheClientUnitTest
     {
         // SETUP
         RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<>( attributes );
 
         MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
         client.setRemoteDispatcher( mockDispatcher );
@@ -206,7 +206,7 @@ public class RemoteHttpCacheClientUnitTest
     {
         // SETUP
         RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<>( attributes );
 
         MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
         client.setRemoteDispatcher( mockDispatcher );
@@ -231,14 +231,14 @@ public class RemoteHttpCacheClientUnitTest
     {
         // SETUP
         RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<>( attributes );
 
         MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
         client.setRemoteDispatcher( mockDispatcher );
 
         String cacheName = "test";
 
-        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( cacheName, "key", "value" );
 
         // DO WORK
         client.update( element );
@@ -258,7 +258,7 @@ public class RemoteHttpCacheClientUnitTest
     {
         // SETUP
         RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<>( attributes );
 
         MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
         client.setRemoteDispatcher( mockDispatcher );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java
index 049438d..6b35897 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java
@@ -44,12 +44,12 @@ public class RemoteHttpCacheServiceUnitTest
 
         RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
         RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+            new RemoteHttpCacheService<>( manager, rcsa, cacheEventLogger );
 
         String cacheName = "test";
         String key = "key";
         long requesterId = 2;
-        CacheElement<String, String> element = new CacheElement<String, String>( cacheName, key, null );
+        CacheElement<String, String> element = new CacheElement<>( cacheName, key, null );
 
         // DO WORK
         server.update( element, requesterId );
@@ -73,7 +73,7 @@ public class RemoteHttpCacheServiceUnitTest
 
         RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
         RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+            new RemoteHttpCacheService<>( manager, rcsa, cacheEventLogger );
 
         // DO WORK
         server.get( "region", "key" );
@@ -97,7 +97,7 @@ public class RemoteHttpCacheServiceUnitTest
 
         RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
         RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+            new RemoteHttpCacheService<>( manager, rcsa, cacheEventLogger );
 
         // DO WORK
         server.getMatching( "region", "pattern", 0 );
@@ -121,10 +121,10 @@ public class RemoteHttpCacheServiceUnitTest
 
         RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
         RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+            new RemoteHttpCacheService<>( manager, rcsa, cacheEventLogger );
 
         // DO WORK
-        server.getMultiple( "region", new HashSet<String>() );
+        server.getMultiple( "region", new HashSet<>() );
 
         // VERIFY
         assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
@@ -145,7 +145,7 @@ public class RemoteHttpCacheServiceUnitTest
 
         RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
         RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+            new RemoteHttpCacheService<>( manager, rcsa, cacheEventLogger );
 
         // DO WORK
         server.remove( "region", "key" );
@@ -169,7 +169,7 @@ public class RemoteHttpCacheServiceUnitTest
 
         RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
         RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+            new RemoteHttpCacheService<>( manager, rcsa, cacheEventLogger );
 
         // DO WORK
         server.removeAll( "region" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServletUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServletUnitTest.java
index 1e45af5..93cb7c9 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServletUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServletUnitTest.java
@@ -48,7 +48,7 @@ public class RemoteHttpCacheServletUnitTest
         servlet = new RemoteHttpCacheServlet();
         servlet.init(null);
 
-        remoteHttpCacheService = new MockRemoteCacheService<Serializable, Serializable>();
+        remoteHttpCacheService = new MockRemoteCacheService<>();
         servlet.setRemoteCacheService( remoteHttpCacheService );
     }
 
@@ -133,7 +133,7 @@ public class RemoteHttpCacheServletUnitTest
         String cacheName = "test";
         String key = "key";
         long requesterId = 2;
-        CacheElement<Serializable, Serializable> element = new CacheElement<Serializable, Serializable>( cacheName, key, null );
+        CacheElement<Serializable, Serializable> element = new CacheElement<>( cacheName, key, null );
         RemoteCacheRequest<Serializable, Serializable> request = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId );
 
         // DO WORK
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
index fe6b86a..21ea4dd 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
@@ -152,7 +152,7 @@ public class BasicRemoteCacheClientServerUnitTest extends Assert
 
         // DO WORK
         int numPutsPrior = server.getPutCount();
-        ICacheElement<String, String> element = new CacheElement<String, String>(cache.getCacheName(), "key", "value");
+        ICacheElement<String, String> element = new CacheElement<>(cache.getCacheName(), "key", "value");
         cache.update(element);
         SleepUtil.sleepAtLeast(200);
 
@@ -201,7 +201,7 @@ public class BasicRemoteCacheClientServerUnitTest extends Assert
 
         // DO WORK
         int numPutsPrior = server.getPutCount();
-        ICacheElement<String, String> element = new CacheElement<String, String>(cache.getCacheName(), "key", "value");
+        ICacheElement<String, String> element = new CacheElement<>(cache.getCacheName(), "key", "value");
         cache.update(element);
         SleepUtil.sleepAtLeast(50);
 
@@ -253,12 +253,12 @@ public class BasicRemoteCacheClientServerUnitTest extends Assert
         RemoteCacheManager remoteCacheManager = factory.getManager(attributes, compositeCacheManager, new MockCacheEventLogger(), new MockElementSerializer());
         AuxiliaryCache<String, String> cache = remoteCacheManager.getCache(attributes);
 
-        MockRemoteCacheListener<String, String> listener = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> listener = new MockRemoteCacheListener<>();
         server.addCacheListener(cache.getCacheName(), listener);
 
         // DO WORK
         int numPutsPrior = server.getPutCount();
-        ICacheElement<String, String> element = new CacheElement<String, String>(cache.getCacheName(), "key", "value");
+        ICacheElement<String, String> element = new CacheElement<>(cache.getCacheName(), "key", "value");
         cache.update(element);
         SleepUtil.sleepAtLeast(50);
 
@@ -302,7 +302,7 @@ public class BasicRemoteCacheClientServerUnitTest extends Assert
         RemoteCacheManager remoteCacheManager = factory.getManager(attributes, compositeCacheManager, new MockCacheEventLogger(), new MockElementSerializer());
         AuxiliaryCache<String, String> cache = remoteCacheManager.getCache(attributes);
 
-        MockRemoteCacheListener<String, String> listener = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> listener = new MockRemoteCacheListener<>();
         server.addCacheListener(cache.getCacheName(), listener);
 
         // DO WORK
@@ -310,7 +310,7 @@ public class BasicRemoteCacheClientServerUnitTest extends Assert
         int numToPut = 100;
         for (int i = 0; i < numToPut; i++)
         {
-            ICacheElement<String, String> element = new CacheElement<String, String>(cache.getCacheName(), "key" + 1, "value" + i);
+            ICacheElement<String, String> element = new CacheElement<>(cache.getCacheName(), "key" + 1, "value" + i);
             cache.update(element);
         }
         SleepUtil.sleepAtLeast(500);
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java
index cf09219..d002f80 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java
@@ -57,7 +57,7 @@ public class RemoteCacheServerUnitTest
         IRemoteCacheServerAttributes rcsa = new RemoteCacheServerAttributes();
         rcsa.setConfigFileName( "/TestRemoteCacheServer.ccf" );
         Properties config = RemoteUtils.loadProps(rcsa.getConfigFileName());
-        this.server = new RemoteCacheServer<String, String>( rcsa, config );
+        this.server = new RemoteCacheServer<>( rcsa, config );
     }
 
     @Override
@@ -77,10 +77,10 @@ public class RemoteCacheServerUnitTest
     public void testAddListenerToCache_LOCALtype()
         throws Exception
     {
-        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<>();
         mockListener1.remoteType = RemoteType.LOCAL;
         mockListener1.localAddress = expectedIp1;
-        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<>();
         mockListener1.remoteType = RemoteType.LOCAL;
         mockListener2.localAddress = expectedIp2;
 
@@ -106,10 +106,10 @@ public class RemoteCacheServerUnitTest
     public void testAddListenerToCache_CLUSTERtype()
         throws Exception
     {
-        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<>();
         mockListener1.remoteType = RemoteType.CLUSTER;
         mockListener1.localAddress = expectedIp1;
-        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<>();
         mockListener1.remoteType = RemoteType.CLUSTER;
         mockListener2.localAddress = expectedIp2;
 
@@ -136,9 +136,9 @@ public class RemoteCacheServerUnitTest
 //    public void testAddListener_ToAll()
 //        throws Exception
 //    {
-//        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>();
+//        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<>();
 //        mockListener1.localAddress = expectedIp1;
-//        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>();
+//        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<>();
 //        mockListener2.localAddress = expectedIp2;
 //
 //        // DO WORK
@@ -163,8 +163,8 @@ public class RemoteCacheServerUnitTest
     public void testAddListener_ToAllThenRemove()
         throws Exception
     {
-        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>();
-        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<>();
+        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<>();
 
         String cacheName = "testAddListenerToAllThenRemove";
 
@@ -192,9 +192,9 @@ public class RemoteCacheServerUnitTest
     public void testAddListener_ToAllThenRemove_clusterType()
         throws Exception
     {
-        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<>();
         mockListener1.remoteType = RemoteType.CLUSTER;
-        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<>();
         mockListener2.remoteType = RemoteType.CLUSTER;
 
         String cacheName = "testAddListenerToAllThenRemove";
@@ -227,19 +227,19 @@ public class RemoteCacheServerUnitTest
         rcsa.setConfigFileName( "/TestRemoteCacheServer.ccf" );
 
         Properties config = RemoteUtils.loadProps(rcsa.getConfigFileName());
-        MockRemoteCacheListener<String, Long> mockListener = new MockRemoteCacheListener<String, Long>();
-        RemoteCacheServer<String, Long> server = new RemoteCacheServer<String, Long>( rcsa, config );
+        MockRemoteCacheListener<String, Long> mockListener = new MockRemoteCacheListener<>();
+        RemoteCacheServer<String, Long> server = new RemoteCacheServer<>( rcsa, config );
 
         String cacheName = "testSimpleRegisterListenerAndPut";
         server.addCacheListener( cacheName, mockListener );
 
         // DO WORK
-        List<ICacheElement<String, Long>> inputItems = new LinkedList<ICacheElement<String, Long>>();
+        List<ICacheElement<String, Long>> inputItems = new LinkedList<>();
         int numToPut = 10;
 
         for ( int i = 0; i < numToPut; i++ )
         {
-            ICacheElement<String, Long> element = new CacheElement<String, Long>( cacheName, String.valueOf( i ), Long.valueOf( i ) );
+            ICacheElement<String, Long> element = new CacheElement<>( cacheName, String.valueOf( i ), Long.valueOf( i ) );
             inputItems.add( element );
             server.update( element, 9999 );
         }
@@ -273,14 +273,14 @@ public class RemoteCacheServerUnitTest
         rcsa.setLocalClusterConsistency( true );
         rcsa.setConfigFileName( "/TestRemoteCacheServer.ccf" );
         Properties config = RemoteUtils.loadProps(rcsa.getConfigFileName());
-        RemoteCacheServer<String, Long> server = new RemoteCacheServer<String, Long>( rcsa, config );
+        RemoteCacheServer<String, Long> server = new RemoteCacheServer<>( rcsa, config );
 
         // this is to get the listener id for inserts.
-        MockRemoteCacheListener<String, Long> clusterListener = new MockRemoteCacheListener<String, Long>();
+        MockRemoteCacheListener<String, Long> clusterListener = new MockRemoteCacheListener<>();
         clusterListener.remoteType = RemoteType.CLUSTER;
 
         // this should get the updates
-        MockRemoteCacheListener<String, Long> localListener = new MockRemoteCacheListener<String, Long>();
+        MockRemoteCacheListener<String, Long> localListener = new MockRemoteCacheListener<>();
         localListener.remoteType = RemoteType.LOCAL;
 
         String cacheName = "testSimpleRegisterListenerAndPut_FromClusterWithLCC";
@@ -288,12 +288,12 @@ public class RemoteCacheServerUnitTest
         server.addCacheListener( cacheName, localListener );
 
         // DO WORK
-        List<ICacheElement<String, Long>> inputItems = new LinkedList<ICacheElement<String,Long>>();
+        List<ICacheElement<String, Long>> inputItems = new LinkedList<>();
         int numToPut = 10;
 
         for ( int i = 0; i < numToPut; i++ )
         {
-            ICacheElement<String, Long> element = new CacheElement<String, Long>( cacheName, String.valueOf( i ), Long.valueOf( i ) );
+            ICacheElement<String, Long> element = new CacheElement<>( cacheName, String.valueOf( i ), Long.valueOf( i ) );
             inputItems.add( element );
             // update using the cluster listener id
             server.update( element, clusterListener.getListenerId() );
@@ -321,7 +321,7 @@ public class RemoteCacheServerUnitTest
     public void testSimpleRegisterListenerAndRemove()
         throws Exception
     {
-        MockRemoteCacheListener<String, String> mockListener = new MockRemoteCacheListener<String, String>();
+        MockRemoteCacheListener<String, String> mockListener = new MockRemoteCacheListener<>();
 
         String cacheName = "testSimpleRegisterListenerAndPut";
         server.addCacheListener( cacheName, mockListener );
@@ -358,7 +358,7 @@ public class RemoteCacheServerUnitTest
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         server.setCacheEventLogger( cacheEventLogger );
 
-        ICacheElement<String, String> item = new CacheElement<String, String>( "region", "key", "value" );
+        ICacheElement<String, String> item = new CacheElement<>( "region", "key", "value" );
 
         // DO WORK
         server.update( item );
@@ -418,7 +418,7 @@ public class RemoteCacheServerUnitTest
         server.setCacheEventLogger( cacheEventLogger );
 
         // DO WORK
-        server.getMultiple( "region", new HashSet<String>() );
+        server.getMultiple( "region", new HashSet<>() );
 
         // VERIFY
         assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactoryUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactoryUnitTest.java
index b12824f..e43688c 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactoryUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactoryUnitTest.java
@@ -130,7 +130,7 @@ public class RemoteCacheRequestFactoryUnitTest
         long requesterId = 2;
 
         CacheElement<Serializable, Serializable> element =
-            new CacheElement<Serializable, Serializable>( cacheName, key, null );
+            new CacheElement<>( cacheName, key, null );
 
         // DO WORK
         RemoteCacheRequest<Serializable, Serializable> result =
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/CacheEventQueueFactoryUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/CacheEventQueueFactoryUnitTest.java
index 60b72f3..b5d3637 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/CacheEventQueueFactoryUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/CacheEventQueueFactoryUnitTest.java
@@ -35,10 +35,10 @@ public class CacheEventQueueFactoryUnitTest
     {
         // SETUP
         QueueType eventQueueType = QueueType.SINGLE;
-        ICacheListener<String, String> listener = new MockRemoteCacheListener<String, String>();
+        ICacheListener<String, String> listener = new MockRemoteCacheListener<>();
         long listenerId = 1;
 
-        CacheEventQueueFactory<String, String> factory = new CacheEventQueueFactory<String, String>();
+        CacheEventQueueFactory<String, String> factory = new CacheEventQueueFactory<>();
 
         // DO WORK
         ICacheEventQueue<String, String> result = factory.createCacheEventQueue( listener, listenerId, "cacheName", "threadPoolName", eventQueueType );
@@ -53,10 +53,10 @@ public class CacheEventQueueFactoryUnitTest
     {
         // SETUP
         QueueType eventQueueType = QueueType.POOLED;
-        ICacheListener<String, String> listener = new MockRemoteCacheListener<String, String>();
+        ICacheListener<String, String> listener = new MockRemoteCacheListener<>();
         long listenerId = 1;
 
-        CacheEventQueueFactory<String, String> factory = new CacheEventQueueFactory<String, String>();
+        CacheEventQueueFactory<String, String> factory = new CacheEventQueueFactory<>();
 
         // DO WORK
         ICacheEventQueue<String, String> result = factory.createCacheEventQueue( listener, listenerId, "cacheName", "threadPoolName", eventQueueType );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/EventQueueConcurrentLoadTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/EventQueueConcurrentLoadTest.java
index 799ebf4..a38267e 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/EventQueueConcurrentLoadTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/EventQueueConcurrentLoadTest.java
@@ -148,8 +148,8 @@ public class EventQueueConcurrentLoadTest
     @Override
     public void setUp()
     {
-        listen = new CacheListenerImpl<String, String>();
-        queue = new CacheEventQueue<String, String>( listen, 1L, "testCache1", maxFailure, waitBeforeRetry );
+        listen = new CacheListenerImpl<>();
+        queue = new CacheEventQueue<>( listen, 1L, "testCache1", maxFailure, waitBeforeRetry );
 
         queue.setWaitToDieMillis( idleTime );
     }
@@ -165,7 +165,7 @@ public class EventQueueConcurrentLoadTest
     {
         for ( int i = 0; i <= end; i++ )
         {
-            CacheElement<String, String> elem = new CacheElement<String, String>( "testCache1", i + ":key", i + "data" );
+            CacheElement<String, String> elem = new CacheElement<>( "testCache1", i + ":key", i + "data" );
             queue.addPutEvent( elem );
         }
 
@@ -221,7 +221,7 @@ public class EventQueueConcurrentLoadTest
         System.out.println( "queue is empty, begin" );
 
         // get it going
-        CacheElement<String, String> elem = new CacheElement<String, String>( "testCache1", "a:key", "adata" );
+        CacheElement<String, String> elem = new CacheElement<>( "testCache1", "a:key", "adata" );
         queue.addPutEvent( elem );
 
         for ( int i = 0; i <= end; i++ )
@@ -237,7 +237,7 @@ public class EventQueueConcurrentLoadTest
                     this.wait( idleTime / 2 );
                 }
             }
-            CacheElement<String, String> elem2 = new CacheElement<String, String>( "testCache1", i + ":key", i + "data" );
+            CacheElement<String, String> elem2 = new CacheElement<>( "testCache1", i + ":key", i + "data" );
             queue.addPutEvent( elem2 );
         }
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/MockCacheServiceNonLocal.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/MockCacheServiceNonLocal.java
index a2d71b9..662d2d7 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/MockCacheServiceNonLocal.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/MockCacheServiceNonLocal.java
@@ -49,10 +49,10 @@ public class MockCacheServiceNonLocal<K, V>
     public ICacheElement<K, V> lastUpdate;
 
     /** List of updates. */
-    public List<ICacheElement<K, V>> updateRequestList = new ArrayList<ICacheElement<K,V>>();
+    public List<ICacheElement<K, V>> updateRequestList = new ArrayList<>();
 
     /** List of request ids. */
-    public List<Long> updateRequestIdList = new ArrayList<Long>();
+    public List<Long> updateRequestIdList = new ArrayList<>();
 
     /** The key that was last passed to remove. */
     public K lastRemoveKey;
@@ -80,7 +80,7 @@ public class MockCacheServiceNonLocal<K, V>
     @Override
     public Set<K> getKeySet( String cacheName )
     {
-        return new HashSet<K>();
+        return new HashSet<>();
     }
 
     /**
@@ -199,7 +199,7 @@ public class MockCacheServiceNonLocal<K, V>
     public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
     {
         lastGetMultipleKeys = keys;
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 
     /**
@@ -240,6 +240,6 @@ public class MockCacheServiceNonLocal<K, V>
         throws IOException
     {
         lastGetMatchingPattern = pattern;
-        return new HashMap<K, ICacheElement<K, V>>();
+        return new HashMap<>();
     }
 }
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java
index 81aae25..1fa5bb6 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java
@@ -37,14 +37,14 @@ public class ZombieCacheServiceNonLocalUnitTest
         throws Exception
     {
         // SETUP
-        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<String, String>();
+        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<>();
 
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 10 );
 
         String cacheName = "testUpdate";
 
         // DO WORK
-        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( cacheName, "key", "value" );
         zombie.update( element, 123l );
         zombie.propagateEvents( service );
 
@@ -61,14 +61,14 @@ public class ZombieCacheServiceNonLocalUnitTest
         throws Exception
     {
         // SETUP
-        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<String, String>();
+        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<>();
 
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 0 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 0 );
 
         String cacheName = "testUpdate";
 
         // DO WORK
-        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<>( cacheName, "key", "value" );
         zombie.update( element, 123l );
         zombie.propagateEvents( service );
 
@@ -85,9 +85,9 @@ public class ZombieCacheServiceNonLocalUnitTest
         throws Exception
     {
         // SETUP
-        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<String, String>();
+        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<>();
 
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 10 );
 
         String cacheName = "testRemoveThenWalk";
         String key = "myKey";
@@ -109,9 +109,9 @@ public class ZombieCacheServiceNonLocalUnitTest
         throws Exception
     {
         // SETUP
-        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<String, String>();
+        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<>();
 
-        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<>( 10 );
 
         String cacheName = "testRemoveThenWalk";
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
index 3f7a520..c965166 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
@@ -103,16 +103,16 @@ public class CompositeCacheDiskUsageUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>( cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxCache<String, String> mock = new MockAuxCache<>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { mock };
         cache.setAuxCaches( auxArray );
 
-        ICacheElement<String, String> inputElement = new CacheElement<String, String>( CACHE_NAME, "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<>( CACHE_NAME, "key", "value" );
 
         // DO WORK
         cache.spoolToDisk( inputElement );
@@ -135,16 +135,16 @@ public class CompositeCacheDiskUsageUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>( cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxCache<String, String> mock = new MockAuxCache<>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { mock };
         cache.setAuxCaches( auxArray );
 
-        ICacheElement<String, String> inputElement = new CacheElement<String, String>( CACHE_NAME, "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<>( CACHE_NAME, "key", "value" );
 
         // DO WORK
         cache.spoolToDisk( inputElement );
@@ -171,16 +171,16 @@ public class CompositeCacheDiskUsageUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>( cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxCache<String, String> mock = new MockAuxCache<>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { mock };
         cache.setAuxCaches( auxArray );
 
-        ICacheElement<String, String> inputElement = new CacheElement<String, String>( CACHE_NAME, "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<>( CACHE_NAME, "key", "value" );
 
         // DO WORK
         cache.updateAuxiliaries( inputElement, true );
@@ -209,16 +209,16 @@ public class CompositeCacheDiskUsageUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>( cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxCache<String, String> mock = new MockAuxCache<>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { mock };
         cache.setAuxCaches( auxArray );
 
-        ICacheElement<String, String> inputElement = new CacheElement<String, String>( CACHE_NAME, "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<>( CACHE_NAME, "key", "value" );
 
         // DO WORK
         cache.updateAuxiliaries( inputElement, false );
@@ -247,16 +247,16 @@ public class CompositeCacheDiskUsageUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>( cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxCache<String, String> mock = new MockAuxCache<>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { mock };
         cache.setAuxCaches( auxArray );
 
-        ICacheElement<String, String> inputElement = new CacheElement<String, String>( CACHE_NAME, "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<>( CACHE_NAME, "key", "value" );
 
         // DO WORK
         cache.updateAuxiliaries( inputElement, true );
@@ -283,19 +283,19 @@ public class CompositeCacheDiskUsageUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>( cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxCache<String, String> mock = new MockAuxCache<>();
         mock.cacheType = CacheType.DISK_CACHE;
 
-        MockAuxCache<String, String> mockLateral = new MockAuxCache<String, String>();
+        MockAuxCache<String, String> mockLateral = new MockAuxCache<>();
         mockLateral.cacheType = CacheType.LATERAL_CACHE;
 
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { mock, mockLateral };
         cache.setAuxCaches( auxArray );
 
-        ICacheElement<String, String> inputElement = new CacheElement<String, String>( CACHE_NAME, "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<>( CACHE_NAME, "key", "value" );
 
         // DO WORK
         cache.updateAuxiliaries( inputElement, false );
@@ -366,7 +366,7 @@ public class CompositeCacheDiskUsageUnitTest
         @Override
         public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
         {
-            return new HashMap<K, ICacheElement<K, V>>();
+            return new HashMap<>();
         }
 
         /**
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheUnitTest.java
index 7f012c6..a7b0d3b 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheUnitTest.java
@@ -59,9 +59,9 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<>();
         diskMock.cacheType = CacheType.DISK_CACHE;
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
@@ -71,7 +71,7 @@ public class CompositeCacheUnitTest
         int numToInsert = 10;
         for ( int i = 0; i < numToInsert; i++ )
         {
-            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<>( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element, false );
         }
 
@@ -99,9 +99,9 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<>();
         diskMock.cacheType = CacheType.REMOTE_CACHE;
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
@@ -111,7 +111,7 @@ public class CompositeCacheUnitTest
         int numToInsert = 10;
         for ( int i = 0; i < numToInsert; i++ )
         {
-            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<>( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element, false );
         }
 
@@ -142,9 +142,9 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<>();
         diskMock.cacheType = CacheType.DISK_CACHE;
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
@@ -155,7 +155,7 @@ public class CompositeCacheUnitTest
         // insert with prefix1
         for ( int i = 0; i < numToInsertPrefix1; i++ )
         {
-            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( cacheName, keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<>( cacheName, keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element, false );
         }
 
@@ -163,7 +163,7 @@ public class CompositeCacheUnitTest
         // insert with prefix1
         for ( int i = 0; i < numToInsertPrefix2; i++ )
         {
-            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( cacheName, keyprefix2 + String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<>( cacheName, keyprefix2 + String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element, false );
         }
 
@@ -194,9 +194,9 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<>();
         diskMock.cacheType = CacheType.DISK_CACHE;
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
@@ -228,9 +228,9 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<>( cattr, attr );
 
-        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<>();
         diskMock.cacheType = CacheType.REMOTE_CACHE;
         @SuppressWarnings("unchecked")
         AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/MockCompositeCacheManager.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/MockCompositeCacheManager.java
index 53b2f14..1099919 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/MockCompositeCacheManager.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/MockCompositeCacheManager.java
@@ -49,7 +49,7 @@ public class MockCompositeCacheManager
         {
 //            System.out.println( "Creating mock cache" );
             CompositeCache<K, V> newCache =
-                new CompositeCache<K, V>( new CompositeCacheAttributes(), new ElementAttributes() );
+                new CompositeCache<>( new CompositeCacheAttributes(), new ElementAttributes() );
             this.setCache( newCache );
         }
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/logging/MockCacheEventLogger.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/logging/MockCacheEventLogger.java
index 6e7c35f..b2768c6 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/logging/MockCacheEventLogger.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/logging/MockCacheEventLogger.java
@@ -65,7 +65,7 @@ public class MockCacheEventLogger
     public <T> ICacheEvent<T> createICacheEvent( String source, String region, String eventName, String optionalDetails,
                                           T key )
     {
-        return new CacheEvent<T>();
+        return new CacheEvent<>();
     }
 
     /**
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java
index 5b8ee37..9847b62 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java
@@ -35,7 +35,7 @@ public class KeyMatcherPatternImpllUnitTest
     {
         // SETUP
         int numToInsertPrefix1 = 10;
-        Set<String> keyArray = new HashSet<String>();
+        Set<String> keyArray = new HashSet<>();
 
         String keyprefix1 = "MyPrefixC";
 
@@ -45,7 +45,7 @@ public class KeyMatcherPatternImpllUnitTest
             keyArray.add(keyprefix1 + String.valueOf( i ));
         }
 
-        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<String>();
+        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<>();
 
         // DO WORK
         Set<String> result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".", keyArray );
@@ -61,7 +61,7 @@ public class KeyMatcherPatternImpllUnitTest
     {
         // SETUP
         int numToInsertPrefix1 = 10;
-        Set<String> keyArray = new HashSet<String>();
+        Set<String> keyArray = new HashSet<>();
 
         String keyprefix1 = "MyPrefixC";
 
@@ -71,7 +71,7 @@ public class KeyMatcherPatternImpllUnitTest
             keyArray.add(keyprefix1 + String.valueOf( i ));
         }
 
-        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<String>();
+        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<>();
 
         // DO WORK
         Set<String> result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + "\\S+", keyArray );
@@ -88,7 +88,7 @@ public class KeyMatcherPatternImpllUnitTest
         // SETUP
         int numToInsertPrefix1 = 10;
         int numToInsertPrefix2 = 50;
-        Set<String> keyArray = new HashSet<String>();
+        Set<String> keyArray = new HashSet<>();
 
         String keyprefix1 = "MyPrefixA";
         String keyprefix2 = "MyPrefixB";
@@ -105,7 +105,7 @@ public class KeyMatcherPatternImpllUnitTest
             keyArray.add(keyprefix2 + String.valueOf( i ));
         }
 
-        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<String>();
+        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<>();
 
         // DO WORK
         Set<String> result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".+", keyArray );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/MockMemoryCache.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/MockMemoryCache.java
index 6a1f550..d4ba8ca 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/MockMemoryCache.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/MockMemoryCache.java
@@ -44,7 +44,7 @@ public class MockMemoryCache<K, V>
     private ICompositeCacheAttributes cacheAttr;
 
     /** Internal map */
-    private final HashMap<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K, V>>();
+    private final HashMap<K, ICacheElement<K, V>> map = new HashMap<>();
 
     /** The number of times waterfall was called. */
     public int waterfallCallCount = 0;
@@ -93,7 +93,7 @@ public class MockMemoryCache<K, V>
     @Override
     public Set<K> getKeySet()
     {
-        return new LinkedHashSet<K>(map.keySet());
+        return new LinkedHashSet<>(map.keySet());
     }
 
     /**
@@ -139,7 +139,7 @@ public class MockMemoryCache<K, V>
     public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
         throws IOException
     {
-        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<>();
 
         if ( keys != null && !keys.isEmpty() )
         {
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java
index c3d82b3..35b6cff 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java
@@ -50,16 +50,16 @@ public class FIFOMemoryCacheUnitTest
         attributes.setMaxObjects( maxObjects );
         attributes.setSpoolChunkSize( 1 );
 
-        FIFOMemoryCache<String, String> cache = new FIFOMemoryCache<String, String>();
-        cache.initialize( new CompositeCache<String, String>( attributes, new ElementAttributes() ) );
+        FIFOMemoryCache<String, String> cache = new FIFOMemoryCache<>();
+        cache.initialize( new CompositeCache<>( attributes, new ElementAttributes() ) );
 
         for ( int i = 0; i <= maxObjects; i++ )
         {
-            CacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key" + i, "value" + i );
+            CacheElement<String, String> element = new CacheElement<>( cacheName, "key" + i, "value" + i );
             cache.update( element );
         }
 
-        CacheElement<String, String> oneMoreElement = new CacheElement<String, String>( cacheName, "onemore", "onemore" );
+        CacheElement<String, String> oneMoreElement = new CacheElement<>( cacheName, "onemore", "onemore" );
 
         // DO WORK
         cache.update( oneMoreElement );
@@ -91,13 +91,13 @@ public class FIFOMemoryCacheUnitTest
         attributes.setMaxObjects( maxObjects );
         attributes.setSpoolChunkSize( 1 );
 
-        FIFOMemoryCache<String, String> cache = new FIFOMemoryCache<String, String>();
-        cache.initialize( new CompositeCache<String, String>( attributes, new ElementAttributes() ) );
+        FIFOMemoryCache<String, String> cache = new FIFOMemoryCache<>();
+        cache.initialize( new CompositeCache<>( attributes, new ElementAttributes() ) );
 
         // DO WORK
         for ( int i = 0; i <= (maxObjects * 2); i++ )
         {
-            CacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key" + i, "value" + i );
+            CacheElement<String, String> element = new CacheElement<>( cacheName, "key" + i, "value" + i );
             cache.update( element );
         }
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java
index 733b3c7..e981456 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java
@@ -113,14 +113,14 @@ public class LHMLRUMemoryCacheConcurrentUnitTest
         cacheMgr.configure( "/TestLHMLRUCache.ccf" );
         CompositeCache<String, String> cache = cacheMgr.getCache( region );
 
-        LRUMemoryCache<String, String> lru = new LRUMemoryCache<String, String>();
+        LRUMemoryCache<String, String> lru = new LRUMemoryCache<>();
         lru.initialize( cache );
 
         // Add items to cache
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", region + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<>( cache.getCacheName(), i + ":key", region + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             lru.update( ice );
         }
@@ -139,7 +139,7 @@ public class LHMLRUMemoryCacheConcurrentUnitTest
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java
index c8595b0..03adb35 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java
@@ -95,7 +95,7 @@ public class LHMLRUMemoryCacheUnitTest
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
@@ -252,7 +252,7 @@ public class LHMLRUMemoryCacheUnitTest
         cacheMgr.configure( "/TestLHMLRUCache.ccf" );
         CompositeCache<String, String> cache = cacheMgr.getCache( "testGetKeyArray" );
 
-        LHMLRUMemoryCache<String, String> mru = new LHMLRUMemoryCache<String, String>();
+        LHMLRUMemoryCache<String, String> mru = new LHMLRUMemoryCache<>();
         mru.initialize( cache );
 
         int max = cache.getCacheAttributes().getMaxObjects();
@@ -260,7 +260,7 @@ public class LHMLRUMemoryCacheUnitTest
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<>( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             mru.update( ice );
         }
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
index 3efcc77..031691d 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
@@ -112,14 +112,14 @@ public class LRUMemoryCacheConcurrentUnitTest
         cacheMgr.configure( "/TestDiskCache.ccf" );
         CompositeCache<String, String> cache = cacheMgr.getCache( region );
 
-        LRUMemoryCache<String, String> lru = new LRUMemoryCache<String, String>();
+        LRUMemoryCache<String, String> lru = new LRUMemoryCache<>();
         lru.initialize( cache );
 
         // Add items to cache
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", region + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<>( cache.getCacheName(), i + ":key", region + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             lru.update( ice );
         }
@@ -138,7 +138,7 @@ public class LRUMemoryCacheConcurrentUnitTest
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java
index 093c14e..7b427d2 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java
@@ -95,7 +95,7 @@ public class MRUMemoryCacheUnitTest
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
@@ -252,7 +252,7 @@ public class MRUMemoryCacheUnitTest
         cacheMgr.configure( "/TestMRUCache.ccf" );
         CompositeCache<String, String> cache = cacheMgr.getCache( "testGetKeyArray" );
 
-        MRUMemoryCache<String, String> mru = new MRUMemoryCache<String, String>();
+        MRUMemoryCache<String, String> mru = new MRUMemoryCache<>();
         mru.initialize( cache );
 
         int max = cache.getCacheAttributes().getMaxObjects();
@@ -260,7 +260,7 @@ public class MRUMemoryCacheUnitTest
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<>( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             mru.update( ice );
         }
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java
index f38e9f8..97511fe 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java
@@ -51,12 +51,12 @@ public class ShrinkerThreadUnitTest
         cacheAttr.setMaxMemoryIdleTimeSeconds( 10 );
         cacheAttr.setMaxSpoolPerRun( 10 );
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>(cacheAttr, new ElementAttributes());
+        CompositeCache<String, String> cache = new CompositeCache<>(cacheAttr, new ElementAttributes());
 
         String key = "key";
         String value = "value";
 
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value );
+        ICacheElement<String, String> element = new CacheElement<>( "testRegion", key, value );
         ElementAttributes elementAttr = new ElementAttributes();
         elementAttr.setIsEternal( false );
         element.setElementAttributes( elementAttr );
@@ -86,12 +86,12 @@ public class ShrinkerThreadUnitTest
         cacheAttr.setMaxMemoryIdleTimeSeconds( 10 );
         cacheAttr.setMaxSpoolPerRun( 10 );
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>(cacheAttr, new ElementAttributes());
+        CompositeCache<String, String> cache = new CompositeCache<>(cacheAttr, new ElementAttributes());
 
         String key = "key";
         String value = "value";
 
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value );
+        ICacheElement<String, String> element = new CacheElement<>( "testRegion", key, value );
         ElementAttributes elementAttr = new ElementAttributes();
         elementAttr.setIsEternal( false );
         element.setElementAttributes( elementAttr );
@@ -121,12 +121,12 @@ public class ShrinkerThreadUnitTest
         cacheAttr.setMaxMemoryIdleTimeSeconds( 10 );
         cacheAttr.setMaxSpoolPerRun( 10 );
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>(cacheAttr, new ElementAttributes());
+        CompositeCache<String, String> cache = new CompositeCache<>(cacheAttr, new ElementAttributes());
 
         String key = "key";
         String value = "value";
 
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value );
+        ICacheElement<String, String> element = new CacheElement<>( "testRegion", key, value );
         ElementAttributes elementAttr = new ElementAttributes();
         elementAttr.setIsEternal( false );
         element.setElementAttributes( elementAttr );
@@ -157,12 +157,12 @@ public class ShrinkerThreadUnitTest
         cacheAttr.setMaxMemoryIdleTimeSeconds( 10 );
         cacheAttr.setMaxSpoolPerRun( 10 );
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>(cacheAttr, new ElementAttributes());
+        CompositeCache<String, String> cache = new CompositeCache<>(cacheAttr, new ElementAttributes());
 
         String key = "key";
         String value = "value";
 
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value );
+        ICacheElement<String, String> element = new CacheElement<>( "testRegion", key, value );
         ElementAttributes elementAttr = new ElementAttributes();
         elementAttr.setIsEternal( false );
         element.setElementAttributes( elementAttr );
@@ -198,13 +198,13 @@ public class ShrinkerThreadUnitTest
         cacheAttr.setMaxMemoryIdleTimeSeconds( 1 );
         cacheAttr.setMaxSpoolPerRun( 10 );
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>(cacheAttr, new ElementAttributes());
+        CompositeCache<String, String> cache = new CompositeCache<>(cacheAttr, new ElementAttributes());
         MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();
 
         String key = "key";
         String value = "value";
 
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value );
+        ICacheElement<String, String> element = new CacheElement<>( "testRegion", key, value );
 
         ElementAttributes elementAttr = new ElementAttributes();
         elementAttr.setIsEternal( false );
@@ -219,7 +219,7 @@ public class ShrinkerThreadUnitTest
         ElementAttributesUtils.setLastAccessTime( elementAttr,  System.currentTimeMillis() - 2000 );
 
         // DO WORK
-        ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( cache );
+        ShrinkerThread<String, String> shrinker = new ShrinkerThread<>( cache );
         shrinker.run();
 
         Thread.sleep( 500 );
@@ -245,7 +245,7 @@ public class ShrinkerThreadUnitTest
         cacheAttr.setMaxMemoryIdleTimeSeconds( 1 );
         cacheAttr.setMaxSpoolPerRun( 3 );
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>(cacheAttr, new ElementAttributes());
+        CompositeCache<String, String> cache = new CompositeCache<>(cacheAttr, new ElementAttributes());
         MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();
 
         for ( int i = 0; i < 10; i++ )
@@ -253,7 +253,7 @@ public class ShrinkerThreadUnitTest
             String key = "key" + i;
             String value = "value";
 
-            ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value );
+            ICacheElement<String, String> element = new CacheElement<>( "testRegion", key, value );
 
             ElementAttributes elementAttr = new ElementAttributes();
             elementAttr.setIsEternal( false );
@@ -269,7 +269,7 @@ public class ShrinkerThreadUnitTest
         }
 
         // DO WORK
-        ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( cache );
+        ShrinkerThread<String, String> shrinker = new ShrinkerThread<>( cache );
         shrinker.run();
 
         // VERIFY
@@ -295,7 +295,7 @@ public class ShrinkerThreadUnitTest
         cacheAttr.setMaxMemoryIdleTimeSeconds( 1 );
         cacheAttr.setMaxSpoolPerRun( 3 );
 
-        CompositeCache<String, String> cache = new CompositeCache<String, String>(cacheAttr, new ElementAttributes());
+        CompositeCache<String, String> cache = new CompositeCache<>(cacheAttr, new ElementAttributes());
         MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();
 
         ElementEventHandlerMockImpl handler = new ElementEventHandlerMockImpl();
@@ -305,7 +305,7 @@ public class ShrinkerThreadUnitTest
             String key = "key" + i;
             String value = "value";
 
-            ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value );
+            ICacheElement<String, String> element = new CacheElement<>( "testRegion", key, value );
 
             ElementAttributes elementAttr = new ElementAttributes();
             elementAttr.addElementEventHandler( handler );
@@ -322,7 +322,7 @@ public class ShrinkerThreadUnitTest
         }
 
         // DO WORK
-        ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( cache );
+        ShrinkerThread<String, String> shrinker = new ShrinkerThread<>( cache );
         shrinker.run();
 
         // VERIFY
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCacheUnitTest.java
index 68164b1..3a96d68 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCacheUnitTest.java
@@ -98,7 +98,7 @@ public class SoftReferenceMemoryCacheUnitTest
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
@@ -187,7 +187,7 @@ public class SoftReferenceMemoryCacheUnitTest
         cacheMgr.configure( "/TestSoftReferenceCache.ccf" );
         CompositeCache<String, String> cache = cacheMgr.getCache( "testGetKeyArray" );
 
-        SoftReferenceMemoryCache<String, String> srmc = new SoftReferenceMemoryCache<String, String>();
+        SoftReferenceMemoryCache<String, String> srmc = new SoftReferenceMemoryCache<>();
         srmc.initialize( cache );
 
         int max = cache.getCacheAttributes().getMaxObjects();
@@ -195,7 +195,7 @@ public class SoftReferenceMemoryCacheUnitTest
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<>( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             srmc.update( ice );
         }
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/access/JCSWorkerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/access/JCSWorkerUnitTest.java
index 9f504fd..7dec5d3 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/access/JCSWorkerUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/access/JCSWorkerUnitTest.java
@@ -42,7 +42,7 @@ public class JCSWorkerUnitTest
     public void testSimpleGet()
         throws Exception
     {
-        JCSWorker<String, Long> cachingWorker = new JCSWorker<String, Long>( "example region" );
+        JCSWorker<String, Long> cachingWorker = new JCSWorker<>( "example region" );
 
         // This is the helper.
         JCSWorkerHelper<Long> helper = new AbstractJCSWorkerHelper<Long>()
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/MockDiscoveryListener.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/MockDiscoveryListener.java
index a8b5f75..746639a 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/MockDiscoveryListener.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/MockDiscoveryListener.java
@@ -29,7 +29,7 @@ public class MockDiscoveryListener
     implements IDiscoveryListener
 {
     /** discovered services. */
-    public List<DiscoveredService> discoveredServices = new ArrayList<DiscoveredService>();
+    public List<DiscoveredService> discoveredServices = new ArrayList<>();
 
     /**
      * Adds the entry to a list. I'm not using a set. I want to see if we get dupes.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
index 93ac1ff..c47b52e 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
@@ -87,7 +87,7 @@ public class UDPDiscoverySenderUnitTest
         throws Exception
     {
         // SETUP
-        ArrayList<String> cacheNames = new ArrayList<String>();
+        ArrayList<String> cacheNames = new ArrayList<>();
 
         // DO WORK
         sender.passiveBroadcast( SENDING_HOST, SENDING_PORT, cacheNames, 1L );
@@ -114,7 +114,7 @@ public class UDPDiscoverySenderUnitTest
         throws Exception
     {
         // SETUP
-        ArrayList<String> cacheNames = new ArrayList<String>();
+        ArrayList<String> cacheNames = new ArrayList<>();
 
         // DO WORK
         sender.removeBroadcast( SENDING_HOST, SENDING_PORT, cacheNames, 1L );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java
index a77b1c7..054c152 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java
@@ -48,7 +48,7 @@ public class UDPDiscoveryServiceUnitTest
 
         DiscoveredService discoveredService = new DiscoveredService();
         discoveredService.setServiceAddress( host );
-        discoveredService.setCacheNames( new ArrayList<String>() );
+        discoveredService.setCacheNames( new ArrayList<>() );
         discoveredService.setServicePort( 1000 );
         discoveredService.setLastHearFromTime( 100 );
 
@@ -81,7 +81,7 @@ public class UDPDiscoveryServiceUnitTest
         MockDiscoveryListener discoveryListener = new MockDiscoveryListener();
         service.addDiscoveryListener( discoveryListener );
 
-        ArrayList<String> sametCacheNames = new ArrayList<String>();
+        ArrayList<String> sametCacheNames = new ArrayList<>();
         sametCacheNames.add( "name1" );
 
         DiscoveredService discoveredService = new DiscoveredService();
@@ -146,11 +146,11 @@ public class UDPDiscoveryServiceUnitTest
 
         DiscoveredService discoveredService = new DiscoveredService();
         discoveredService.setServiceAddress( host );
-        discoveredService.setCacheNames( new ArrayList<String>() );
+        discoveredService.setCacheNames( new ArrayList<>() );
         discoveredService.setServicePort( 1000 );
         discoveredService.setLastHearFromTime( 100 );
 
-        ArrayList<String> differentCacheNames = new ArrayList<String>();
+        ArrayList<String> differentCacheNames = new ArrayList<>();
         differentCacheNames.add( "name1" );
         DiscoveredService discoveredService2 = new DiscoveredService();
         discoveredService2.setServiceAddress( host );
@@ -208,7 +208,7 @@ public class UDPDiscoveryServiceUnitTest
 
         DiscoveredService discoveredService = new DiscoveredService();
         discoveredService.setServiceAddress( host );
-        discoveredService.setCacheNames( new ArrayList<String>() );
+        discoveredService.setCacheNames( new ArrayList<>() );
         discoveredService.setServicePort( 1000 );
         discoveredService.setLastHearFromTime( 100 );
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryUnitTest.java
index 3590038..32855c1 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryUnitTest.java
@@ -63,7 +63,7 @@ public class UDPDiscoveryUnitTest
 
         // create more names than we have no wait facades for
         // the only one that gets added should be testCache1
-        ArrayList<String> cacheNames = new ArrayList<String>();
+        ArrayList<String> cacheNames = new ArrayList<>();
         int numJunk = 10;
         for ( int i = 0; i < numJunk; i++ )
         {
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtilUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtilUnitTest.java
index df5cb2d..9f8b6a1 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtilUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtilUnitTest.java
@@ -95,7 +95,7 @@ public class SerializationConversionUtilUnitTest
         IElementAttributes attr = new ElementAttributes();
         attr.setMaxLife(34);
 
-        ICacheElement<String, String> before = new CacheElement<String, String>( cacheName, key, value );
+        ICacheElement<String, String> before = new CacheElement<>( cacheName, key, value );
         before.setElementAttributes( attr );
 
         // DO WORK
@@ -136,7 +136,7 @@ public class SerializationConversionUtilUnitTest
         IElementAttributes attr = new ElementAttributes();
         attr.setMaxLife(34);
 
-        ICacheElement<String, String> before = new CacheElement<String, String>( cacheName, key, value );
+        ICacheElement<String, String> before = new CacheElement<>( cacheName, key, value );
         before.setElementAttributes( attr );
 
         // DO WORK
@@ -176,7 +176,7 @@ public class SerializationConversionUtilUnitTest
         IElementAttributes attr = new ElementAttributes();
         attr.setMaxLife(34);
 
-        ICacheElement<String, String> before = new CacheElement<String, String>( cacheName, key, value );
+        ICacheElement<String, String> before = new CacheElement<>( cacheName, key, value );
         before.setElementAttributes( attr );
 
         // DO WORK
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/DoubleLinkedListUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/DoubleLinkedListUnitTest.java
index 46bad53..a7ca1d8 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/DoubleLinkedListUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/DoubleLinkedListUnitTest.java
@@ -32,10 +32,10 @@ public class DoubleLinkedListUnitTest
     public void testAddLast_Empty()
     {
         // SETUP
-        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<DoubleLinkedListNode<String>>();
+        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<>();
 
         String payload1 = "payload1";
-        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>( payload1 );
+        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<>( payload1 );
 
         // WO WORK
         list.addLast( node1 );
@@ -48,13 +48,13 @@ public class DoubleLinkedListUnitTest
     public void testAddLast_NotEmpty()
     {
         // SETUP
-        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<DoubleLinkedListNode<String>>();
+        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<>();
 
         String payload1 = "payload1";
-        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>( payload1 );
+        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<>( payload1 );
 
         String payload2 = "payload2";
-        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>( payload2 );
+        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<>( payload2 );
 
         // WO WORK
         list.addLast( node1 );
@@ -68,13 +68,13 @@ public class DoubleLinkedListUnitTest
     public void testMakeLast_wasFirst()
     {
         // SETUP
-        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<DoubleLinkedListNode<String>>();
+        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<>();
 
         String payload1 = "payload1";
-        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>( payload1 );
+        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<>( payload1 );
 
         String payload2 = "payload2";
-        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>( payload2 );
+        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<>( payload2 );
 
         list.addFirst( node2 );
         list.addFirst(  node1 );
@@ -92,13 +92,13 @@ public class DoubleLinkedListUnitTest
     public void testMakeLast_wasLast()
     {
         // SETUP
-        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<DoubleLinkedListNode<String>>();
+        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<>();
 
         String payload1 = "payload1";
-        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>( payload1 );
+        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<>( payload1 );
 
         String payload2 = "payload2";
-        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>( payload2 );
+        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<>( payload2 );
 
         list.addFirst( node1 );
         list.addFirst(  node2 );
@@ -116,10 +116,10 @@ public class DoubleLinkedListUnitTest
     public void testMakeLast_wasAlone()
     {
         // SETUP
-        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<DoubleLinkedListNode<String>>();
+        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<>();
 
         String payload1 = "payload1";
-        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>( payload1 );
+        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<>( payload1 );
 
         list.addFirst( node1 );
 
@@ -136,16 +136,16 @@ public class DoubleLinkedListUnitTest
     public void testMakeLast_wasInMiddle()
     {
         // SETUP
-        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<DoubleLinkedListNode<String>>();
+        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<>();
 
         String payload1 = "payload1";
-        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>( payload1 );
+        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<>( payload1 );
 
         String payload2 = "payload2";
-        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>( payload2 );
+        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<>( payload2 );
 
         String payload3 = "payload3";
-        DoubleLinkedListNode<String> node3 = new DoubleLinkedListNode<String>( payload3 );
+        DoubleLinkedListNode<String> node3 = new DoubleLinkedListNode<>( payload3 );
 
         list.addFirst( node2 );
         list.addFirst(  node1 );
@@ -167,13 +167,13 @@ public class DoubleLinkedListUnitTest
         StringWriter stringWriter = new StringWriter();
         TestLogConfigurationUtil.configureLogger( stringWriter, DoubleLinkedList.class.getName() );
 
-        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<DoubleLinkedListNode<String>>();
+        DoubleLinkedList<DoubleLinkedListNode<String>> list = new DoubleLinkedList<>();
 
         String payload1 = "payload1";
-        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>( payload1 );
+        DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<>( payload1 );
 
         String payload2 = "payload2";
-        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>( payload2 );
+        DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<>( payload2 );
 
         list.addLast( node1 );
         list.addLast( node2 );
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/JCSvsCommonsLRUMapPerformanceTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/JCSvsCommonsLRUMapPerformanceTest.java
index a09e025..be6b546 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/JCSvsCommonsLRUMapPerformanceTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/JCSvsCommonsLRUMapPerformanceTest.java
@@ -113,7 +113,7 @@ public class JCSvsCommonsLRUMapPerformanceTest
         try
         {
 
-            Map<String, String> cache = new LRUMap<String, String>( tries );
+            Map<String, String> cache = new LRUMap<>( tries );
 
             for ( int j = 0; j < loops; j++ )
             {
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
index 6ce5625..46fbf8b 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
@@ -57,7 +57,7 @@ public class LRUMapConcurrentUnitTest
         TestSuite suite = new TestSuite( LRUMapConcurrentUnitTest.class );
 
         // run concurrent tests
-        final LRUMap<String, String> map = new LRUMap<String, String>( 2000 );
+        final LRUMap<String, String> map = new LRUMap<>( 2000 );
         suite.addTest( new LRUMapConcurrentUnitTest( "conc1" )
         {
             @Override
@@ -88,7 +88,7 @@ public class LRUMapConcurrentUnitTest
 
         // run more concurrent tests
         final int max2 = 20000;
-        final LRUMap<String, String> map2 = new LRUMap<String, String>( max2 );
+        final LRUMap<String, String> map2 = new LRUMap<>( max2 );
         suite.addTest( new LRUMapConcurrentUnitTest( "concB1" )
         {
             @Override
@@ -120,7 +120,7 @@ public class LRUMapConcurrentUnitTest
     public void testSimpleLoad()
         throws Exception
     {
-        LRUMap<String, String> map = new LRUMap<String, String>( items );
+        LRUMap<String, String> map = new LRUMap<>( items );
 
         for ( int i = 0; i < items; i++ )
         {
@@ -149,7 +149,7 @@ public class LRUMapConcurrentUnitTest
         throws Exception
     {
         int total = 10;
-        LRUMap<String, String> map = new LRUMap<String, String>( total );
+        LRUMap<String, String> map = new LRUMap<>( total );
 
         // put the max in
         for ( int i = 0; i < total; i++ )
@@ -187,7 +187,7 @@ public class LRUMapConcurrentUnitTest
         throws Exception
     {
         int total = 10000;
-        LRUMap<String, String> map = new LRUMap<String, String>( total );
+        LRUMap<String, String> map = new LRUMap<>( total );
 
         // put the max in
         for ( int i = 0; i < total * 2; i++ )
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapPerformanceTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapPerformanceTest.java
index e11d7ab..188ee83 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapPerformanceTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapPerformanceTest.java
@@ -107,7 +107,7 @@ public class LRUMapPerformanceTest
 
         try
         {
-            LRUMap<String, String> cache = new LRUMap<String, String>( tries );
+            LRUMap<String, String> cache = new LRUMap<>( tries );
 
             for ( int j = 0; j < loops; j++ )
             {
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapUnitTest.java
index e05c95d..3d33c95 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/struct/LRUMapUnitTest.java
@@ -42,7 +42,7 @@ public class LRUMapUnitTest
     public void testPutWithSizeLimit()
     {
         int size = 10;
-        Map<String, String> cache = new LRUMap<String, String>( size );
+        Map<String, String> cache = new LRUMap<>( size );
 
         for ( int i = 0; i < size; i++ )
         {
@@ -63,7 +63,7 @@ public class LRUMapUnitTest
     public void testPutWithNoSizeLimit()
     {
         int size = 10;
-        Map<String, String> cache = new LRUMap<String, String>( );
+        Map<String, String> cache = new LRUMap<>( );
 
         for ( int i = 0; i < size; i++ )
         {
@@ -84,7 +84,7 @@ public class LRUMapUnitTest
     public void testPutAndRemove()
     {
         int size = 10;
-        Map<String, String> cache = new LRUMap<String, String>( size );
+        Map<String, String> cache = new LRUMap<>( size );
 
         cache.put( "key:" + 1, "data:" + 1 );
         String data = cache.remove( "key:" + 1 );
@@ -98,7 +98,7 @@ public class LRUMapUnitTest
     public void testRemoveEmpty()
     {
         int size = 10;
-        Map<String, String> cache = new LRUMap<String, String>( size );
+        Map<String, String> cache = new LRUMap<>( size );
 
         Object returned = cache.remove( "key:" + 1 );
         assertNull( "Shouldn't hvae anything.", returned );
@@ -112,7 +112,7 @@ public class LRUMapUnitTest
     public void testGetEntrySet()
     {
         int size = 10;
-        Map<String, String> cache = new LRUMap<String, String>( size );
+        Map<String, String> cache = new LRUMap<>( size );
 
         for ( int i = 0; i < size; i++ )
         {


[commons-jcs] 03/09: Remove duplicate code

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit 79e8cbbf4afbf5803c50ab10d3f51e5a46425e03
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:38:26 2019 +0200

    Remove duplicate code
---
 .../utils/serialization/CompressingSerializer.java | 60 +++-------------------
 .../utils/serialization/StandardSerializer.java    |  7 ++-
 .../CompressingSerializerUnitTest.java             |  2 +-
 3 files changed, 10 insertions(+), 59 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/CompressingSerializer.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/CompressingSerializer.java
index 4b3aa53..f28a778 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/CompressingSerializer.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/CompressingSerializer.java
@@ -19,22 +19,14 @@ package org.apache.commons.jcs.utils.serialization;
  * under the License.
  */
 
-import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware;
-import org.apache.commons.jcs.utils.zip.CompressionUtil;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+
+import org.apache.commons.jcs.utils.zip.CompressionUtil;
 
 /**
  * Performs default serialization and de-serialization. It gzips the value.
  */
-public class CompressingSerializer
-    implements IElementSerializer
+public class CompressingSerializer extends StandardSerializer
 {
     /**
      * Serializes an object using default serialization. Compresses the byte array.
@@ -47,32 +39,12 @@ public class CompressingSerializer
     public <T> byte[] serialize( T obj )
         throws IOException
     {
-        byte[] uncompressed = serializeObject( obj );
+        byte[] uncompressed = super.serialize(obj);
         byte[] compressed = CompressionUtil.compressByteArray( uncompressed );
         return compressed;
     }
 
     /**
-     * Does the basic serialization.
-     * <p>
-     * @param obj object
-     * @return byte[]
-     * @throws IOException on i/o problem
-     */
-    protected <T> byte[] serializeObject( T obj )
-        throws IOException
-    {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-        try (ObjectOutputStream oos = new ObjectOutputStream( baos ))
-        {
-            oos.writeObject( obj );
-        }
-
-        return baos.toByteArray();
-    }
-
-    /**
      * Uses default de-serialization to turn a byte array into an object. Decompresses the value
      * first. All exceptions are converted into IOExceptions.
      * <p>
@@ -89,28 +61,8 @@ public class CompressingSerializer
         {
             return null;
         }
+        
         byte[] decompressedByteArray = CompressionUtil.decompressByteArray( data );
-        return deserializeObject( decompressedByteArray );
-    }
-
-    /**
-     * Does the standard deserialization.
-     * <p>
-     * @param decompressedByteArray array of decompressed bytes
-     * @return Object
-     * @throws IOException on i/o error
-     * @throws ClassNotFoundException if class is not found during deserialization
-     */
-    protected <T> T deserializeObject( byte[] decompressedByteArray )
-        throws IOException, ClassNotFoundException
-    {
-        ByteArrayInputStream bais = new ByteArrayInputStream( decompressedByteArray );
-
-        try (ObjectInputStream ois = new ObjectInputStreamClassLoaderAware( bais, null ))
-        {
-            @SuppressWarnings("unchecked") // Need to cast from Object
-            T readObject = (T) ois.readObject();
-            return readObject;
-        }
+        return super.deSerialize(decompressedByteArray, loader);
     }
 }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/StandardSerializer.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/StandardSerializer.java
index 28dac5b..7206b3f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/StandardSerializer.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/StandardSerializer.java
@@ -19,16 +19,15 @@ package org.apache.commons.jcs.utils.serialization;
  * under the License.
  */
 
-import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware;
-
-import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
+import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware;
+
 /**
  * Performs default serialization and de-serialization.
  * <p>
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/serialization/CompressingSerializerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/serialization/CompressingSerializerUnitTest.java
index 79c0658..6b09dca 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/serialization/CompressingSerializerUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/serialization/CompressingSerializerUnitTest.java
@@ -110,7 +110,7 @@ public class CompressingSerializerUnitTest
 
         // DO WORK
         byte[] compressed = serializer.serialize( before );
-        byte[] nonCompressed = serializer.serializeObject( before );
+        byte[] nonCompressed = new StandardSerializer().serialize( before );
 
         // VERIFY
         assertTrue( "Compressed should be smaller. compressed size = " + compressed.length + "nonCompressed size = "


[commons-jcs] 01/09: Remove most Iterators

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit d879971e521505d68cfa9e89b60d5a1eacbd16fc
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:33:34 2019 +0200

    Remove most Iterators
---
 .../jcs/auxiliary/disk/block/BlockDiskCache.java   |  33 +-
 .../auxiliary/disk/indexed/IndexedDiskCache.java   |  18 +-
 .../disk/jdbc/dsfactory/JndiDataSourceFactory.java | 364 ++++++++++-----------
 .../auxiliary/remote/server/RemoteCacheServer.java |  21 +-
 .../apache/commons/jcs/engine/CacheListeners.java  |  29 +-
 .../commons/jcs/engine/control/CompositeCache.java |  35 +-
 .../jcs/engine/memory/AbstractMemoryCache.java     |  32 +-
 .../jcs/engine/memory/lru/LHMLRUMemoryCache.java   |   1 -
 .../commons/jcs/utils/struct/AbstractLRUMap.java   |  49 +--
 9 files changed, 248 insertions(+), 334 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
index fa4bfe4..2eae22b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -203,24 +202,28 @@ public class BlockDiskCache<K, V>
 
         try
         {
-            int maxToTest = 100;
-            int count = 0;
-            Iterator<Map.Entry<K, int[]>> it = this.keyStore.entrySet().iterator();
-            while ( it.hasNext() && count < maxToTest )
-            {
-                count++;
-                Map.Entry<K, int[]> entry = it.next();
-                Object data = this.dataFile.read( entry.getValue() );
-                if ( data == null )
-                {
-                    throw new Exception( logCacheName + "Couldn't find data for key [" + entry.getKey() + "]" );
-                }
-            }
+            this.keyStore.entrySet().stream()
+                .limit(100)
+                .forEach(entry -> {
+                    try
+                    {
+                        Object data = this.dataFile.read(entry.getValue());
+                        if ( data == null )
+                        {
+                            throw new IOException("Data is null");
+                        }
+                    }
+                    catch (IOException | ClassNotFoundException e)
+                    {
+                        throw new RuntimeException(logCacheName
+                                + " Couldn't find data for key [" + entry.getKey() + "]", e);
+                    }
+                });
             alright = true;
         }
         catch ( Exception e )
         {
-            log.warn( logCacheName + "Problem verifying disk.  Message [" + e.getMessage() + "]" );
+            log.warn(logCacheName + " Problem verifying disk.", e);
             alright = false;
         }
         finally
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
index 30a82d3..42384f9 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
@@ -23,11 +23,10 @@ import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -1364,24 +1363,15 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
      * Creates a snapshot of the IndexedDiskElementDescriptors in the keyHash and returns them
      * sorted by position in the dataFile.
      * <p>
-     * TODO fix values() method on the LRU map.
-     * <p>
      *
      * @return IndexedDiskElementDescriptor[]
      */
     private IndexedDiskElementDescriptor[] createPositionSortedDescriptorList()
     {
-        IndexedDiskElementDescriptor[] defragList = new IndexedDiskElementDescriptor[keyHash.size()];
-        Iterator<Map.Entry<K, IndexedDiskElementDescriptor>> iterator = keyHash.entrySet().iterator();
-        for (int i = 0; iterator.hasNext(); i++)
-        {
-            Map.Entry<K, IndexedDiskElementDescriptor> next = iterator.next();
-            defragList[i] = next.getValue();
-        }
-
-        Arrays.sort(defragList, new PositionComparator());
+        List<IndexedDiskElementDescriptor> defragList = new ArrayList<>(keyHash.values());
+        Collections.sort(defragList, new PositionComparator());
 
-        return defragList;
+        return defragList.toArray(new IndexedDiskElementDescriptor[0]);
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
index 517db18..cd32e11 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
@@ -1,185 +1,179 @@
-package org.apache.commons.jcs.auxiliary.disk.jdbc.dsfactory;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.SQLException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-
-import org.apache.commons.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * A factory that looks up the DataSource from JNDI.  It is also able
- * to deploy the DataSource based on properties found in the
- * configuration.
- *
- * This factory tries to avoid excessive context lookups to improve speed.
- * The time between two lookups can be configured. The default is 0 (no cache).
- *
- * Borrowed and adapted from Apache DB Torque
- *
- * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
- * @author <a href="mailto:thomas@vandahl.org">Thomas Vandahl</a>
- */
-public class JndiDataSourceFactory implements DataSourceFactory
-{
-    /** The log. */
-    private static Log log = LogFactory.getLog(JndiDataSourceFactory.class);
-
-    /** The name of the factory. */
-    private String name;
-
-    /** The path to get the resource from. */
-    private String path;
-
-    /** The context to get the resource from. */
-    private Context ctx;
-
-    /** A locally cached copy of the DataSource */
-    private DataSource ds = null;
-
-    /** Time of last actual lookup action */
-    private long lastLookup = 0;
-
-    /** Time between two lookups */
-    private long ttl = 0; // ms
-
-    /**
-     * @return the name of the factory.
-     */
-    @Override
-	public String getName()
-    {
-    	return name;
-    }
-
-    /**
-     * @see org.apache.commons.jcs.auxiliary.disk.jdbc.dsfactory.DataSourceFactory#getDataSource()
-     */
-    @Override
-	public DataSource getDataSource() throws SQLException
-    {
-        long time = System.currentTimeMillis();
-
-        if (ds == null || time - lastLookup > ttl)
-        {
-            try
-            {
-                synchronized (ctx)
-                {
-                    ds = ((DataSource) ctx.lookup(path));
-                }
-                lastLookup = time;
-            }
-            catch (NamingException e)
-            {
-                throw new SQLException(e);
-            }
-        }
-
-        return ds;
-    }
-
-    /**
-     * @see org.apache.commons.jcs.auxiliary.disk.jdbc.dsfactory.DataSourceFactory#initialize(JDBCDiskCacheAttributes)
-     */
-    @Override
-	public void initialize(JDBCDiskCacheAttributes config) throws SQLException
-    {
-    	this.name = config.getConnectionPoolName();
-        initJNDI(config);
-    }
-
-    /**
-     * Initializes JNDI.
-     *
-     * @param config where to read the settings from
-     * @throws SQLException if a property set fails
-     */
-    private void initJNDI(JDBCDiskCacheAttributes config) throws SQLException
-    {
-        log.debug("Starting initJNDI");
-
-        try
-        {
-            this.path = config.getJndiPath();
-            if (log.isDebugEnabled())
-            {
-                log.debug("JNDI path: " + path);
-            }
-
-            this.ttl = config.getJndiTTL();
-            if (log.isDebugEnabled())
-            {
-                log.debug("Time between context lookups: " + ttl);
-            }
-
-    		Hashtable<String, Object> env = new Hashtable<String, Object>();
-            ctx = new InitialContext(env);
-
-            if (log.isDebugEnabled())
-            {
-            	log.debug("Created new InitialContext");
-            	debugCtx(ctx);
-            }
-        }
-        catch (NamingException e)
-        {
-            throw new SQLException(e);
-        }
-    }
-
-    /**
-     * Does nothing. We do not want to close a dataSource retrieved from Jndi,
-     * because other applications might use it as well.
-     */
-    @Override
-	public void close()
-    {
-        // do nothing
-    }
-
-    /**
-     *
-     * @param ctx the context
-     * @throws NamingException
-     */
-    private void debugCtx(Context ctx) throws NamingException
-    {
-        log.debug("InitialContext -------------------------------");
-        Map<?, ?> env = ctx.getEnvironment();
-        Iterator<?> qw = env.entrySet().iterator();
-        log.debug("Environment properties:" + env.size());
-        while (qw.hasNext())
-        {
-            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) qw.next();
-            log.debug("    " + entry.getKey() + ": " + entry.getValue());
-        }
-        log.debug("----------------------------------------------");
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk.jdbc.dsfactory;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.sql.SQLException;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.apache.commons.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A factory that looks up the DataSource from JNDI.  It is also able
+ * to deploy the DataSource based on properties found in the
+ * configuration.
+ *
+ * This factory tries to avoid excessive context lookups to improve speed.
+ * The time between two lookups can be configured. The default is 0 (no cache).
+ *
+ * Borrowed and adapted from Apache DB Torque
+ *
+ * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
+ * @author <a href="mailto:thomas@vandahl.org">Thomas Vandahl</a>
+ */
+public class JndiDataSourceFactory implements DataSourceFactory
+{
+    /** The log. */
+    private static Log log = LogFactory.getLog(JndiDataSourceFactory.class);
+
+    /** The name of the factory. */
+    private String name;
+
+    /** The path to get the resource from. */
+    private String path;
+
+    /** The context to get the resource from. */
+    private Context ctx;
+
+    /** A locally cached copy of the DataSource */
+    private DataSource ds = null;
+
+    /** Time of last actual lookup action */
+    private long lastLookup = 0;
+
+    /** Time between two lookups */
+    private long ttl = 0; // ms
+
+    /**
+     * @return the name of the factory.
+     */
+    @Override
+	public String getName()
+    {
+    	return name;
+    }
+
+    /**
+     * @see org.apache.commons.jcs.auxiliary.disk.jdbc.dsfactory.DataSourceFactory#getDataSource()
+     */
+    @Override
+	public DataSource getDataSource() throws SQLException
+    {
+        long time = System.currentTimeMillis();
+
+        if (ds == null || time - lastLookup > ttl)
+        {
+            try
+            {
+                synchronized (ctx)
+                {
+                    ds = ((DataSource) ctx.lookup(path));
+                }
+                lastLookup = time;
+            }
+            catch (NamingException e)
+            {
+                throw new SQLException(e);
+            }
+        }
+
+        return ds;
+    }
+
+    /**
+     * @see org.apache.commons.jcs.auxiliary.disk.jdbc.dsfactory.DataSourceFactory#initialize(JDBCDiskCacheAttributes)
+     */
+    @Override
+	public void initialize(JDBCDiskCacheAttributes config) throws SQLException
+    {
+    	this.name = config.getConnectionPoolName();
+        initJNDI(config);
+    }
+
+    /**
+     * Initializes JNDI.
+     *
+     * @param config where to read the settings from
+     * @throws SQLException if a property set fails
+     */
+    private void initJNDI(JDBCDiskCacheAttributes config) throws SQLException
+    {
+        log.debug("Starting initJNDI");
+
+        try
+        {
+            this.path = config.getJndiPath();
+            if (log.isDebugEnabled())
+            {
+                log.debug("JNDI path: " + path);
+            }
+
+            this.ttl = config.getJndiTTL();
+            if (log.isDebugEnabled())
+            {
+                log.debug("Time between context lookups: " + ttl);
+            }
+
+    		Hashtable<String, Object> env = new Hashtable<String, Object>();
+            ctx = new InitialContext(env);
+
+            if (log.isDebugEnabled())
+            {
+            	log.debug("Created new InitialContext");
+            	debugCtx(ctx);
+            }
+        }
+        catch (NamingException e)
+        {
+            throw new SQLException(e);
+        }
+    }
+
+    /**
+     * Does nothing. We do not want to close a dataSource retrieved from Jndi,
+     * because other applications might use it as well.
+     */
+    @Override
+	public void close()
+    {
+        // do nothing
+    }
+
+    /**
+     *
+     * @param ctx the context
+     * @throws NamingException
+     */
+    private void debugCtx(Context ctx) throws NamingException
+    {
+        log.debug("InitialContext -------------------------------");
+        Map<?, ?> env = ctx.getEnvironment();
+        log.debug("Environment properties:" + env.size());
+        env.forEach((key, value) -> log.debug("    " + key + ": " + value));
+        log.debug("----------------------------------------------");
+    }
+}
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
index 58bda71..b1a241a 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
@@ -27,7 +27,6 @@ import java.rmi.server.RMISocketFactory;
 import java.rmi.server.UnicastRemoteObject;
 import java.rmi.server.Unreferenced;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -1234,21 +1233,11 @@ public class RemoteCacheServer<K, V>
     {
         synchronized ( eventQMap )
         {
-            for (Iterator<Map.Entry<Long, ICacheEventQueue<KK, VV>>> itr = eventQMap.entrySet().iterator(); itr.hasNext(); )
-            {
-                Map.Entry<Long, ICacheEventQueue<KK, VV>> e = itr.next();
-                ICacheEventQueue<KK, VV> q = e.getValue();
-
-                // this does not care if the q is alive (i.e. if
-                // there are active threads; it cares if the queue
-                // is working -- if it has not encountered errors
-                // above the failure threshold
-                if ( !q.isWorking() )
-                {
-                    itr.remove();
-                    log.warn( "Cache event queue " + q + " is not working and removed from cache server." );
-                }
-            }
+            // this does not care if the q is alive (i.e. if
+            // there are active threads; it cares if the queue
+            // is working -- if it has not encountered errors
+            // above the failure threshold
+            eventQMap.entrySet().removeIf(e -> !e.getValue().isWorking());
         }
     }
 
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java
index 601529f..1c10a58 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java
@@ -1,26 +1,5 @@
 package org.apache.commons.jcs.engine;
 
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Iterator;
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -68,11 +47,9 @@ public class CacheListeners<K, V>
         {
             buffer.append( "\n Event Queue Map " );
             buffer.append( "\n size = " + eventQMap.size() );
-            Iterator<Map.Entry<Long, ICacheEventQueue<K, V>>> it = eventQMap.entrySet().iterator();
-            while ( it.hasNext() )
-            {
-                buffer.append( "\n Entry: " + it.next() );
-            }
+            eventQMap.forEach((key, value)
+                    -> buffer.append( "\n Entry: key: ").append(key)
+                        .append(", value: ").append(value));
         }
         else
         {
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
index 82e02a1..cf49552 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
@@ -732,13 +731,8 @@ public class CompositeCache<K, V>
         throws IOException
     {
         Map<K, ICacheElement<K, V>> elementsFromMemory = memCache.getMultiple(keys);
-        Iterator<Map.Entry<K, ICacheElement<K, V>>> elementFromMemoryIterator = elementsFromMemory.entrySet().iterator();
-
-        while (elementFromMemoryIterator.hasNext())
-        {
-            Map.Entry<K, ICacheElement<K, V>> entry = elementFromMemoryIterator.next();
+        elementsFromMemory.entrySet().removeIf(entry -> {
             ICacheElement<K, V> element = entry.getValue();
-
             if (isExpired(element))
             {
                 if (log.isDebugEnabled())
@@ -747,7 +741,7 @@ public class CompositeCache<K, V>
                 }
 
                 doExpires(element);
-                elementFromMemoryIterator.remove();
+                return true;
             }
             else
             {
@@ -758,8 +752,9 @@ public class CompositeCache<K, V>
 
                 // Update counters
                 hitCountRam.incrementAndGet();
+                return false;
             }
-        }
+        });
 
         return elementsFromMemory;
     }
@@ -982,11 +977,7 @@ public class CompositeCache<K, V>
     private void processRetrievedElements(AuxiliaryCache<K, V> aux, Map<K, ICacheElement<K, V>> elementsFromAuxiliary)
         throws IOException
     {
-        Iterator<Map.Entry<K, ICacheElement<K, V>>> elementFromAuxiliaryIterator = elementsFromAuxiliary.entrySet().iterator();
-
-        while (elementFromAuxiliaryIterator.hasNext())
-        {
-            Map.Entry<K, ICacheElement<K, V>> entry = elementFromAuxiliaryIterator.next();
+        elementsFromAuxiliary.entrySet().removeIf(entry -> {
             ICacheElement<K, V> element = entry.getValue();
 
             // Item found in one of the auxiliary caches.
@@ -1004,7 +995,7 @@ public class CompositeCache<K, V>
                     // associated with the item when it created govern its behavior
                     // everywhere.
                     doExpires(element);
-                    elementFromAuxiliaryIterator.remove();
+                    return true;
                 }
                 else
                 {
@@ -1015,10 +1006,20 @@ public class CompositeCache<K, V>
 
                     // Update counters
                     hitCountAux.incrementAndGet();
-                    copyAuxiliaryRetrievedItemToMemory(element);
+                    try
+                    {
+                        copyAuxiliaryRetrievedItemToMemory(element);
+                    }
+                    catch (IOException e)
+                    {
+                        log.error(cacheAttr.getCacheName()
+                                + " failed to copy element to memory " + element, e);
+                    }
                 }
             }
-        }
+
+            return false;
+        });
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
index 4ec01d8..0bc69d4 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
@@ -22,7 +22,6 @@ package org.apache.commons.jcs.engine.memory;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
@@ -36,6 +35,7 @@ import org.apache.commons.jcs.engine.behavior.ICacheElement;
 import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes;
 import org.apache.commons.jcs.engine.control.CompositeCache;
 import org.apache.commons.jcs.engine.control.group.GroupAttrName;
+import org.apache.commons.jcs.engine.control.group.GroupId;
 import org.apache.commons.jcs.engine.memory.behavior.IMemoryCache;
 import org.apache.commons.jcs.engine.memory.util.MemoryElementDescriptor;
 import org.apache.commons.jcs.engine.stats.StatElement;
@@ -334,31 +334,28 @@ public abstract class AbstractMemoryCache<K, V>
      */
     protected boolean removeByGroup(K key)
     {
-        boolean removed = false;
+        GroupId groupId = ((GroupAttrName<?>) key).groupId;
 
         // remove all keys of the same group hierarchy.
-        for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr = map.entrySet().iterator(); itr.hasNext();)
-        {
-            Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
+        return map.entrySet().removeIf(entry -> {
             K k = entry.getKey();
 
-            if (k instanceof GroupAttrName && ((GroupAttrName<?>) k).groupId.equals(((GroupAttrName<?>) key).groupId))
+            if (k instanceof GroupAttrName && ((GroupAttrName<?>) k).groupId.equals(groupId))
             {
                 lock.lock();
                 try
                 {
-                    itr.remove();
                     lockedRemoveElement(entry.getValue());
-                    removed = true;
+                    return true;
                 }
                 finally
                 {
                     lock.unlock();
                 }
             }
-        }
 
-        return removed;
+            return false;
+        });
     }
 
     /**
@@ -369,31 +366,28 @@ public abstract class AbstractMemoryCache<K, V>
      */
     protected boolean removeByHierarchy(K key)
     {
-        boolean removed = false;
+        String keyString = key.toString();
 
         // remove all keys of the same name hierarchy.
-        for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr = map.entrySet().iterator(); itr.hasNext();)
-        {
-            Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
+        return map.entrySet().removeIf(entry -> {
             K k = entry.getKey();
 
-            if (k instanceof String && ((String) k).startsWith(key.toString()))
+            if (k instanceof String && ((String) k).startsWith(keyString))
             {
                 lock.lock();
                 try
                 {
-                    itr.remove();
                     lockedRemoveElement(entry.getValue());
-                    removed = true;
+                    return true;
                 }
                 finally
                 {
                     lock.unlock();
                 }
             }
-        }
 
-        return removed;
+            return false;
+        });
     }
 
     /**
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
index 2679fb7..2f90285 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
@@ -189,7 +189,6 @@ public class LHMLRUMemoryCache<K, V>
             }
             else
             {
-
                 if ( log.isDebugEnabled() )
                 {
                     log.debug( "LHMLRU max size: " + getCacheAttributes().getMaxObjects()
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
index c2f5f2e..c069a6c 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
@@ -1,31 +1,9 @@
 package org.apache.commons.jcs.utils.struct;
 
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
 import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
-import java.util.NoSuchElementException;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
@@ -461,33 +439,22 @@ public abstract class AbstractLRUMap<K, V>
         }
 
         log.debug( "verifycache: checking via keysets!" );
-        for (Iterator<K> itr2 = map.keySet().iterator(); itr2.hasNext(); )
-        {
-            found = false;
-            Serializable val = null;
-            try
-            {
-                val = (Serializable) itr2.next();
-            }
-            catch ( NoSuchElementException nse )
-            {
-                log.error( "verifycache: no such element exception" );
-                continue;
-            }
+        map.forEach((key, value) -> {
+            boolean _found = false;
 
             for (LRUElementDescriptor<K, V> li2 = list.getFirst(); li2 != null; li2 = (LRUElementDescriptor<K, V>) li2.next )
             {
-                if ( val.equals( li2.getKey() ) )
+                if ( key.equals( li2.getKey() ) )
                 {
-                    found = true;
+                    _found = true;
                     break;
                 }
             }
-            if ( !found )
+            if ( !_found )
             {
-                log.error( "verifycache: key not found in list : " + val );
+                log.error( "verifycache: key not found in list : " + key );
                 dumpCacheEntries();
-                if ( map.containsKey( val ) )
+                if ( map.containsKey( key ) )
                 {
                     log.error( "verifycache: map contains key" );
                 }
@@ -496,7 +463,7 @@ public abstract class AbstractLRUMap<K, V>
                     log.error( "verifycache: map does NOT contain key, what the HECK!" );
                 }
             }
-        }
+        });
     }
 
     /**


[commons-jcs] 07/09: JCS-194 NullPointerException in IndexedDiskCache.addToRecycleBin(...)

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit efdbca65496d8d6d928398833c86091dcbeb74eb
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue May 28 15:44:57 2019 +0200

    JCS-194 NullPointerException in IndexedDiskCache.addToRecycleBin(...)
---
 .../apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
index 42384f9..825376e 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
@@ -177,11 +177,10 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
 
         try
         {
+            initializeRecycleBin();
             initializeFileSystem(cattr);
-
             initializeKeysAndData(cattr);
 
-            initializeRecycleBin();
 
             // Initialization finished successfully, so set alive to true.
             setAlive(true);