commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1438943 - in /commons/proper/jcs/trunk/src: java/org/apache/jcs/auxiliary/disk/block/ java/org/apache/jcs/auxiliary/disk/jdbc/ java/org/apache/jcs/auxiliary/remote/behavior/ java/org/apache/jcs/auxiliary/remote/http/client/ java/org/apache...
Date Sat, 26 Jan 2013 18:49:15 GMT
Author: tv
Date: Sat Jan 26 18:49:14 2013
New Revision: 1438943

URL: http://svn.apache.org/viewvc?rev=1438943&view=rev
Log:
Use central thread pool instance to clean up the code.

Added:
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IProvideScheduler.java   (with props)
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IRequireScheduler.java   (with props)
Removed:
    commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/DiscoveryShutdownHook.java
Modified:
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheDispatcher.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CompositeCacheAttributes.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheRestore.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheAttributes.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObservable.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObserver.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryManager.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryService.java
    commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java
    commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java
    commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java
    commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java Sat Jan 26 18:49:14 2013
@@ -30,6 +30,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.commons.logging.Log;
@@ -39,6 +41,7 @@ import org.apache.jcs.auxiliary.disk.Abs
 import org.apache.jcs.engine.CacheConstants;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.behavior.IRequireScheduler;
 import org.apache.jcs.engine.control.group.GroupAttrName;
 import org.apache.jcs.engine.control.group.GroupId;
 import org.apache.jcs.engine.stats.StatElement;
@@ -53,6 +56,7 @@ import org.apache.jcs.engine.stats.behav
  */
 public class BlockDiskCache<K extends Serializable, V extends Serializable>
     extends AbstractDiskCache<K, V>
+    implements IRequireScheduler
 {
     /** Don't change */
     private static final long serialVersionUID = 1L;
@@ -76,7 +80,7 @@ public class BlockDiskCache<K extends Se
     private final File rootDirectory;
 
     /** Store, loads, and persists the keys */
-    private BlockDiskKeyStore<K> keyStore;
+    protected BlockDiskKeyStore<K> keyStore;
 
     /**
      * Use this lock to synchronize reads and writes to the underlying storage mechanism. We don't
@@ -159,6 +163,29 @@ public class BlockDiskCache<K extends Se
     }
 
     /**
+     * @see org.apache.jcs.engine.behavior.IRequireScheduler#setScheduledExecutorService(java.util.concurrent.ScheduledExecutorService)
+     */
+    public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutor)
+    {
+        // add this region to the persistence thread.
+        // TODO we might need to stagger this a bit.
+        if ( this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds() > 0 )
+        {
+            scheduledExecutor.scheduleAtFixedRate(
+                    new Runnable()
+                    {
+                        public void run()
+                        {
+                            keyStore.saveKeys();
+                        }
+                    },
+                    this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds(),
+                    this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds(),
+                    TimeUnit.SECONDS);
+        }
+    }
+
+    /**
      * We need to verify that the file on disk uses the same block size and that the file is the
      * proper size.
      * <p>

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java Sat Jan 26 18:49:14 2013
@@ -32,10 +32,6 @@ import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -74,17 +70,13 @@ public class BlockDiskKeyStore<K extends
     protected final BlockDiskCache<K, ?> blockDiskCache;
 
     /**
-     * The background key persister, one for all regions.
-     */
-    private static volatile ScheduledExecutorService persistenceDaemon;
-
-    /**
      * Set the configuration options.
      * <p>
      * @param cacheAttributes
      * @param blockDiskCache used for freeing
      */
-    public BlockDiskKeyStore( BlockDiskCacheAttributes cacheAttributes, BlockDiskCache<K, ?> blockDiskCache )
+    public BlockDiskKeyStore( BlockDiskCacheAttributes cacheAttributes,
+            BlockDiskCache<K, ?> blockDiskCache)
     {
         this.blockDiskCacheAttributes = cacheAttributes;
         this.logCacheName = "Region [" + this.blockDiskCacheAttributes.getCacheName() + "] ";
@@ -117,28 +109,6 @@ public class BlockDiskKeyStore<K extends
         {
             initKeyMap();
         }
-
-        // add this region to the persistence thread.
-        // TODO we might need to stagger this a bit.
-        if ( this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds() > 0 )
-        {
-            if ( persistenceDaemon == null )
-            {
-                persistenceDaemon = Executors.newScheduledThreadPool(1, new MyThreadFactory());
-            }
-
-            persistenceDaemon
-                .scheduleAtFixedRate(new Runnable()
-                                        {
-                                            public void run()
-                                            {
-                                                saveKeys();
-                                            }
-                                        },
-                        this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds(),
-                        this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds(),
-                        TimeUnit.SECONDS);
-        }
     }
 
     /**
@@ -419,29 +389,4 @@ public class BlockDiskKeyStore<K extends
             }
         }
     }
-
-    /**
-     * Allows us to set the daemon status on the clockdaemon
-     * @author aaronsm
-     */
-    protected static class MyThreadFactory
-        implements ThreadFactory
-    {
-
-        /**
-         * Ensures that we create daemon threads.
-         * <p>
-         * (non-Javadoc)
-         * @see EDU.oswego.cs.dl.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
-         */
-        public Thread newThread( Runnable runner )
-        {
-            Thread t = new Thread( runner );
-            String oldName = t.getName();
-            t.setName( "JCS-BlockDiskKeyStore-" + oldName );
-            t.setDaemon( true );
-            t.setPriority( Thread.MIN_PRIORITY );
-            return t;
-        }
-    }
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java Sat Jan 26 18:49:14 2013
@@ -129,7 +129,7 @@ public class ShrinkerThread
                     if ( log.isInfoEnabled() )
                     {
                         log.info( "Pausing for [" + this.getPauseBetweenRegionCallsMillis()
-                            + "] ms. before shinker the next region." );
+                            + "] ms. before shrinking the next region." );
                     }
 
                     try

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheDispatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheDispatcher.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheDispatcher.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheDispatcher.java Sat Jan 26 18:49:14 2013
@@ -22,7 +22,7 @@ public interface IRemoteCacheDispatcher
      * @return RemoteCacheResponse
      * @throws IOException
      */
-    <K extends Serializable, V extends Serializable, KK extends Serializable, VV extends Serializable>
-        RemoteCacheResponse<K, V> dispatchRequest( RemoteCacheRequest<KK, VV> remoteCacheRequest )
+    <K extends Serializable, V extends Serializable, T>
+        RemoteCacheResponse<T> dispatchRequest( RemoteCacheRequest<K, V> remoteCacheRequest )
             throws IOException;
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java Sat Jan 26 18:49:14 2013
@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheDispatcher;
 import org.apache.jcs.auxiliary.remote.http.client.behavior.IRemoteHttpCacheClient;
