commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1344374 [7/14] - in /commons/proper/jcs/trunk: ./ auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/ auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/javagroups/ auxiliary-builds/jdk14/src/java/org/apache/jcs...
Date Wed, 30 May 2012 18:14:51 GMT
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/AbstractCacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/AbstractCacheEventQueue.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/AbstractCacheEventQueue.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/AbstractCacheEventQueue.java Wed May 30 18:14:43 2012
@@ -31,8 +31,8 @@ import org.apache.jcs.engine.behavior.IC
 /**
  * An abstract base class to the different implementations
  */
-public abstract class AbstractCacheEventQueue
-    implements ICacheEventQueue
+public abstract class AbstractCacheEventQueue<K extends Serializable, V extends Serializable>
+    implements ICacheEventQueue<K, V>
 {
     /** The logger. */
     protected static final Log log = LogFactory.getLog( AbstractCacheEventQueue.class );
@@ -50,7 +50,7 @@ public abstract class AbstractCacheEvent
      * When the events are pulled off the queue, the tell the listener to handle the specific event
      * type. The work is done by the listener.
      */
-    protected ICacheListener listener;
+    protected ICacheListener<K, V> listener;
 
     /** Id of the listener registered with this queue */
     protected long listenerId;
@@ -139,7 +139,7 @@ public abstract class AbstractCacheEvent
      * @param ce The feature to be added to the PutEvent attribute
      * @exception IOException
      */
-    public synchronized void addPutEvent( ICacheElement ce )
+    public synchronized void addPutEvent( ICacheElement<K, V> ce )
         throws IOException
     {
         if ( isWorking() )
@@ -162,7 +162,7 @@ public abstract class AbstractCacheEvent
      * @param key The feature to be added to the RemoveEvent attribute
      * @exception IOException
      */
-    public synchronized void addRemoveEvent( Serializable key )
+    public synchronized void addRemoveEvent( K key )
         throws IOException
     {
         if ( isWorking() )
@@ -236,7 +236,7 @@ public abstract class AbstractCacheEvent
         Node next = null;
 
         /** The payload. */
-        AbstractCacheEventQueue.AbstractCacheEvent event = null;
+        AbstractCacheEventQueue<?, ?>.AbstractCacheEvent event = null;
     }
 
     /**
@@ -251,9 +251,6 @@ public abstract class AbstractCacheEvent
         /** Number of failures encountered processing this event. */
         int failures = 0;
 
-        /** Have we finished the job */
-        boolean done = false;
-
         /**
          * Main processing method for the AbstractCacheEvent object
          */
@@ -295,7 +292,7 @@ public abstract class AbstractCacheEvent
                     {
                         log.warn( "Interrupted while sleeping for retry on event " + this + "." );
                     }
-                    // TODO consider if this is best. maybe we shoudl just
+                    // TODO consider if this is best. maybe we should just
                     // destroy
                     setWorking( false );
                     setAlive( false );
@@ -320,7 +317,7 @@ public abstract class AbstractCacheEvent
         extends AbstractCacheEvent
     {
         /** The element to put to the listener */
-        private final ICacheElement ice;
+        private final ICacheElement<K, V> ice;
 
         /**
          * Constructor for the PutEvent object.
@@ -328,7 +325,7 @@ public abstract class AbstractCacheEvent
          * @param ice
          * @exception IOException
          */
-        PutEvent( ICacheElement ice )
+        PutEvent( ICacheElement<K, V> ice )
             throws IOException
         {
             this.ice = ice;
@@ -370,7 +367,7 @@ public abstract class AbstractCacheEvent
         extends AbstractCacheEvent
     {
         /** The key to remove from the listener */
-        private final Serializable key;
+        private final K key;
 
         /**
          * Constructor for the RemoveEvent object
@@ -378,7 +375,7 @@ public abstract class AbstractCacheEvent
          * @param key
          * @exception IOException
          */
-        RemoveEvent( Serializable key )
+        RemoveEvent( K key )
             throws IOException
         {
             this.key = key;

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java Wed May 30 18:14:43 2012
@@ -32,14 +32,14 @@ import org.apache.jcs.engine.behavior.IC
  * Used for Cache-to-Cache messaging purposes. These are used in the balking
  * facades in the lateral and remote caches.
  */
-public class CacheAdaptor
-    implements ICacheListener
+public class CacheAdaptor<K extends Serializable, V extends Serializable>
+    implements ICacheListener<K, V>
 {
     /** The logger */
     private final static Log log = LogFactory.getLog( CacheAdaptor.class );
 
-    /** The cache we are adadpting. */
-    private final ICache cache;
+    /** The cache we are adapting. */
+    private final ICache<K, V> cache;
 
     /** The unique id of this listener. */
     protected long listenerId = 0;
@@ -75,7 +75,7 @@ public class CacheAdaptor
      * <p>
      * @param cache
      */
-    public CacheAdaptor( ICache cache )
+    public CacheAdaptor( ICache<K, V> cache )
     {
         this.cache = cache;
     }
@@ -86,7 +86,7 @@ public class CacheAdaptor
      * @param item
      * @throws IOException
      */
-    public void handlePut( ICacheElement item )
+    public void handlePut( ICacheElement<K, V> item )
         throws IOException
     {
         try
@@ -102,11 +102,11 @@ public class CacheAdaptor
     /**
      * Removes an item.
      * <p>
-     * @param cacheName 
-     * @param key 
-     * @throws IOException 
+     * @param cacheName
+     * @param key
+     * @throws IOException
      */
-    public void handleRemove( String cacheName, Serializable key )
+    public void handleRemove( String cacheName, K key )
         throws IOException
     {
         cache.remove( key );
@@ -115,8 +115,8 @@ public class CacheAdaptor
     /**
      * Clears the region.
      * <p>
-     * @param cacheName 
-     * @throws IOException 
+     * @param cacheName
+     * @throws IOException
      */
     public void handleRemoveAll( String cacheName )
         throws IOException
@@ -127,8 +127,8 @@ public class CacheAdaptor
     /**
      * Shutdown call.
      * <p>
-     * @param cacheName 
-     * @throws IOException 
+     * @param cacheName
+     * @throws IOException
      */
     public void handleDispose( String cacheName )
         throws IOException

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java Wed May 30 18:14:43 2012
@@ -27,8 +27,8 @@ import org.apache.jcs.engine.behavior.IE
 /**
  * Generic element wrapper. Often stuffed inside another.
  */
-public class CacheElement
-    implements ICacheElement, Serializable
+public class CacheElement<K extends Serializable, V extends Serializable>
+    implements ICacheElement<K, V>, Serializable
 {
     /** Don't change */
     private static final long serialVersionUID = -6062305728297627263L;
@@ -37,10 +37,10 @@ public class CacheElement
     public final String cacheName;
 
     /** This is the cache key by which the value can be referenced. */
-    public final Serializable key;
+    public final K key;
 
     /** This is the cached value, reference by the key. */
-    public final Serializable val;
+    public final V val;
 
     /**
      * These attributes hold information about the element and what it is
@@ -55,7 +55,7 @@ public class CacheElement
      * @param key
      * @param val
      */
-    public CacheElement( String cacheName, Serializable key, Serializable val )
+    public CacheElement( String cacheName, K key, V val )
     {
         this.cacheName = cacheName;
         this.key = key;
@@ -70,27 +70,13 @@ public class CacheElement
      * @param val
      * @param attrArg
      */
-    public CacheElement( String cacheName, Serializable key, Serializable val, IElementAttributes attrArg )
+    public CacheElement( String cacheName, K key, V val, IElementAttributes attrArg )
     {
-        this.cacheName = cacheName;
-        this.key = key;
-        this.val = val;
+        this(cacheName, key, val);
         this.attr = attrArg;
     }
 
     /**
-     * Constructor for the CacheElement object
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param val
-     */
-    public CacheElement( String cacheName, Serializable key, Object val )
-    {
-        this( cacheName, key, (Serializable) val );
-    }
-
-    /**
      * Gets the cacheName attribute of the CacheElement object
      * <p>
      * @return The cacheName value
@@ -105,7 +91,7 @@ public class CacheElement
      * <p>
      * @return The key value
      */
-    public Serializable getKey()
+    public K getKey()
     {
         return this.key;
     }
@@ -115,7 +101,7 @@ public class CacheElement
      * <p>
      * @return The val value
      */
-    public Serializable getVal()
+    public V getVal()
     {
         return this.val;
     }
@@ -128,7 +114,7 @@ public class CacheElement
      */
     public void setElementAttributes( IElementAttributes attr )
     {
-        this.attr = (ElementAttributes) attr;
+        this.attr = attr;
     }
 
     /**

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java Wed May 30 18:14:43 2012
@@ -26,8 +26,8 @@ import org.apache.jcs.engine.behavior.IC
 import org.apache.jcs.engine.behavior.IElementAttributes;
 
 /** Either serialized value or the value should be null; */
-public class CacheElementSerialized
-    implements ICacheElementSerialized
+public class CacheElementSerialized<K extends Serializable, V extends Serializable>
+    implements ICacheElementSerialized<K, V>
 {
     /** Don't change. */
     private static final long serialVersionUID = -7265084818647601874L;
@@ -36,7 +36,7 @@ public class CacheElementSerialized
     private final String cacheName;
 
     /** This is the cache key by which the value can be referenced. */
-    private final Serializable key;
+    private final K key;
 
     /** The serialized value. */
     private final byte[] serializedValue;
@@ -54,7 +54,7 @@ public class CacheElementSerialized
      * @param serializedValueArg
      * @param elementAttributesArg
      */
-    public CacheElementSerialized( String cacheNameArg, Serializable keyArg, byte[] serializedValueArg,
+    public CacheElementSerialized( String cacheNameArg, K keyArg, byte[] serializedValueArg,
                                    IElementAttributes elementAttributesArg )
     {
         this.cacheName = cacheNameArg;
@@ -74,7 +74,7 @@ public class CacheElementSerialized
     }
 
     /** @return Serializable */
-    public Serializable getKey()
+    public K getKey()
     {
         return this.key;
     }
@@ -104,7 +104,7 @@ public class CacheElementSerialized
      * <p>
      * @return Serializable
      */
-    public Serializable getVal()
+    public V getVal()
     {
         return null;
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java Wed May 30 18:14:43 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.engine;
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.ArrayList;
 
 import org.apache.jcs.engine.behavior.ICacheListener;
@@ -34,8 +35,8 @@ import org.apache.jcs.engine.stats.behav
  * thread, and kill the thread if the queue goes empty for a specified period, now set to 1 minute.
  * If something comes in after that a new processor thread should be created.
  */
-public class CacheEventQueue
-    extends AbstractCacheEventQueue
+public class CacheEventQueue<K extends Serializable, V extends Serializable>
+    extends AbstractCacheEventQueue<K, V>
 {
     /** The type of queue -- there are pooled and single */
     private static final String queueType = SINGLE_QUEUE_TYPE;
@@ -62,7 +63,7 @@ public class CacheEventQueue
      * @param listenerId
      * @param cacheName
      */
-    public CacheEventQueue( ICacheListener listener, long listenerId, String cacheName )
+    public CacheEventQueue( ICacheListener<K, V> listener, long listenerId, String cacheName )
     {
         this( listener, listenerId, cacheName, 10, 500 );
     }
@@ -76,7 +77,7 @@ public class CacheEventQueue
      * @param maxFailure
      * @param waitBeforeRetry
      */
-    public CacheEventQueue( ICacheListener listener, long listenerId, String cacheName, int maxFailure,
+    public CacheEventQueue( ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure,
                             int waitBeforeRetry )
     {
         initialize( listener, listenerId, cacheName, maxFailure, waitBeforeRetry, null );
@@ -92,7 +93,7 @@ public class CacheEventQueue
      * @param waitBeforeRetry
      * @param threadPoolName
      */
-    public void initialize( ICacheListener listener, long listenerId, String cacheName, int maxFailure,
+    public void initialize( ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure,
                             int waitBeforeRetry, String threadPoolName )
     {
         if ( listener == null )
@@ -230,14 +231,14 @@ public class CacheEventQueue
         extends Thread
     {
         /** The queue to work */
-        CacheEventQueue queue;
+        CacheEventQueue<K, V> queue;
 
         /**
          * Constructor for the QProcessor object
          * <p>
          * @param aQueue the event queue to take items from.
          */
-        QProcessor( CacheEventQueue aQueue )
+        QProcessor( CacheEventQueue<K, V> aQueue )
         {
             super( "CacheEventQueue.QProcessor-" + aQueue.cacheName );
 
@@ -324,7 +325,7 @@ public class CacheEventQueue
 
             Node node = head.next;
 
-            AbstractCacheEvent value = node.event;
+            AbstractCacheEvent value = (AbstractCacheEvent) node.event;
 
             if ( log.isDebugEnabled() )
             {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java Wed May 30 18:14:43 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.engine;
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.engine.behavior.ICacheEventQueue;
@@ -31,7 +33,7 @@ import org.apache.jcs.utils.config.Optio
  * <p>
  * @author aaronsm
  */
-public class CacheEventQueueFactory
+public class CacheEventQueueFactory<K extends Serializable, V extends Serializable>
 {
     /** The logger. */
     private static final Log log = LogFactory.getLog( CacheEventQueueFactory.class );
@@ -46,7 +48,7 @@ public class CacheEventQueueFactory
      * @param poolType - SINGLE, QUEUED, or classname
      * @return ICacheEventQueue
      */
-    public ICacheEventQueue createCacheEventQueue( ICacheListener listener, long listenerId, String cacheName,
+    public ICacheEventQueue<K, V> createCacheEventQueue( ICacheListener<K, V> listener, long listenerId, String cacheName,
                                                    String threadPoolName, String poolType )
     {
         return createCacheEventQueue( listener, listenerId, cacheName, 10, 500, threadPoolName, poolType );
@@ -64,7 +66,7 @@ public class CacheEventQueueFactory
      * @param poolType single or pooled
      * @return ICacheEventQueue
      */
-    public ICacheEventQueue createCacheEventQueue( ICacheListener listener, long listenerId, String cacheName,
+    public ICacheEventQueue<K, V> createCacheEventQueue( ICacheListener<K, V> listener, long listenerId, String cacheName,
                                                    int maxFailure, int waitBeforeRetry, String threadPoolName,
                                                    String poolType )
     {
@@ -73,19 +75,19 @@ public class CacheEventQueueFactory
             log.debug( "threadPoolName = [" + threadPoolName + "] poolType = " + poolType + " " );
         }
 
-        ICacheEventQueue eventQueue = null;
+        ICacheEventQueue<K, V> eventQueue = null;
         if ( poolType == null || ICacheEventQueue.SINGLE_QUEUE_TYPE.equalsIgnoreCase( poolType ) )
         {
-            eventQueue = new CacheEventQueue( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
+            eventQueue = new CacheEventQueue<K, V>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
         }
         else if ( ICacheEventQueue.POOLED_QUEUE_TYPE.equalsIgnoreCase( poolType ) )
         {
-            eventQueue = new PooledCacheEventQueue( listener, listenerId, cacheName, maxFailure, waitBeforeRetry,
+            eventQueue = new PooledCacheEventQueue<K, V>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry,
                                                     threadPoolName );
         }
         else
         {
-            eventQueue = (ICacheEventQueue) OptionConverter.instantiateByClassName( poolType, ICacheEventQueue.class,
+            eventQueue = (ICacheEventQueue<K, V>) OptionConverter.instantiateByClassName( poolType, ICacheEventQueue.class,
                                                                                     null );
             if ( eventQueue != null )
             {
@@ -99,7 +101,7 @@ public class CacheEventQueueFactory
             {
                 log.warn( "Could not instantiate custom event queue [" + poolType
                     + "].  Will use standard single threaded queue." );
-                eventQueue = new CacheEventQueue( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
+                eventQueue = new CacheEventQueue<K, V>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
             }
         }
         return eventQueue;

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java Wed May 30 18:14:43 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.engine;
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
@@ -30,21 +31,21 @@ import org.apache.jcs.engine.behavior.IC
  * Used to associates a set of [cache listener to cache event queue] for a
  * cache.
  */
-public class CacheListeners
+public class CacheListeners<K extends Serializable, V extends Serializable>
 {
     /** The cache using the queue. */
-    public final ICache cache;
+    public final ICache<K, V> cache;
 
     /** Map ICacheListener to ICacheEventQueue */
-    public final Map<Long, ICacheEventQueue> eventQMap =
-        new Hashtable<Long, ICacheEventQueue>();
+    public final Map<Long, ICacheEventQueue<K, V>> eventQMap =
+        new Hashtable<Long, ICacheEventQueue<K, V>>();
 
     /**
      * Constructs with the given cache.
      * <p>
      * @param cache
      */
-    public CacheListeners( ICache cache )
+    public CacheListeners( ICache<K, V> cache )
     {
         if ( cache == null )
         {
@@ -67,7 +68,7 @@ public class CacheListeners
         {
             buffer.append( "\n Event Queue Map " );
             buffer.append( "\n size = " + eventQMap.size() );
-            Iterator<Map.Entry<Long, ICacheEventQueue>> it = eventQMap.entrySet().iterator();
+            Iterator<Map.Entry<Long, ICacheEventQueue<K, V>>> it = eventQMap.entrySet().iterator();
             while ( it.hasNext() )
             {
                 buffer.append( "\n Entry: " + it.next() );

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java Wed May 30 18:14:43 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.engine;
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -45,7 +46,8 @@ public class CacheWatchRepairable
     private ICacheObserver cacheWatch;
 
     /** Map of cache regions. */
-    private final Map<String, Set<ICacheListener>> cacheMap = new HashMap<String, Set<ICacheListener>>();
+    private final Map<String, Set<ICacheListener<? extends Serializable, ? extends Serializable>>> cacheMap =
+        new HashMap<String, Set<ICacheListener<? extends Serializable, ? extends Serializable>>>();
 
     /**
      * Replaces the underlying cache watch service and reattached all existing listeners to the new
@@ -58,10 +60,10 @@ public class CacheWatchRepairable
         this.cacheWatch = cacheWatch;
         synchronized ( cacheMap )
         {
-            for (Map.Entry<String, Set<ICacheListener>> entry : cacheMap.entrySet())
+            for (Map.Entry<String, Set<ICacheListener<? extends Serializable, ? extends Serializable>>> entry : cacheMap.entrySet())
             {
                 String cacheName = entry.getKey();
-                for (ICacheListener listener : entry.getValue())
+                for (ICacheListener<? extends Serializable, ? extends Serializable> listener : entry.getValue())
                 {
                     try
                     {
@@ -89,17 +91,17 @@ public class CacheWatchRepairable
      * @param obj The feature to be added to the CacheListener attribute
      * @throws IOException
      */
-    public void addCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( String cacheName, ICacheListener<K, V> obj )
         throws IOException
     {
         // Record the added cache listener locally, regardless of whether the
         // remote add-listener operation succeeds or fails.
         synchronized ( cacheMap )
         {
-            Set<ICacheListener> listenerSet = cacheMap.get( cacheName );
+            Set<ICacheListener<? extends Serializable, ? extends Serializable>> listenerSet = cacheMap.get( cacheName );
             if ( listenerSet == null )
             {
-                listenerSet = new HashSet<ICacheListener>();
+                listenerSet = new HashSet<ICacheListener<? extends Serializable, ? extends Serializable>>();
                 cacheMap.put( cacheName, listenerSet );
             }
             listenerSet.add( obj );
@@ -118,14 +120,14 @@ public class CacheWatchRepairable
      * @param obj The feature to be added to the CacheListener attribute
      * @throws IOException
      */
-    public void addCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( ICacheListener<K, V> obj )
         throws IOException
     {
         // Record the added cache listener locally, regardless of whether the
         // remote add-listener operation succeeds or fails.
         synchronized ( cacheMap )
         {
-            for (Set<ICacheListener> listenerSet : cacheMap.values())
+            for (Set<ICacheListener<? extends Serializable, ? extends Serializable>> listenerSet : cacheMap.values())
             {
                 listenerSet.add( obj );
             }
@@ -145,7 +147,7 @@ public class CacheWatchRepairable
      * @param obj
      * @throws IOException
      */
-    public void removeCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( String cacheName, ICacheListener<K, V> obj )
         throws IOException
     {
         if ( log.isInfoEnabled() )
@@ -156,7 +158,7 @@ public class CacheWatchRepairable
         // remove-listener operation succeeds or fails.
         synchronized ( cacheMap )
         {
-            Set<ICacheListener> listenerSet = cacheMap.get( cacheName );
+            Set<ICacheListener<? extends Serializable, ? extends Serializable>> listenerSet = cacheMap.get( cacheName );
             if ( listenerSet != null )
             {
                 listenerSet.remove( obj );
@@ -169,7 +171,7 @@ public class CacheWatchRepairable
      * @param obj
      * @throws IOException
      */
-    public void removeCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( ICacheListener<K, V> obj )
         throws IOException
     {
         if ( log.isInfoEnabled() )
@@ -181,7 +183,7 @@ public class CacheWatchRepairable
         // remove-listener operation succeeds or fails.
         synchronized ( cacheMap )
         {
-            for (Set<ICacheListener> listenerSet : cacheMap.values())
+            for (Set<ICacheListener<? extends Serializable, ? extends Serializable>> listenerSet : cacheMap.values())
             {
                 if ( log.isDebugEnabled() )
                 {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java Wed May 30 18:14:43 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.engine;
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
@@ -40,8 +41,8 @@ import org.apache.jcs.utils.threadpool.T
  * more than a few threads at them will serve no purpose other than to saturate the IO interface. In
  * light of this, having one thread per region seems unnecessary. This may prove to be false.
  */
-public class PooledCacheEventQueue
-    extends AbstractCacheEventQueue
+public class PooledCacheEventQueue<K extends Serializable, V extends Serializable>
+    extends AbstractCacheEventQueue<K, V>
 {
     /** The type of event queue */
     private static final String queueType = POOLED_QUEUE_TYPE;
@@ -59,7 +60,7 @@ public class PooledCacheEventQueue
      * @param waitBeforeRetry
      * @param threadPoolName
      */
-    public PooledCacheEventQueue( ICacheListener listener, long listenerId, String cacheName, int maxFailure,
+    public PooledCacheEventQueue( ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure,
                                   int waitBeforeRetry, String threadPoolName )
     {
         initialize( listener, listenerId, cacheName, maxFailure, waitBeforeRetry, threadPoolName );
@@ -75,7 +76,7 @@ public class PooledCacheEventQueue
      * @param waitBeforeRetry
      * @param threadPoolName
      */
-    public void initialize( ICacheListener listener, long listenerId, String cacheName, int maxFailure,
+    public void initialize( ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure,
                             int waitBeforeRetry, String threadPoolName )
     {
         if ( listener == null )

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java Wed May 30 18:14:43 2012
@@ -33,8 +33,8 @@ import org.apache.jcs.engine.behavior.IZ
 /**
  * Zombie adapter for any cache service. Balks at every call.
  */
-public class ZombieCacheService
-    implements ICacheService, IZombie
+public class ZombieCacheService<K extends Serializable, V extends Serializable>
+    implements ICacheService<K, V>, IZombie
 {
     /** The logger. */
     private static final Log log = LogFactory.getLog( ZombieCacheService.class );
@@ -42,7 +42,7 @@ public class ZombieCacheService
     /**
      * @param item
      */
-    public void put( ICacheElement item )
+    public void put( ICacheElement<K, V> item )
     {
         if ( log.isDebugEnabled() )
         {
@@ -56,7 +56,7 @@ public class ZombieCacheService
      * <p>
      * @param item
      */
-    public void update( ICacheElement item )
+    public void update( ICacheElement<K, V> item )
     {
         // zombies have no inner life
     }
@@ -66,7 +66,7 @@ public class ZombieCacheService
      * @param key
      * @return null. zombies have no internal data
      */
-    public ICacheElement get( String cacheName, Serializable key )
+    public ICacheElement<K, V> get( String cacheName, K key )
     {
         return null;
     }
@@ -78,7 +78,7 @@ public class ZombieCacheService
      * @param keys
      * @return Collections.EMPTY_MAP
      */
-    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
     {
         return Collections.emptyMap();
     }
@@ -90,7 +90,7 @@ public class ZombieCacheService
      * @param pattern
      * @return Collections.EMPTY_MAP
      */
-    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
     {
         return Collections.emptyMap();
     }
@@ -103,7 +103,7 @@ public class ZombieCacheService
      * @param container
      * @return null always
      */
-    public Serializable get( String cacheName, Serializable key, boolean container )
+    public Serializable get( String cacheName, K key, boolean container )
     {
         if ( log.isDebugEnabled() )
         {
@@ -117,7 +117,7 @@ public class ZombieCacheService
      * @param cacheName
      * @param key
      */
-    public void remove( String cacheName, Serializable key )
+    public void remove( String cacheName, K key )
     {
         // zombies have no inner life
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java Wed May 30 18:14:43 2012
@@ -42,9 +42,9 @@ import org.apache.jcs.utils.timing.Elaps
  * <p>
  * This originated in the remote cache.
  */
-public class ZombieCacheServiceNonLocal
-    extends ZombieCacheService
-    implements ICacheServiceNonLocal
+public class ZombieCacheServiceNonLocal<K extends Serializable, V extends Serializable>
+    extends ZombieCacheService<K, V>
+    implements ICacheServiceNonLocal<K, V>
 {
     /** The logger */
     private final static Log log = LogFactory.getLog( ZombieCacheServiceNonLocal.class );
@@ -90,11 +90,11 @@ public class ZombieCacheServiceNonLocal
      * @param item ICacheElement
      * @param listenerId - identifies the caller.
      */
-    public void update( ICacheElement item, long listenerId )
+    public void update( ICacheElement<K, V> item, long listenerId )
     {
         if ( maxQueueSize > 0 )
         {
-            PutEvent event = new PutEvent( item, listenerId );
+            PutEvent<K, V> event = new PutEvent<K, V>( item, listenerId );
             queue.add( event );
         }
         // Zombies have no inner life
@@ -107,11 +107,11 @@ public class ZombieCacheServiceNonLocal
      * @param key - item key
      * @param listenerId - identifies the caller.
      */
-    public void remove( String cacheName, Serializable key, long listenerId )
+    public void remove( String cacheName, K key, long listenerId )
     {
         if ( maxQueueSize > 0 )
         {
-            RemoveEvent event = new RemoveEvent( cacheName, key, listenerId );
+            RemoveEvent<K, V> event = new RemoveEvent<K, V>( cacheName, key, listenerId );
             queue.add( event );
         }
         // Zombies have no inner life
@@ -142,7 +142,7 @@ public class ZombieCacheServiceNonLocal
      * @return null
      * @throws IOException
      */
-    public ICacheElement get( String cacheName, Serializable key, long requesterId )
+    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
         throws IOException
     {
         // Zombies have no inner life
@@ -158,7 +158,7 @@ public class ZombieCacheServiceNonLocal
      * @return empty map
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
         throws IOException
     {
         return Collections.emptyMap();
@@ -170,9 +170,9 @@ public class ZombieCacheServiceNonLocal
      * @param requesterId - identity of the caller
      * @return an empty map. zombies have no internal data
      */
-    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
     {
-        return new HashMap<Serializable, ICacheElement>();
+        return new HashMap<K, ICacheElement<K, V>>();
     }
 
     /**
@@ -182,7 +182,7 @@ public class ZombieCacheServiceNonLocal
      * @param groupName - group name
      * @return empty set
      */
-    public Set<Serializable> getGroupKeys( String cacheName, String groupName )
+    public Set<K> getGroupKeys( String cacheName, String groupName )
     {
         return Collections.emptySet();
     }
@@ -193,7 +193,7 @@ public class ZombieCacheServiceNonLocal
      * @param service
      * @throws Exception
      */
-    public synchronized void propagateEvents( ICacheServiceNonLocal service )
+    public synchronized void propagateEvents( ICacheServiceNonLocal<K, V> service )
         throws Exception
     {
         int cnt = 0;
@@ -211,12 +211,12 @@ public class ZombieCacheServiceNonLocal
 
             if ( event instanceof PutEvent )
             {
-                PutEvent putEvent = (PutEvent) event;
+                PutEvent<K, V> putEvent = (PutEvent<K, V>) event;
                 service.update( putEvent.element, event.requesterId );
             }
             else if ( event instanceof RemoveEvent )
             {
-                RemoveEvent removeEvent = (RemoveEvent) event;
+                RemoveEvent<K, V> removeEvent = (RemoveEvent<K, V>) event;
                 service.remove( event.cacheName, removeEvent.key, event.requesterId );
             }
             else if ( event instanceof RemoveAllEvent )
@@ -234,7 +234,7 @@ public class ZombieCacheServiceNonLocal
     /**
      * Base of the other events.
      */
-    protected abstract class ZombieEvent
+    protected static abstract class ZombieEvent
     {
         /** The name of the region. */
         String cacheName;
@@ -246,18 +246,18 @@ public class ZombieCacheServiceNonLocal
     /**
      * A basic put event.
      */
-    private class PutEvent
+    private static class PutEvent<K extends Serializable, V extends Serializable>
         extends ZombieEvent
     {
         /** The element to put */
-        ICacheElement element;
+        ICacheElement<K, V> element;
 
         /**
          * Set the element
          * @param element
          * @param requesterId
          */
-        public PutEvent( ICacheElement element, long requesterId )
+        public PutEvent( ICacheElement<K, V> element, long requesterId )
         {
             this.requesterId = requesterId;
             this.element = element;
@@ -267,11 +267,11 @@ public class ZombieCacheServiceNonLocal
     /**
      * A basic Remove event.
      */
-    private class RemoveEvent
+    private static class RemoveEvent<K extends Serializable, V extends Serializable>
         extends ZombieEvent
     {
         /** The key to remove */
-        Serializable key;
+        K key;
 
         /**
          * Set the element
@@ -279,7 +279,7 @@ public class ZombieCacheServiceNonLocal
          * @param key
          * @param requesterId
          */
-        public RemoveEvent( String cacheName, Serializable key, long requesterId )
+        public RemoveEvent( String cacheName, K key, long requesterId )
         {
             this.cacheName = cacheName;
             this.requesterId = requesterId;
@@ -290,7 +290,7 @@ public class ZombieCacheServiceNonLocal
     /**
      * A basic RemoveAll event.
      */
-    private class RemoveAllEvent
+    private static class RemoveAllEvent
         extends ZombieEvent
     {
         /**

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheWatch.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheWatch.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheWatch.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheWatch.java Wed May 30 18:14:43 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.engine;
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.engine.behavior.ICacheListener;
 import org.apache.jcs.engine.behavior.ICacheObserver;
 import org.apache.jcs.engine.behavior.IZombie;
@@ -35,7 +37,7 @@ public class ZombieCacheWatch
      * @param cacheName The feature to be added to the CacheListener attribute
      * @param obj The feature to be added to the CacheListener attribute
      */
-    public void addCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( String cacheName, ICacheListener<K, V> obj )
     {
         // empty
     }
@@ -45,7 +47,7 @@ public class ZombieCacheWatch
      * <p>
      * @param obj The feature to be added to the CacheListener attribute
      */
-    public void addCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( ICacheListener<K, V> obj )
     {
         // empty
     }
@@ -54,7 +56,7 @@ public class ZombieCacheWatch
      * @param cacheName
      * @param obj
      */
-    public void removeCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( String cacheName, ICacheListener<K, V> obj )
     {
         // empty
     }
@@ -62,7 +64,7 @@ public class ZombieCacheWatch
     /**
      * @param obj
      */
-    public void removeCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( ICacheListener<K, V> obj )
     {
         // empty
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java Wed May 30 18:14:43 2012
@@ -33,7 +33,7 @@ import org.apache.jcs.engine.match.behav
  * This allows for a suite of reusable components for accessing such structures, for example
  * asynchronous access via an event queue.
  */
-public interface ICache
+public interface ICache<K extends Serializable, V extends Serializable>
     extends ICacheType
 {
     /**
@@ -42,7 +42,7 @@ public interface ICache
      * @param element
      * @throws IOException
      */
-    void update( ICacheElement element )
+    void update( ICacheElement<K, V> element )
         throws IOException;
 
     /**
@@ -52,17 +52,17 @@ public interface ICache
      * @return a cache element, or null if there is no data in cache for this key
      * @throws IOException
      */
-    ICacheElement get( Serializable key )
+    ICacheElement<K, V> get( K key )
         throws IOException;
 
     /**
      * Gets multiple items from the cache based on the given set of keys.
      * <p>
      * @param keys
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no data in cache for any of these keys
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
+    Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
         throws IOException;
 
     /**
@@ -73,10 +73,10 @@ public interface ICache
      * Auxiliaries will do their best to handle simple expressions.  For instance, the JDBC disk cache will convert * to % and . to _
      * <p>
      * @param pattern
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data matching the pattern.
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no data matching the pattern.
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMatching(String pattern)
+    Map<K, ICacheElement<K, V>> getMatching(String pattern)
         throws IOException;
 
     /**
@@ -86,7 +86,7 @@ public interface ICache
      * @return false if there was an error in removal
      * @throws IOException
      */
-    boolean remove( Serializable key )
+    boolean remove( K key )
         throws IOException;
 
     /**
@@ -137,5 +137,5 @@ public interface ICache
      * <p>
      * @param keyMatcher
      */
-    void setKeyMatcher( IKeyMatcher keyMatcher );
+    void setKeyMatcher( IKeyMatcher<K> keyMatcher );
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElement.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElement.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElement.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElement.java Wed May 30 18:14:43 2012
@@ -31,12 +31,12 @@ import java.io.Serializable;
  * allowed to be spooled, etc.
  *
  */
-public interface ICacheElement /* TODO: Should be generic */
+public interface ICacheElement<K extends Serializable, V extends Serializable>
     extends Serializable
 {
 
     /**
-     * Gets the cacheName attribute of the ICacheElement object. The cacheName
+     * Gets the cacheName attribute of the ICacheElement<K, V> object. The cacheName
      * is also known as the region name.
      *
      * @return The cacheName value
@@ -44,28 +44,28 @@ public interface ICacheElement /* TODO: 
     public String getCacheName();
 
     /**
-     * Gets the key attribute of the ICacheElement object
+     * Gets the key attribute of the ICacheElement<K, V> object
      *
      * @return The key value
      */
-    public Serializable getKey();
+    public K getKey();
 
     /**
-     * Gets the val attribute of the ICacheElement object
+     * Gets the val attribute of the ICacheElement<K, V> object
      *
      * @return The val value
      */
-    public Serializable getVal();
+    public V getVal();
 
     /**
-     * Gets the attributes attribute of the ICacheElement object
+     * Gets the attributes attribute of the ICacheElement<K, V> object
      *
      * @return The attributes value
      */
     public IElementAttributes getElementAttributes();
 
     /**
-     * Sets the attributes attribute of the ICacheElement object
+     * Sets the attributes attribute of the ICacheElement<K, V> object
      *
      * @param attr
      *            The new attributes value

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java Wed May 30 18:14:43 2012
@@ -26,15 +26,15 @@ import java.io.Serializable;
  * <p>
  * The value is stored as a byte array. This should allow for a variety of serialization mechanisms.
  * <p>
- * This currently extends ICacheElement for backward compatibility.
+ * This currently extends ICacheElement<K, V> for backward compatibility.
  *<p>
  * @author Aaron Smuts
  */
-public interface ICacheElementSerialized
-    extends ICacheElement
+public interface ICacheElementSerialized<K extends Serializable, V extends Serializable>
+    extends ICacheElement<K, V>
 {
     /**
-     * Gets the cacheName attribute of the ICacheElement object. The cacheName is also known as the
+     * Gets the cacheName attribute of the ICacheElement<K, V> object. The cacheName is also known as the
      * region name.
      *<p>
      * @return The cacheName value
@@ -47,7 +47,7 @@ public interface ICacheElementSerialized
      *<p>
      * @return The key value
      */
-    public Serializable getKey();
+    public K getKey();
 
     /**
      * Gets the value attribute of the ICacheElementSerialized object. This is the value the client
@@ -58,14 +58,14 @@ public interface ICacheElementSerialized
     public byte[] getSerializedValue();
 
     /**
-     * Gets the attributes attribute of the ICacheElement object
+     * Gets the attributes attribute of the ICacheElement<K, V> object
      *<p>
      * @return The attributes value
      */
     public IElementAttributes getElementAttributes();
 
     /**
-     * Sets the attributes attribute of the ICacheElement object
+     * Sets the attributes attribute of the ICacheElement<K, V> object
      *<p>
      * @param attr The new attributes value
      */

Propchange: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java
            ('svn:mergeinfo' removed)

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java Wed May 30 18:14:43 2012
@@ -28,7 +28,7 @@ import org.apache.jcs.engine.stats.behav
  * Interface for a cache event queue. An event queue is used to propagate
  * ordered cache events to one and only one target listener.
  */
-public interface ICacheEventQueue
+public interface ICacheEventQueue<K extends Serializable, V extends Serializable>
 {
     /**
      * Initializes the queue.
@@ -40,9 +40,9 @@ public interface ICacheEventQueue
      * @param waitBeforeRetry
      * @param threadPoolName
      */
-    public void initialize( ICacheListener listener, long listenerId, String cacheName, int maxFailure,
+    public void initialize( ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure,
                             int waitBeforeRetry, String threadPoolName );
-    
+
     /**
      * Does not use a thread pool.
      */
@@ -52,7 +52,7 @@ public interface ICacheEventQueue
      * Uses a thread pool
      */
     public static final String POOLED_QUEUE_TYPE = "POOLED";
-    
+
 
     /**
      * Return the type of event queue we are using, either single or pooled.
@@ -68,7 +68,7 @@ public interface ICacheEventQueue
      *            The feature to be added to the PutEvent attribute
      * @throws IOException
      */
-    public void addPutEvent( ICacheElement ce )
+    public void addPutEvent( ICacheElement<K, V> ce )
         throws IOException;
 
     /**
@@ -79,7 +79,7 @@ public interface ICacheEventQueue
      *            The feature to be added to the RemoveEvent attribute
      * @throws IOException
      */
-    public void addRemoveEvent( Serializable key )
+    public void addRemoveEvent( K key )
         throws IOException;
 
     /**

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheListener.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheListener.java Wed May 30 18:14:43 2012
@@ -28,7 +28,7 @@ import java.io.Serializable;
  * Note: objects which implement this interface are local listeners to cache changes, whereas
  * objects which implement IRmiCacheListener are remote listeners to cache changes.
  */
-public interface ICacheListener
+public interface ICacheListener<K extends Serializable, V extends Serializable>
 {
     /**
      * Notifies the subscribers for a cache entry update.
@@ -36,7 +36,7 @@ public interface ICacheListener
      * @param item
      * @throws IOException
      */
-    public void handlePut( ICacheElement item )
+    public void handlePut( ICacheElement<K, V> item )
         throws IOException;
 
     /**
@@ -46,7 +46,7 @@ public interface ICacheListener
      * @param key
      * @throws IOException
      */
-    public void handleRemove( String cacheName, Serializable key )
+    public void handleRemove( String cacheName, K key )
         throws IOException;
 
     /**

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheManager.java Wed May 30 18:14:43 2012
@@ -1,5 +1,7 @@
 package org.apache.jcs.engine.behavior;
 
+import java.io.Serializable;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,7 +22,7 @@ package org.apache.jcs.engine.behavior;
  */
 
 /**
- * Inteface implemented by a specific cache.
+ * Interface implemented by a specific cache.
  *
  */
 public interface ICacheManager
@@ -28,12 +30,12 @@ public interface ICacheManager
 {
 
     /**
-     * methods to get a cache region from a maanger
+     * methods to get a cache region from a manager
      * @param cacheName
      *
      * @return The cache value
      */
-    public ICache getCache( String cacheName );
+    public <K extends Serializable, V extends Serializable> ICache<K, V> getCache( String cacheName );
 
 }
 // end interface

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=1344374&r1=1344373&r2=1344374&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 Wed May 30 18:14:43 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.engine.behavior;
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 
 /**
  * Used to register interest in receiving cache changes. <br>
@@ -40,7 +41,7 @@ public interface ICacheObserver
      *            object to notify for cache changes.
      * @throws IOException
      */
-    public void addCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( String cacheName, ICacheListener<K, V> obj )
         throws IOException;
 
     //, CacheNotFoundException;
@@ -52,7 +53,7 @@ public interface ICacheObserver
      *            object to notify for all cache changes.
      * @throws IOException
      */
-    public void addCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( ICacheListener<K, V> obj )
         throws IOException;
 
     /**
@@ -63,7 +64,7 @@ public interface ICacheObserver
      *            existing subscriber.
      * @throws IOException
      */
-    public void removeCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( String cacheName, ICacheListener<K, V> obj )
         throws IOException;
 
     /**
@@ -73,6 +74,6 @@ public interface ICacheObserver
      *            existing subscriber.
      * @throws IOException
      */
-    public void removeCacheListener( ICacheListener obj )
+    public <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/ICacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheService.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheService.java Wed May 30 18:14:43 2012
@@ -33,7 +33,7 @@ import org.apache.jcs.access.exception.O
  * Note: server which implements this interface provides a local cache service, whereas server which
  * implements IRmiCacheService provides a remote cache service.
  */
-public interface ICacheService
+public interface ICacheService<K extends Serializable, V extends Serializable>
 {
     /**
      * Puts a cache item to the cache.
@@ -42,7 +42,7 @@ public interface ICacheService
      * @throws ObjectExistsException
      * @throws IOException
      */
-    void update( ICacheElement item )
+    void update( ICacheElement<K, V> item )
         throws ObjectExistsException, IOException;
 
     /**
@@ -50,11 +50,11 @@ public interface ICacheService
      * <p>
      * @param cacheName
      * @param key
-     * @return the ICacheElement or null if not found
+     * @return the ICacheElement<K, V> or null if not found
      * @throws ObjectNotFoundException
      * @throws IOException
      */
-    ICacheElement get( String cacheName, Serializable key )
+    ICacheElement<K, V> get( String cacheName, K key )
         throws ObjectNotFoundException, IOException;
 
     /**
@@ -62,12 +62,12 @@ public interface ICacheService
      * <p>
      * @param cacheName
      * @param keys
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any of these keys
      * @throws ObjectNotFoundException
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
+    Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
         throws ObjectNotFoundException, IOException;
 
     /**
@@ -75,11 +75,11 @@ public interface ICacheService
      * <p>
      * @param cacheName
      * @param pattern
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache matching the pattern.
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
+    Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
         throws IOException;
 
     /**
@@ -89,11 +89,11 @@ public interface ICacheService
      * @param key
      * @throws IOException
      */
-    public void remove( String cacheName, Serializable key )
+    public void remove( String cacheName, K key )
         throws IOException;
 
     /**
-     * Remove all keys from the sepcified cache.
+     * Remove all keys from the specified cache.
      * @param cacheName
      * @throws IOException
      */

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheServiceNonLocal.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheServiceNonLocal.java Wed May 30 18:14:43 2012
@@ -32,8 +32,8 @@ import java.util.Set;
  * <p>
  * TODO consider not extending ICacheService
  */
-public interface ICacheServiceNonLocal
-    extends Remote, ICacheService
+public interface ICacheServiceNonLocal<K extends Serializable, V extends Serializable>
+    extends Remote, ICacheService<K, V>
 {
     /**
      * Puts a cache item to the cache.
@@ -42,7 +42,7 @@ public interface ICacheServiceNonLocal
      * @param requesterId
      * @throws IOException
      */
-    void update( ICacheElement item, long requesterId )
+    void update( ICacheElement<K, V> item, long requesterId )
         throws IOException;
 
     /**
@@ -53,7 +53,7 @@ public interface ICacheServiceNonLocal
      * @param requesterId
      * @throws IOException
      */
-    void remove( String cacheName, Serializable key, long requesterId )
+    void remove( String cacheName, K key, long requesterId )
         throws IOException;
 
     /**
@@ -77,7 +77,7 @@ public interface ICacheServiceNonLocal
      * @return ICacheElement
      * @throws IOException
      */
-    ICacheElement get( String cacheName, Serializable key, long requesterId )
+    ICacheElement<K, V> get( String cacheName, K key, long requesterId )
         throws IOException;
 
     /**
@@ -86,11 +86,11 @@ public interface ICacheServiceNonLocal
      * @param cacheName
      * @param keys
      * @param requesterId
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any of these keys
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
+    Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
         throws IOException;
 
     /**
@@ -99,11 +99,11 @@ public interface ICacheServiceNonLocal
      * @param cacheName
      * @param pattern
      * @param requesterId
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache matching the pattern.
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
+    Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
         throws IOException;
 
     /**
@@ -114,6 +114,6 @@ public interface ICacheServiceNonLocal
      * @return A Set of keys
      * @throws IOException
      */
-    Set<Serializable> getGroupKeys( String cacheName, String groupName )
+    Set<K> getGroupKeys( String cacheName, String groupName )
         throws IOException;
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICompositeCacheManager.java Wed May 30 18:14:43 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.engine.behavior;
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.Properties;
 
 import org.apache.jcs.engine.control.CompositeCache;
@@ -36,15 +37,15 @@ public interface ICompositeCacheManager
      * @param cacheName
      * @return CompositeCache
      */
-    CompositeCache getCache( String cacheName );
-    
+    <K extends Serializable, V extends Serializable> CompositeCache<K, V>  getCache( String cacheName );
+
     /**
      * This is exposed so other manager can get access to the props.
      * <p>
      * @return the configurationProperties
      */
     Properties getConfigurationProperties();
-    
+
     /**
      * Gets stats for debugging.
      * <p>

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementSerializer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementSerializer.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementSerializer.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementSerializer.java Wed May 30 18:14:43 2012
@@ -36,7 +36,7 @@ public interface IElementSerializer
      * @return byte[]
      * @throws IOException
      */
-    public abstract byte[] serialize( Serializable obj )
+    <T extends Serializable> byte[] serialize( T obj )
         throws IOException;
 
     /**
@@ -46,6 +46,6 @@ public interface IElementSerializer
      * @throws IOException
      * @throws ClassNotFoundException thrown if we don't know the object.
      */
-    public abstract Object deSerialize( byte[] bytes )
+    <T extends Serializable> T deSerialize( byte[] bytes )
         throws IOException, ClassNotFoundException;
 }



Mime
View raw message