-import org.apache.jcs.auxiliary.remote.http.server.RemoteCacheServiceAdaptor;
 import org.apache.jcs.auxiliary.remote.util.RemoteCacheRequestFactory;
 import org.apache.jcs.auxiliary.remote.value.RemoteCacheRequest;
 import org.apache.jcs.auxiliary.remote.value.RemoteCacheResponse;
@@ -40,7 +39,7 @@ public class RemoteHttpCacheClient<K ext
     implements IRemoteHttpCacheClient<K, V>
 {
     /** The Logger. */
-    private final static Log log = LogFactory.getLog( RemoteCacheServiceAdaptor.class );
+    private final static Log log = LogFactory.getLog( RemoteHttpCacheClient.class );
 
     /** The internal client. */
     private IRemoteCacheDispatcher remoteDispatcher;
@@ -120,19 +119,20 @@ public class RemoteHttpCacheClient<K ext
         RemoteCacheRequest<K, Serializable> remoteHttpCacheRequest =
             RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId );
 
-        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<ICacheElement<K, V>> remoteHttpCacheResponse =
+            getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( log.isDebugEnabled() )
         {
             log.debug( "Get [" + key + "] = " + remoteHttpCacheResponse );
         }
 
-        ICacheElement<K, V> retval = null;
-        if ( remoteHttpCacheResponse != null && remoteHttpCacheResponse.getPayload() != null )
+        if ( remoteHttpCacheResponse != null)
         {
-            retval = remoteHttpCacheResponse.getPayload().get( key );
+            return remoteHttpCacheResponse.getPayload();
         }
-        return retval;
+
+        return null;
     }
 
     /**
@@ -173,7 +173,8 @@ public class RemoteHttpCacheClient<K ext
         RemoteCacheRequest<K, V> remoteHttpCacheRequest =
             RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern, requesterId );
 
-        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<Map<K, ICacheElement<K, V>>> remoteHttpCacheResponse =
+            getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( log.isDebugEnabled() )
         {
@@ -221,7 +222,8 @@ public class RemoteHttpCacheClient<K ext
         RemoteCacheRequest<K, V> remoteHttpCacheRequest =
             RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys, requesterId );
 
-        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<Map<K, ICacheElement<K, V>>> remoteHttpCacheResponse =
+            getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( log.isDebugEnabled() )
         {
@@ -392,12 +394,11 @@ public class RemoteHttpCacheClient<K ext
         RemoteCacheRequest<String, String> remoteHttpCacheRequest =
             RemoteCacheRequestFactory.createGetGroupKeysRequest( cacheName, groupName, 0 );
 
-        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<Set<K>> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( remoteHttpCacheResponse != null && remoteHttpCacheResponse.getPayload() != null )
         {
-            // FIXME: Unchecked cast
-            return (Set<K>)remoteHttpCacheResponse.getPayload().get( groupName );
+            return remoteHttpCacheResponse.getPayload();
         }
 
         return Collections.emptySet();
@@ -422,12 +423,12 @@ public class RemoteHttpCacheClient<K ext
         RemoteCacheRequest<String, String> remoteHttpCacheRequest =
             RemoteCacheRequestFactory.createGetGroupNamesRequest( cacheName, 0 );
 
-        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<Set<String>> remoteHttpCacheResponse =
+            getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( remoteHttpCacheResponse != null && remoteHttpCacheResponse.getPayload() != null )
         {
-            // FIXME: Unchecked cast
-            return (Set<String>)remoteHttpCacheResponse.getPayload().get( cacheName );
+            return remoteHttpCacheResponse.getPayload();
         }
 
         return Collections.emptySet();
@@ -450,7 +451,8 @@ public class RemoteHttpCacheClient<K ext
         }
 
         RemoteCacheRequest<K, V> remoteHttpCacheRequest = RemoteCacheRequestFactory.createAliveCheckRequest( 0 );
-        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<String> remoteHttpCacheResponse =
+            getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( remoteHttpCacheResponse != null )
         {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java Sat Jan 26 18:49:14 2013
@@ -74,8 +74,8 @@ public class RemoteHttpCacheDispatcher
      * @return RemoteCacheResponse
      * @throws IOException
      */
-    public <K extends Serializable, V extends Serializable, KK extends Serializable, VV extends Serializable>
-        RemoteCacheResponse<K, V> dispatchRequest( RemoteCacheRequest<KK, VV> remoteCacheRequest )
+    public <K extends Serializable, V extends Serializable, T>
+        RemoteCacheResponse<T> dispatchRequest( RemoteCacheRequest<K, V> remoteCacheRequest )
         throws IOException
     {
         try
@@ -86,7 +86,7 @@ public class RemoteHttpCacheDispatcher
 
             byte[] responseAsByteArray = processRequest( requestAsByteArray, url );
 
-            RemoteCacheResponse<K, V> remoteCacheResponse = null;
+            RemoteCacheResponse<T> remoteCacheResponse = null;
             try
             {
                 remoteCacheResponse = serializer.deSerialize( responseAsByteArray );

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java Sat Jan 26 18:49:14 2013
@@ -21,7 +21,7 @@ package org.apache.jcs.auxiliary.remote.
 
 import java.io.IOException;
 import java.io.Serializable;
-import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
@@ -70,13 +70,14 @@ public class RemoteCacheServiceAdaptor<K
      * @param request
      * @return RemoteHttpCacheResponse, never null
      */
-    public RemoteCacheResponse<K, V> processRequest( RemoteCacheRequest<K, V> request )
+    @SuppressWarnings( "unchecked" ) // need to cast to correct return type
+    public <T> RemoteCacheResponse<T> processRequest( RemoteCacheRequest<K, V> request )
     {
-        RemoteCacheResponse<K, V> response = new RemoteCacheResponse<K, V>();
+        RemoteCacheResponse<Object> response = new RemoteCacheResponse<Object>();
 
         if ( request == null )
         {
-            String message = "The request is null.  Cannot process";
+            String message = "The request is null. Cannot process";
             log.warn( message );
             response.setSuccess( false );
             response.setErrorMessage( message );
@@ -90,10 +91,7 @@ public class RemoteCacheServiceAdaptor<K
                     case GET:
                         ICacheElement<K, V> element = getRemoteCacheService().get( request.getCacheName(), request.getKey(),
                                                                              request.getRequesterId() );
-                        if ( element != null )
-                        {
-                            response.getPayload().put( element.getKey(), element );
-                        }
+                        response.setPayload(element);
                         break;
                     case GET_MULTIPLE:
                         Map<K, ICacheElement<K, V>> elementMap = getRemoteCacheService().getMultiple( request.getCacheName(),
@@ -101,7 +99,9 @@ public class RemoteCacheServiceAdaptor<K
                                                                               request.getRequesterId() );
                         if ( elementMap != null )
                         {
-                            response.getPayload().putAll( elementMap );
+                            Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K,V>>();
+                            map.putAll(elementMap);
+                            response.setPayload(map);
                         }
                         break;
                     case GET_MATCHING:
@@ -110,7 +110,9 @@ public class RemoteCacheServiceAdaptor<K
                                                                                       request.getRequesterId() );
                         if ( elementMapMatching != null )
                         {
-                            response.getPayload().putAll( elementMapMatching );
+                            Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K,V>>();
+                            map.putAll(elementMapMatching);
+                            response.setPayload(map);
                         }
                         break;
                     case REMOVE:
@@ -133,21 +135,11 @@ public class RemoteCacheServiceAdaptor<K
                     case GET_GROUP_KEYS:
                         Set<K> groupKeys = getRemoteCacheService().getGroupKeys( request.getCacheName(),
                                                                               request.getKey() + "" );
-                        if ( groupKeys == null )
-                        {
-                            groupKeys = Collections.emptySet();
-                        }
-                        // FIXME: Re-enable
-                        //response.getPayload().put( request.getKey(), groupKeys );
+                        response.setPayload( groupKeys );
                         break;
                     case GET_GROUP_NAMES:
                         Set<String> groupNames = getRemoteCacheService().getGroupNames( request.getCacheName() );
-                        if ( groupNames == null )
-                        {
-                            groupNames = Collections.emptySet();
-                        }
-                        // FIXME: Re-enable
-                        //response.getPayload().put( request.getKey(), groupNames );
+                        response.setPayload( groupNames );
                         break;
                     default:
                         String message = "Unknown event type.  Cannot process " + request;
@@ -166,7 +158,7 @@ public class RemoteCacheServiceAdaptor<K
             }
         }
 
-        return response;
+        return (RemoteCacheResponse<T>)response;
     }
 
     /**

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java Sat Jan 26 18:49:14 2013
@@ -112,8 +112,8 @@ public class RemoteHttpCacheServlet
         }
 
         RemoteCacheRequest<Serializable, Serializable> remoteRequest = readRequest( request );
-
-        RemoteCacheResponse<Serializable, Serializable> cacheResponse = getRemoteHttpCacheServiceAdaptor().processRequest( remoteRequest );
+        RemoteCacheResponse<Serializable> cacheResponse =
+            getRemoteHttpCacheServiceAdaptor().processRequest( remoteRequest );
 
         writeResponse( response, cacheResponse );
     }
@@ -170,7 +170,7 @@ public class RemoteHttpCacheServlet
      * @param response
      * @param cacheResponse
      */
-    protected void writeResponse( HttpServletResponse response, RemoteCacheResponse<Serializable, Serializable> cacheResponse )
+    protected void writeResponse( HttpServletResponse response, RemoteCacheResponse<Serializable> cacheResponse )
     {
         try
         {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java Sat Jan 26 18:49:14 2013
@@ -1,16 +1,12 @@
 package org.apache.jcs.auxiliary.remote.value;
 
 import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.jcs.engine.behavior.ICacheElement;
 
 /**
  * This is the response wrapper. The servlet wraps all different type of responses in one of these
  * objects.
  */
-public class RemoteCacheResponse<K extends Serializable, V extends Serializable>
+public class RemoteCacheResponse<T>
     implements Serializable
 {
     /** Don't change. */
@@ -26,7 +22,7 @@ public class RemoteCacheResponse<K exten
      * The payload. Typically a key / ICacheElement<K, V> map. A normal get will return a map with one
      * record.
      */
-    private Map<K, ICacheElement<K, V>> payload = new HashMap<K, ICacheElement<K,V>>();
+    private T payload;
 
     /**
      * @param success the success to set
@@ -63,7 +59,7 @@ public class RemoteCacheResponse<K exten
     /**
      * @param payload the payload to set
      */
-    public void setPayload( Map<K, ICacheElement<K, V>> payload )
+    public void setPayload( T payload )
     {
         this.payload = payload;
     }
@@ -71,7 +67,7 @@ public class RemoteCacheResponse<K exten
     /**
      * @return the payload
      */
-    public Map<K, ICacheElement<K, V>> getPayload()
+    public T getPayload()
     {
         return payload;
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CompositeCacheAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CompositeCacheAttributes.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CompositeCacheAttributes.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CompositeCacheAttributes.java Sat Jan 26 18:49:14 2013
@@ -145,7 +145,7 @@ public class CompositeCacheAttributes
      * <p>
      * @return The useDisk value
      */
-    public boolean getUseDisk()
+    public boolean isUseDisk()
     {
         return useDisk;
     }
@@ -165,7 +165,7 @@ public class CompositeCacheAttributes
      * <p>
      * @return The useLateral value
      */
-    public boolean getUseLateral()
+    public boolean isUseLateral()
     {
         return this.useLateral;
     }
@@ -185,7 +185,7 @@ public class CompositeCacheAttributes
      * <p>
      * @return The useRemote value
      */
-    public boolean getUseRemote()
+    public boolean isUseRemote()
     {
         return this.useRemote;
     }
@@ -245,7 +245,7 @@ public class CompositeCacheAttributes
      * <p>
      * @return The UseMemoryShrinker value
      */
-    public boolean getUseMemoryShrinker()
+    public boolean isUseMemoryShrinker()
     {
         return this.useMemoryShrinker;
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java Sat Jan 26 18:49:14 2013
@@ -41,7 +41,7 @@ public interface ICacheObserver
      *            object to notify for cache changes.
      * @throws IOException
      */
-    public <K extends Serializable, V extends Serializable> void addCacheListener( String cacheName, ICacheListener<K, V> obj )
+    <K extends Serializable, V extends Serializable> void addCacheListener( String cacheName, ICacheListener<K, V> obj )
         throws IOException;
 
     //, CacheNotFoundException;
@@ -53,7 +53,7 @@ public interface ICacheObserver
      *            object to notify for all cache changes.
      * @throws IOException
      */
-    public <K extends Serializable, V extends Serializable> void addCacheListener( ICacheListener<K, V> obj )
+    <K extends Serializable, V extends Serializable> void addCacheListener( ICacheListener<K, V> obj )
         throws IOException;
 
     /**
@@ -64,7 +64,7 @@ public interface ICacheObserver
      *            existing subscriber.
      * @throws IOException
      */
-    public <K extends Serializable, V extends Serializable> void removeCacheListener( String cacheName, ICacheListener<K, V> obj )
+    <K extends Serializable, V extends Serializable> void removeCacheListener( String cacheName, ICacheListener<K, V> obj )
         throws IOException;
 
     /**
@@ -74,6 +74,6 @@ public interface ICacheObserver
      *            existing subscriber.
      * @throws IOException
      */
-    public <K extends Serializable, V extends Serializable> void removeCacheListener( ICacheListener<K, V> obj )
+    <K extends Serializable, V extends Serializable> void removeCacheListener( ICacheListener<K, V> obj )
         throws IOException;
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheRestore.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheRestore.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheRestore.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheRestore.java Sat Jan 26 18:49:14 2013
@@ -20,7 +20,7 @@ package org.apache.jcs.engine.behavior;
  */
 
 /**
- * Description of the Interface
+ * TODO: Description of the Interface
  *
  */
 public interface ICacheRestore
@@ -30,8 +30,8 @@ public interface ICacheRestore
      *
      * @return true if fixed
      */
-    public boolean canFix();
+    boolean canFix();
 
-    /** Description of the Method */
-    public void fix();
+    /** Fix the cache */
+    void fix();
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheAttributes.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheAttributes.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheAttributes.java Sat Jan 26 18:49:14 2013
@@ -72,7 +72,7 @@ public interface ICompositeCacheAttribut
      * <p>
      * @return The useDisk value
      */
-    boolean getUseDisk();
+    boolean isUseDisk();
 
     /**
      * set whether the cache should use a lateral cache
@@ -87,7 +87,7 @@ public interface ICompositeCacheAttribut
      * <p>
      * @return The useLateral value
      */
-    boolean getUseLateral();
+    boolean isUseLateral();
 
     /**
      * Sets whether the cache is remote enabled
@@ -102,7 +102,7 @@ public interface ICompositeCacheAttribut
      * <p>
      * @return The useRemote value
      */
-    boolean getUseRemote();
+    boolean isUseRemote();
 
     /**
      * Sets the name of the cache, referenced by the appropriate manager.
@@ -149,7 +149,7 @@ public interface ICompositeCacheAttribut
      * <p>
      * @return The UseMemoryShrinker value
      */
-    boolean getUseMemoryShrinker();
+    boolean isUseMemoryShrinker();
 
     /**
      * If UseMemoryShrinker is true the memory cache should auto-expire elements

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java Sat Jan 26 18:49:14 2013
@@ -35,7 +35,7 @@ public interface IElementAttributes
      * <p>
      * @param mls The new MaxLifeSeconds value
      */
-    public void setMaxLifeSeconds( long mls );
+    void setMaxLifeSeconds( long mls );
 
     /**
      * Sets the maxLife attribute of the IAttributes object. How many seconds it can live after
@@ -45,7 +45,7 @@ public interface IElementAttributes
      * removed on retrieval, or removed actively if the memory shrinker is turned on.
      * @return The MaxLifeSeconds value
      */
-    public long getMaxLifeSeconds();
+    long getMaxLifeSeconds();
 
     /**
      * Sets the idleTime attribute of the IAttributes object. This is the maximum time the item can
@@ -55,21 +55,21 @@ public interface IElementAttributes
      * removed on retrieval, or removed actively if the memory shrinker is turned on.
      * @param idle The new idleTime value
      */
-    public void setIdleTime( long idle );
+    void setIdleTime( long idle );
 
     /**
      * Size in bytes. This is not used except in the admin pages. It will be -1 by default.
      * <p>
      * @param size The new size value
      */
-    public void setSize( int size );
+    void setSize( int size );
 
     /**
      * Gets the size attribute of the IAttributes object
      * <p>
      * @return The size value
      */
-    public int getSize();
+    int getSize();
 
     /**
      * Gets the createTime attribute of the IAttributes object.
@@ -80,25 +80,25 @@ public interface IElementAttributes
      * Putting an item in the cache overrides any existing items.
      * @return The createTime value
      */
-    public long getCreateTime();
+    long getCreateTime();
 
     /**
      * Gets the LastAccess attribute of the IAttributes object.
      * <p>
      * @return The LastAccess value.
      */
-    public long getLastAccessTime();
+    long getLastAccessTime();
 
     /**
      * Sets the LastAccessTime as now of the IElementAttributes object
      */
-    public void setLastAccessTimeNow();
+    void setLastAccessTimeNow();
 
     /**
      * Gets the idleTime attribute of the IAttributes object
      * @return The idleTime value
      */
-    public long getIdleTime();
+    long getIdleTime();
 
     /**
      * Gets the time left to live of the IAttributes object.
@@ -106,13 +106,13 @@ public interface IElementAttributes
      * This is the (max life + create time) - current time.
      * @return The TimeToLiveSeconds value
      */
-    public long getTimeToLiveSeconds();
+    long getTimeToLiveSeconds();
 
     /**
      * Returns a copy of the object.
      * @return IElementAttributes
      */
-    public IElementAttributes copy();
+    IElementAttributes copy();
 
     /**
      * Can this item be spooled to disk
@@ -120,7 +120,7 @@ public interface IElementAttributes
      * By default this is true.
      * @return The spoolable value
      */
-    public boolean getIsSpool();
+    boolean getIsSpool();
 
     /**
      * Sets the isSpool attribute of the IElementAttributes object
@@ -128,7 +128,7 @@ public interface IElementAttributes
      * By default this is true.
      * @param val The new isSpool value
      */
-    public void setIsSpool( boolean val );
+    void setIsSpool( boolean val );
 
     /**
      * Is this item laterally distributable. Can it be sent to auxiliaries of type lateral.
@@ -136,7 +136,7 @@ public interface IElementAttributes
      * By default this is true.
      * @return The isLateral value
      */
-    public boolean getIsLateral();
+    boolean getIsLateral();
 
     /**
      * Sets the isLateral attribute of the IElementAttributes object
@@ -144,7 +144,7 @@ public interface IElementAttributes
      * By default this is true.
      * @param val The new isLateral value
      */
-    public void setIsLateral( boolean val );
+    void setIsLateral( boolean val );
 
     /**
      * Can this item be sent to the remote cache.
@@ -152,7 +152,7 @@ public interface IElementAttributes
      * By default this is true.
      * @return The isRemote value
      */
-    public boolean getIsRemote();
+    boolean getIsRemote();
 
     /**
      * Sets the isRemote attribute of the IElementAttributes object.
@@ -160,26 +160,26 @@ public interface IElementAttributes
      * By default this is true.
      * @param val The new isRemote value
      */
-    public void setIsRemote( boolean val );
+    void setIsRemote( boolean val );
 
     /**
      * This turns off expiration if it is true.
      * @return The IsEternal value
      */
-    public boolean getIsEternal();
+    boolean getIsEternal();
 
     /**
      * Sets the isEternal attribute of the IElementAttributes object
      * @param val The new isEternal value
      */
-    public void setIsEternal( boolean val );
+    void setIsEternal( boolean val );
 
     /**
      * Adds a ElementEventHandler. Handler's can be registered for multiple events. A registered
      * handler will be called at every recognized event.
      * @param eventHandler The feature to be added to the ElementEventHandler
      */
-    public void addElementEventHandler( IElementEventHandler eventHandler );
+    void addElementEventHandler( IElementEventHandler eventHandler );
 
     /**
      * Gets the elementEventHandlers.
@@ -188,12 +188,12 @@ public interface IElementAttributes
      * lost if the item goes to disk.
      * @return The elementEventHandlers value, null if there are none
      */
-    public ArrayList<IElementEventHandler> getElementEventHandlers();
+    ArrayList<IElementEventHandler> getElementEventHandlers();
 
     /**
      * Sets the eventHandlers of the IElementAttributes object
      * @param eventHandlers value
      */
-    public void addElementEventHandlers( ArrayList<IElementEventHandler> eventHandlers );
+    void addElementEventHandlers( ArrayList<IElementEventHandler> eventHandlers );
 
 }

Added: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IProvideScheduler.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IProvideScheduler.java?rev=1438943&view=auto
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IProvideScheduler.java (added)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IProvideScheduler.java Sat Jan 26 18:49:14 2013
@@ -0,0 +1,37 @@
+package org.apache.jcs.engine.behavior;
+
+import java.util.concurrent.ScheduledExecutorService;
+
+/*
+ * 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.
+ */
+
+/**
+ * Marker interface for providers of the central ScheduledExecutorService
+ * <p>
+ * @author Thomas Vandahl
+ *
+ */
+public interface IProvideScheduler
+{
+    /**
+     * Get an instance of a central ScheduledExecutorService
+     * @return the central scheduler
+     */
+    ScheduledExecutorService getScheduledExecutorService();
+}

Propchange: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IProvideScheduler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IRequireScheduler.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IRequireScheduler.java?rev=1438943&view=auto
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IRequireScheduler.java (added)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IRequireScheduler.java Sat Jan 26 18:49:14 2013
@@ -0,0 +1,38 @@
+package org.apache.jcs.engine.behavior;
+
+import java.util.concurrent.ScheduledExecutorService;
+
+/*
+ * 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.
+ */
+
+/**
+ * Marker interface to allow the injection of a central ScheduledExecutorService
+ * for all modules requiring scheduled background operations.
+ * <p>
+ * @author Thomas Vandahl
+ *
+ */
+public interface IRequireScheduler
+{
+    /**
+     * Inject an instance of a central ScheduledExecutorService
+     * @param scheduledExecutor
+     */
+    void setScheduledExecutorService( ScheduledExecutorService scheduledExecutor );
+}

Propchange: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IRequireScheduler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObservable.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObservable.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObservable.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObservable.java Sat Jan 26 18:49:14 2013
@@ -20,16 +20,16 @@ package org.apache.jcs.engine.behavior;
  */
 
 /**
- * ShutdownObservers can observer ShutdownObservable objects.
+ * ShutdownObservers can observe ShutdownObservable objects.
  * The CacheManager is the primary observable that this is intended for.
  * <p>
  * Most shutdown operations will occur outside this framework for now.  The initial
  * goal is to allow background threads that are not reachable through any reference
- * that the cahe manager maintains to be killed on shutdown.
+ * that the cache manager maintains to be killed on shutdown.
  * <p>
  * Perhaps the composite cache itself should be the observable object.
  * It doesn't make much of a difference.  There are some problems with
- * region by region shutdown.  Some auxiliaries are glocal.  They will
+ * region by region shutdown.  Some auxiliaries are local.  They will
  * need to track when every region has shutdown before doing things like
  * closing the socket with a lateral.
  * <p>

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObserver.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObserver.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObserver.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IShutdownObserver.java Sat Jan 26 18:49:14 2013
@@ -26,18 +26,16 @@ package org.apache.jcs.engine.behavior;
  * <p>
  * Most shutdown operations will occur outside this framework for now.  The initial
  * goal is to allow background threads that are not reachable through any reference
- * that the cahe manager maintains to be killed on shutdown.
+ * that the cache manager maintains to be killed on shutdown.
  *
  * @author Aaron Smuts
  *
  */
 public interface IShutdownObserver
 {
-
     /**
      * Tells the observer that the observable has received a shutdown command.
      *
      */
-    abstract void shutdown();
-
+    void shutdown();
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java Sat Jan 26 18:49:14 2013
@@ -320,9 +320,9 @@ public class CompositeCache<K extends Se
                 // cache region restrictions
                 if ( log.isDebugEnabled() )
                 {
-                    log.debug( "lateralcache in aux list: cattr " + cacheAttr.getUseLateral() );
+                    log.debug( "lateralcache in aux list: cattr " + cacheAttr.isUseLateral() );
                 }
-                if ( cacheAttr.getUseLateral() && cacheElement.getElementAttributes().getIsLateral() && !localOnly )
+                if ( cacheAttr.isUseLateral() && cacheElement.getElementAttributes().getIsLateral() && !localOnly )
                 {
                     // DISTRIBUTE LATERALLY
                     // Currently always multicast even if the value is
@@ -339,9 +339,9 @@ public class CompositeCache<K extends Se
             {
                 if ( log.isDebugEnabled() )
                 {
-                    log.debug( "diskcache in aux list: cattr " + cacheAttr.getUseDisk() );
+                    log.debug( "diskcache in aux list: cattr " + cacheAttr.isUseDisk() );
                 }
-                if ( cacheAttr.getUseDisk()
+                if ( cacheAttr.isUseDisk()
                     && ( cacheAttr.getDiskUsagePattern() == DiskUsagePattern.UPDATE )
                     && cacheElement.getElementAttributes().getIsSpool() )
                 {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java Sat Jan 26 18:49:14 2013
@@ -38,6 +38,7 @@ import org.apache.jcs.engine.behavior.IC
 import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
 import org.apache.jcs.engine.behavior.IElementAttributes;
 import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.behavior.IRequireScheduler;
 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
 import org.apache.jcs.engine.match.KeyMatcherPatternImpl;
 import org.apache.jcs.engine.match.behavior.IKeyMatcher;
@@ -322,18 +323,21 @@ public class CompositeCacheConfigurator
     {
         // First, create or get the cache and element attributes, and create
         // the cache.
-
-        if ( cca == null )
-        {
-            cca = parseCompositeCacheAttributes( props, regName, regionPrefix );
-        }
-
         IElementAttributes ea = parseElementAttributes( props, regName, regionPrefix );
 
-        CompositeCache<K, V> cache = new CompositeCache<K, V>( regName, cca, ea );
+        CompositeCache<K, V> cache = ( cca == null )
+            ? new CompositeCache<K, V>( regName, parseCompositeCacheAttributes( props, regName, regionPrefix ), ea )
+            : new CompositeCache<K, V>( regName, cca, ea );
 
         if (value != null)
         {
+            // Inject scheduler service
+            if (cache.getMemoryCache() instanceof IRequireScheduler)
+            {
+                ((IRequireScheduler)cache.getMemoryCache()).setScheduledExecutorService(
+                        compositeCacheManager.getScheduledExecutorService());
+            }
+
             // Next, create the auxiliaries for the new cache
             List<AuxiliaryCache<K, V>> auxList = new ArrayList<AuxiliaryCache<K, V>>();
 
@@ -368,10 +372,16 @@ public class CompositeCacheConfigurator
                 }
                 log.debug( "Parsing auxiliary named \"" + auxName + "\"." );
 
-                auxCache = parseAuxiliary( cache, props, auxName, regName );
+                auxCache = parseAuxiliary( props, auxName, regName );
 
                 if ( auxCache != null )
                 {
+                    if (auxCache instanceof IRequireScheduler)
+                    {
+                        ((IRequireScheduler)auxCache).setScheduledExecutorService(
+                                compositeCacheManager.getScheduledExecutorService());
+                    }
+
                     auxList.add( auxCache );
                 }
             }
@@ -496,21 +506,18 @@ public class CompositeCacheConfigurator
     /**
      * Get an aux cache for the listed aux for a region.
      *<p>
-     * @param cache the cache manager
      * @param props the configuration properties
      * @param auxName the name of the auxiliary cache
      * @param regName the name of the region.
      * @return AuxiliaryCache
      */
-    protected <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> parseAuxiliary( CompositeCache<K, V> cache, Properties props, String auxName, String regName )
+    protected <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> parseAuxiliary( Properties props, String auxName, String regName )
     {
         AuxiliaryCache<K, V> auxCache;
 
         if ( log.isDebugEnabled() )
         {
-            // cache isn't used.
-            // TODO change method signature if is isn't needed.
-            log.debug( "parseAuxiliary, Cache = " + cache );
+            log.debug( "parseAuxiliary " + auxName );
         }
 
         // GET FACTORY

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java Sat Jan 26 18:49:14 2013
@@ -29,6 +29,9 @@ import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -44,6 +47,7 @@ import org.apache.jcs.engine.behavior.IC
 import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 import org.apache.jcs.engine.behavior.IElementAttributes;
+import org.apache.jcs.engine.behavior.IProvideScheduler;
 import org.apache.jcs.engine.behavior.IShutdownObservable;
 import org.apache.jcs.engine.behavior.IShutdownObserver;
 import org.apache.jcs.engine.stats.CacheStats;
@@ -61,7 +65,7 @@ import org.apache.jcs.utils.threadpool.T
  * It is recommended that you use the JCS convenience class for all cache access.
  */
 public class CompositeCacheManager
-    implements IRemoteCacheConstants, Serializable, ICompositeCacheManager, IShutdownObservable
+    implements IRemoteCacheConstants, Serializable, ICompositeCacheManager, IShutdownObservable, IProvideScheduler
 {
     /** Don't change */
     private static final long serialVersionUID = 7598584393134401756L;
@@ -115,6 +119,9 @@ public class CompositeCacheManager
     /** Those waiting for notification of a shutdown. */
     private final Set<IShutdownObserver> shutdownObservers = new HashSet<IShutdownObserver>();
 
+    /** The central background scheduler. */
+    private ScheduledExecutorService scheduledExecutor;
+
     /** Indicates whether shutdown has been called. */
     private boolean isShutdown = false;
 
@@ -205,7 +212,7 @@ public class CompositeCacheManager
         return new CompositeCacheManager();
     }
 
-    /** Creates a shutdown hook */
+    /** Creates a shutdown hook and starts the scheduler service */
     protected CompositeCacheManager()
     {
         ShutdownHook shutdownHook = new ShutdownHook();
@@ -217,6 +224,29 @@ public class CompositeCacheManager
         {
             log.error( "Could not register shutdown hook.", e );
         }
+
+        this.scheduledExecutor = Executors.newScheduledThreadPool(4, new ThreadFactory()
+        {
+            public Thread newThread(Runnable runner)
+            {
+                Thread t = new Thread( runner );
+                String oldName = t.getName();
+                t.setName( "JCS-Scheduler-" + oldName );
+                t.setDaemon( true );
+                t.setPriority( Thread.MIN_PRIORITY );
+                return t;
+            }
+        });
+    }
+
+    /**
+     * Get the scheduler service
+     *
+     * @return the scheduledExecutor
+     */
+    public ScheduledExecutorService getScheduledExecutorService()
+    {
+        return scheduledExecutor;
     }
 
     /**
@@ -569,6 +599,9 @@ public class CompositeCacheManager
     {
         isShutdown = true;
 
+        // shutdown all scheduled jobs
+        this.scheduledExecutor.shutdownNow();
+
         // notify any observers
         synchronized ( shutdownObservers )
         {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java Sat Jan 26 18:49:14 2013
@@ -26,9 +26,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
@@ -37,6 +35,7 @@ import org.apache.jcs.engine.CacheStatus
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
 import org.apache.jcs.engine.behavior.IElementAttributes;
+import org.apache.jcs.engine.behavior.IRequireScheduler;
 import org.apache.jcs.engine.control.CompositeCache;
 import org.apache.jcs.engine.control.group.GroupAttrName;
 import org.apache.jcs.engine.control.group.GroupId;
@@ -53,7 +52,7 @@ import org.apache.jcs.engine.stats.behav
  * use the shrinker, the clock daemon will be setup to run the shrinker on this region.
  */
 public abstract class AbstractMemoryCache<K extends Serializable, V extends Serializable>
-    implements IMemoryCache<K, V>, Serializable
+    implements IMemoryCache<K, V>, Serializable, IRequireScheduler
 {
     /** Don't change. */
     private static final long serialVersionUID = -4494626991630099575L;
@@ -82,10 +81,6 @@ public abstract class AbstractMemoryCach
     /** How many to spool at a time. */
     protected int chunkSize;
 
-    /** The background memory shrinker, one for all regions. */
-    // TODO fix for multi-instance JCS
-    private static ScheduledExecutorService shrinkerDaemon;
-
     /**
      * For post reflection creation initialization
      * <p>
@@ -100,15 +95,18 @@ public abstract class AbstractMemoryCach
 
         chunkSize = cacheAttributes.getSpoolChunkSize();
         status = CacheStatus.ALIVE;
+    }
 
-        if ( cacheAttributes.getUseMemoryShrinker() )
+    /**
+     * @see org.apache.jcs.engine.behavior.IRequireScheduler#setScheduledExecutorService(java.util.concurrent.ScheduledExecutorService)
+     */
+    public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutor)
+    {
+        if ( cacheAttributes.isUseMemoryShrinker() )
         {
-            if ( shrinkerDaemon == null )
-            {
-                shrinkerDaemon = Executors.newScheduledThreadPool(1, new MyThreadFactory());
-            }
-
-            shrinkerDaemon.scheduleAtFixedRate(new ShrinkerThread<K, V>(this), 0, cacheAttributes.getShrinkerIntervalSeconds(), TimeUnit.SECONDS);
+            scheduledExecutor.scheduleAtFixedRate(
+                    new ShrinkerThread<K, V>(this), 0, cacheAttributes.getShrinkerIntervalSeconds(),
+                    TimeUnit.SECONDS);
         }
     }
 
@@ -235,11 +233,7 @@ public abstract class AbstractMemoryCach
     public void dispose()
         throws IOException
     {
-        log.info( "Memory Cache dispose called.  Shutting down shrinker thread if it is running." );
-        if ( shrinkerDaemon != null )
-        {
-            shrinkerDaemon.shutdownNow();
-        }
+        log.info( "Memory Cache dispose called." );
     }
 
     /**
@@ -396,25 +390,4 @@ public abstract class AbstractMemoryCach
         }
         return names;
     }
-
-    /**
-     * Allows us to set the daemon status on the clockdaemon
-     */
-    protected static class MyThreadFactory
-        implements ThreadFactory
-    {
-        /**
-         * @param runner
-         * @return a new thread for the given Runnable
-         */
-        public Thread newThread( Runnable runner )
-        {
-            Thread t = new Thread( runner );
-            String oldName = t.getName();
-            t.setName( "JCS-AbstractMemoryCache-" + oldName );
-            t.setDaemon( true );
-            t.setPriority( Thread.MIN_PRIORITY );
-            return t;
-        }
-    }
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryManager.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryManager.java Sat Jan 26 18:49:14 2013
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.jcs.engine.behavior.IProvideScheduler;
 import org.apache.jcs.engine.behavior.IShutdownObservable;
 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
 
@@ -100,6 +101,13 @@ public class UDPDiscoveryManager
             {
                 ( (IShutdownObservable) cacheMgr ).registerShutdownObserver( service );
             }
+
+            // inject scheduler
+            if ( cacheMgr instanceof IProvideScheduler)
+            {
+                service.setScheduledExecutorService(((IProvideScheduler)cacheMgr).getScheduledExecutorService());
+            }
+
             services.put( key, service );
         }
 

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryService.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryService.java Sat Jan 26 18:49:14 2013
@@ -24,13 +24,12 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.engine.behavior.IRequireScheduler;
 import org.apache.jcs.engine.behavior.IShutdownObserver;
 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
 import org.apache.jcs.utils.discovery.behavior.IDiscoveryListener;
@@ -46,14 +45,11 @@ import org.apache.jcs.utils.net.HostName
  * @author Aaron Smuts
  */
 public class UDPDiscoveryService
-    implements IShutdownObserver
+    implements IShutdownObserver, IRequireScheduler
 {
     /** The logger */
     private final static Log log = LogFactory.getLog( UDPDiscoveryService.class );
 
-    /** The background broadcaster. */
-    private static volatile ScheduledExecutorService senderDaemon;
-
     /** thread that listens for messages */
     private Thread udpReceiverThread;
 
@@ -63,9 +59,6 @@ public class UDPDiscoveryService
     /** the runnable that sends messages via the clock daemon */
     private UDPDiscoverySenderThread sender = null;
 
-    /** removes things that have been idle for too long */
-    private final UDPCleanupRunner cleanup;
-
     /** attributes */
     private UDPDiscoveryAttributes udpDiscoveryAttributes = null;
 
@@ -116,25 +109,26 @@ public class UDPDiscoveryService
                 + getUdpDiscoveryAttributes().getUdpDiscoveryPort() + "] we won't be able to find any other caches", e );
         }
 
-        if ( senderDaemon == null )
-        {
-            senderDaemon = Executors.newScheduledThreadPool(2, new MyThreadFactory());
-        }
-
         // create a sender thread
         sender = new UDPDiscoverySenderThread( getUdpDiscoveryAttributes(), getCacheNames() );
-        senderDaemon.scheduleAtFixedRate(sender, 0, 15, TimeUnit.SECONDS);
+    }
+
+    /**
+     * @see org.apache.jcs.engine.behavior.IRequireScheduler#setScheduledExecutorService(java.util.concurrent.ScheduledExecutorService)
+     */
+    public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutor)
+    {
+        if (sender != null)
+        {
+            scheduledExecutor.scheduleAtFixedRate(sender, 0, 15, TimeUnit.SECONDS);
+        }
 
-        // add the cleanup daemon too
-        cleanup = new UDPCleanupRunner( this );
+        /** removes things that have been idle for too long */
+        UDPCleanupRunner cleanup = new UDPCleanupRunner( this );
         // I'm going to use this as both, but it could happen
         // that something could hang around twice the time using this as the
         // delay and the idle time.
-        senderDaemon.scheduleAtFixedRate(cleanup, 0, getUdpDiscoveryAttributes().getMaxIdleTimeSec(), TimeUnit.SECONDS);
-
-        // add shutdown hook that will issue a remove call.
-        DiscoveryShutdownHook shutdownHook = new DiscoveryShutdownHook( this );
-        Runtime.getRuntime().addShutdownHook( shutdownHook );
+        scheduledExecutor.scheduleAtFixedRate(cleanup, 0, getUdpDiscoveryAttributes().getMaxIdleTimeSec(), TimeUnit.SECONDS);
     }
 
     /**
@@ -322,31 +316,6 @@ public class UDPDiscoveryService
     }
 
     /**
-     * Allows us to set the daemon status on the clockdaemon
-     * <p>
-     * @author aaronsm
-     */
-    protected static class MyThreadFactory
-        implements ThreadFactory
-    {
-        /**
-         * Sets the thread to daemon.
-         * <p>
-         * @param runner
-         * @return a daemon thread
-         */
-        public Thread newThread( Runnable runner )
-        {
-            Thread t = new Thread( runner );
-            String oldName = t.getName();
-            t.setName( "JCS-UDPDiscoveryService-" + oldName );
-            t.setDaemon( true );
-            t.setPriority( Thread.MIN_PRIORITY );
-            return t;
-        }
-    }
-
-    /**
      * Shuts down the receiver.
      */
     public void shutdown()
@@ -376,16 +345,6 @@ public class UDPDiscoveryService
                 log.info( "Shutting down UDP discovery service sender." );
             }
 
-            try
-            {
-                // interrupt all the threads.
-                senderDaemon.shutdownNow();
-            }
-            catch ( Exception e )
-            {
-                log.error( "Problem shutting down UDP sender." );
-            }
-
             // also call the shutdown on the sender thread itself, which
             // will result in a remove command.
             try

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java Sat Jan 26 18:49:14 2013
@@ -34,7 +34,7 @@ public class MockRemoteCacheDispatcher
     public RemoteCacheRequest<?, ?> lastRemoteCacheRequest;
 
     /** The response setup */
-    public RemoteCacheResponse<?, ?> setupRemoteCacheResponse;
+    public RemoteCacheResponse<?> setupRemoteCacheResponse;
 
     /** Records the last and returns setupRemoteCacheResponse.
      * <p>
@@ -43,11 +43,11 @@ public class MockRemoteCacheDispatcher
      * @throws IOException
      */
     @SuppressWarnings("unchecked")
-    public <K extends Serializable, V extends Serializable, KK extends Serializable, VV extends Serializable>
-        RemoteCacheResponse<K, V> dispatchRequest( RemoteCacheRequest<KK, VV> remoteCacheRequest )
+    public <K extends Serializable, V extends Serializable, T>
+        RemoteCacheResponse<T> dispatchRequest( RemoteCacheRequest<K, V> remoteCacheRequest )
         throws IOException
     {
         this.lastRemoteCacheRequest = remoteCacheRequest;
-        return (RemoteCacheResponse<K, V>)setupRemoteCacheResponse;
+        return (RemoteCacheResponse<T>)setupRemoteCacheResponse;
     }
 }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java Sat Jan 26 18:49:14 2013
@@ -21,6 +21,7 @@ package org.apache.jcs.auxiliary.remote.
 
 import java.io.IOException;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
@@ -83,8 +84,9 @@ public class RemoteHttpCacheClientUnitTe
         String key = "key";
 
         ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, key, "value" );
-        RemoteCacheResponse<String, String> remoteHttpCacheResponse = new RemoteCacheResponse<String, String>();
-        remoteHttpCacheResponse.getPayload().put( key, expected );
+        RemoteCacheResponse<ICacheElement<String, String>> remoteHttpCacheResponse =
+            new RemoteCacheResponse<ICacheElement<String,String>>();
+        remoteHttpCacheResponse.setPayload( expected );
 
         mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
 
@@ -116,8 +118,11 @@ public class RemoteHttpCacheClientUnitTe
         String pattern = "key";
 
         ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, "key", "value" );
-        RemoteCacheResponse<String, String> remoteHttpCacheResponse = new RemoteCacheResponse<String, String>();
-        remoteHttpCacheResponse.getPayload().put( "key", expected );
+        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<String, ICacheElement<String,String>>();
+        expectedMap.put( "key", expected );
+        RemoteCacheResponse<Map<String, ICacheElement<String, String>>> remoteHttpCacheResponse =
+            new RemoteCacheResponse<Map<String,ICacheElement<String,String>>>();
+        remoteHttpCacheResponse.setPayload( expectedMap );
 
         mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
 
@@ -149,8 +154,11 @@ public class RemoteHttpCacheClientUnitTe
         Set<String> keys = Collections.emptySet();
 
         ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, "key", "value" );
-        RemoteCacheResponse<String, String> remoteHttpCacheResponse = new RemoteCacheResponse<String, String>();
-        remoteHttpCacheResponse.getPayload().put( "key", expected );
+        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<String, ICacheElement<String,String>>();
+        expectedMap.put( "key", expected );
+        RemoteCacheResponse<Map<String, ICacheElement<String, String>>> remoteHttpCacheResponse =
+            new RemoteCacheResponse<Map<String,ICacheElement<String,String>>>();
+        remoteHttpCacheResponse.setPayload( expectedMap );
 
         mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
 

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java Sat Jan 26 18:49:14 2013
@@ -46,7 +46,7 @@ public class RemoteCacheServiceAdaptorUn
         RemoteCacheRequest<String, String> request = null;
 
         // DO WORK
-        RemoteCacheResponse<String, String> result = adaptor.processRequest( request );
+        RemoteCacheResponse<String> result = adaptor.processRequest( request );
 
         // VERIFY
         assertNotNull( "Should have a result.", result );
@@ -69,7 +69,7 @@ public class RemoteCacheServiceAdaptorUn
         RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId );
 
         // DO WORK
-        RemoteCacheResponse<String, String> result = adaptor.processRequest( request );
+        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
 
         // VERIFY
         assertNotNull( "Should have a result.", result );
@@ -92,7 +92,7 @@ public class RemoteCacheServiceAdaptorUn
                                                                                                   requesterId );
 
         // DO WORK
-        RemoteCacheResponse<String, String> result = adaptor.processRequest( request );
+        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
 
         // VERIFY
         assertNotNull( "Should have a result.", result );
@@ -115,7 +115,7 @@ public class RemoteCacheServiceAdaptorUn
                                                                                                   requesterId );
 
         // DO WORK
-        RemoteCacheResponse<String, String> result = adaptor.processRequest( request );
+        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
 
         // VERIFY
         assertNotNull( "Should have a result.", result );
@@ -139,7 +139,7 @@ public class RemoteCacheServiceAdaptorUn
         RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId );
 
         // DO WORK
-        RemoteCacheResponse<String, String> result = adaptor.processRequest( request );
+        RemoteCacheResponse<String> result = adaptor.processRequest( request );
 
         // VERIFY
         assertNotNull( "Should have a result.", result );
@@ -161,7 +161,7 @@ public class RemoteCacheServiceAdaptorUn
         RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createRemoveRequest( cacheName, key, requesterId );
 
         // DO WORK
-        RemoteCacheResponse<String, String> result = adaptor.processRequest( request );
+        RemoteCacheResponse<String> result = adaptor.processRequest( request );
 
         // VERIFY
         assertNotNull( "Should have a result.", result );
@@ -182,7 +182,7 @@ public class RemoteCacheServiceAdaptorUn
         RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId );
 
         // DO WORK
-        RemoteCacheResponse<String, String> result = adaptor.processRequest( request );
+        RemoteCacheResponse<String> result = adaptor.processRequest( request );
 
         // VERIFY
         assertNotNull( "Should have a result.", result );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java?rev=1438943&r1=1438942&r2=1438943&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java Sat Jan 26 18:49:14 2013
@@ -4,12 +4,11 @@ import java.util.Properties;
 
 import junit.framework.TestCase;
 
+import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheConfigurator;
 import org.apache.jcs.auxiliary.MockAuxiliaryCache;
 import org.apache.jcs.auxiliary.MockAuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.MockAuxiliaryCacheFactory;
-import org.apache.jcs.engine.CompositeCacheAttributes;
-import org.apache.jcs.engine.ElementAttributes;
 import org.apache.jcs.engine.logging.MockCacheEventLogger;
 
 /** Unit tests for the configurator. */
@@ -41,12 +40,9 @@ public class CompositeCacheConfiguratorU
 
         CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( manager );
 
-        CompositeCache<String, String> cache =
-            new CompositeCache<String, String>( regionName, new CompositeCacheAttributes(), new ElementAttributes() );
-
         // DO WORK
-        MockAuxiliaryCache<String, String> result = (MockAuxiliaryCache<String, String>) configurator
-            .parseAuxiliary( cache, props, auxName, regionName );
+        AuxiliaryCache<String, String> aux = configurator.parseAuxiliary( props, auxName, regionName );
+        MockAuxiliaryCache<String, String> result = (MockAuxiliaryCache<String, String>)aux;
 
         // VERIFY
         assertNotNull( "Should have an auxcache.", result );



Mime
View raw message