commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1344374 [4/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/auxiliary/disk/jdbc/JDBCDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java Wed May 30 18:14:43 2012
@@ -22,11 +22,11 @@ package org.apache.jcs.auxiliary.disk.jd
 import java.io.IOException;
 import java.io.Serializable;
 import java.sql.Connection;
-import java.sql.Timestamp;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -79,8 +79,8 @@ import org.apache.jcs.utils.serializatio
  * <p>
  * @author Aaron Smuts
  */
-public class JDBCDiskCache
-    extends AbstractDiskCache
+public class JDBCDiskCache<K extends Serializable, V extends Serializable>
+    extends AbstractDiskCache<K, V>
 {
     /** The local logger. */
     private final static Log log = LogFactory.getLog( JDBCDiskCache.class );
@@ -182,7 +182,7 @@ public class JDBCDiskCache
      * @param ce
      */
     @Override
-    protected void processUpdate( ICacheElement ce )
+    protected void processUpdate( ICacheElement<K, V> ce )
     {
         incrementUpdateCount();
 
@@ -290,7 +290,7 @@ public class JDBCDiskCache
      * @param con
      * @param element
      */
-    private void insertOrUpdate( ICacheElement ce, Connection con, byte[] element )
+    private void insertOrUpdate( ICacheElement<K, V> ce, Connection con, byte[] element )
     {
         boolean exists = false;
 
@@ -321,7 +321,7 @@ public class JDBCDiskCache
      * @param element
      * @return true if the insertion fails because the record exists.
      */
-    private boolean insertRow( ICacheElement ce, Connection con, byte[] element )
+    private boolean insertRow( ICacheElement<K, V> ce, Connection con, byte[] element )
     {
         boolean exists = false;
         try
@@ -386,7 +386,7 @@ public class JDBCDiskCache
      * @param con
      * @param element
      */
-    private void updateRow( ICacheElement ce, Connection con, byte[] element )
+    private void updateRow( ICacheElement<K, V> ce, Connection con, byte[] element )
     {
         String sqlU = null;
         try
@@ -428,7 +428,7 @@ public class JDBCDiskCache
      * @param ce
      * @return boolean
      */
-    protected boolean doesElementExist( ICacheElement ce )
+    protected boolean doesElementExist( ICacheElement<K, V> ce )
     {
         boolean exists = false;
 
@@ -507,7 +507,7 @@ public class JDBCDiskCache
      * @see org.apache.jcs.auxiliary.disk.AbstractDiskCache#doGet(java.io.Serializable)
      */
     @Override
-    protected ICacheElement processGet( Serializable key )
+    protected ICacheElement<K, V> processGet( K key )
     {
         incrementGetCount();
 
@@ -521,7 +521,7 @@ public class JDBCDiskCache
             return null;
         }
 
-        ICacheElement obj = null;
+        ICacheElement<K, V> obj = null;
 
         byte[] data = null;
         try
@@ -552,7 +552,7 @@ public class JDBCDiskCache
                             try
                             {
                                 // USE THE SERIALIZER
-                                obj = (ICacheElement) getElementSerializer().deSerialize( data );
+                                obj = getElementSerializer().deSerialize( data );
                             }
                             catch ( IOException ioe )
                             {
@@ -612,7 +612,7 @@ public class JDBCDiskCache
      * @return key,value map
      */
     @Override
-    protected Map<Serializable, ICacheElement> processGetMatching( String pattern )
+    protected Map<K, ICacheElement<K, V>> processGetMatching( String pattern )
     {
         incrementGetMatchingCount();
 
@@ -626,7 +626,7 @@ public class JDBCDiskCache
             return null;
         }
 
-        Map<Serializable, ICacheElement> results = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> results = new HashMap<K, ICacheElement<K, V>>();
 
         try
         {
@@ -656,8 +656,8 @@ public class JDBCDiskCache
                                 try
                                 {
                                     // USE THE SERIALIZER
-                                    ICacheElement value = (ICacheElement) getElementSerializer().deSerialize( data );
-                                    results.put( key, value );
+                                    ICacheElement<K, V> value = getElementSerializer().deSerialize( data );
+                                    results.put( (K) key, value );
                                 }
                                 catch ( IOException ioe )
                                 {
@@ -735,7 +735,7 @@ public class JDBCDiskCache
      * @return boolean
      */
     @Override
-    protected boolean processRemove( Serializable key )
+    protected boolean processRemove( K key )
     {
         // remove single item.
         String sql = "delete from " + getJdbcDiskCacheAttributes().getTableName()
@@ -944,7 +944,7 @@ public class JDBCDiskCache
     @Override
     public void processDispose()
     {
-        ICacheEvent cacheEvent = createICacheEvent( cacheName, "none", ICacheEventLogger.DISPOSE_EVENT );
+        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, (K)"none", ICacheEventLogger.DISPOSE_EVENT );
         try
         {
             try
@@ -1044,7 +1044,7 @@ public class JDBCDiskCache
      * @return byte[]
      * @throws IOException
      */
-    protected byte[] serialize( Serializable obj )
+    protected byte[] serialize( ICacheElement<K, V> obj )
         throws IOException
     {
         return getElementSerializer().serialize( obj );
@@ -1055,7 +1055,7 @@ public class JDBCDiskCache
      * @return Set
      */
     @Override
-    public Set<Serializable> getGroupKeys( String groupName )
+    public Set<K> getGroupKeys( String groupName )
     {
         throw new UnsupportedOperationException( "Groups not implemented." );
         // return null;

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java Wed May 30 18:14:43 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.disk.jd
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.AuxiliaryCacheFactory;
@@ -46,7 +48,7 @@ public class JDBCDiskCacheFactory
      * @param elementSerializer
      * @return AuxiliaryCache
      */
-    public AuxiliaryCache createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager compositeCacheManager,
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager compositeCacheManager,
                                        ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
         JDBCDiskCacheManager diskCacheManager = JDBCDiskCacheManager.getInstance( (JDBCDiskCacheAttributes) rawAttr,

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java Wed May 30 18:14:43 2012
@@ -19,9 +19,10 @@ package org.apache.jcs.auxiliary.disk.jd
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 import org.apache.jcs.engine.behavior.IElementSerializer;
 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
@@ -43,8 +44,8 @@ public class JDBCDiskCacheManager
     private static JDBCDiskCacheManager instance;
 
     /** User configurable settings. */
-    private JDBCDiskCacheAttributes defaultJDBCDiskCacheAttributes;
-    
+    private final JDBCDiskCacheAttributes defaultJDBCDiskCacheAttributes;
+
     /** The cache manager instance */
     private ICompositeCacheManager compositeCacheManager;
 
@@ -52,12 +53,12 @@ public class JDBCDiskCacheManager
      * Constructor for the HSQLCacheManager object
      * <p>
      * @param cattr
-     * @param compositeCacheManager 
+     * @param compositeCacheManager
      * @param cacheEventLogger
      * @param elementSerializer
      */
     private JDBCDiskCacheManager( JDBCDiskCacheAttributes cattr, ICompositeCacheManager compositeCacheManager, ICacheEventLogger cacheEventLogger,
-                                  IElementSerializer elementSerializer )
+          IElementSerializer elementSerializer )
     {
         if ( log.isInfoEnabled() )
         {
@@ -83,13 +84,13 @@ public class JDBCDiskCacheManager
      * Gets the instance attribute of the HSQLCacheManager class
      * <p>
      * @param cattr
-     * @param compositeCacheManager 
+     * @param compositeCacheManager
      * @param cacheEventLogger
      * @param elementSerializer
      * @return The instance value
      */
     public static JDBCDiskCacheManager getInstance( JDBCDiskCacheAttributes cattr, ICompositeCacheManager compositeCacheManager, ICacheEventLogger cacheEventLogger,
-                                                    IElementSerializer elementSerializer )
+        IElementSerializer elementSerializer )
     {
         synchronized ( JDBCDiskCacheManager.class )
         {
@@ -108,7 +109,7 @@ public class JDBCDiskCacheManager
      * @param cacheName
      * @return The cache value
      */
-    public AuxiliaryCache getCache( String cacheName )
+    public <K extends Serializable, V extends Serializable> JDBCDiskCache<K, V> getCache( String cacheName )
     {
         JDBCDiskCacheAttributes cattr = (JDBCDiskCacheAttributes) defaultJDBCDiskCacheAttributes.copy();
         cattr.setCacheName( cacheName );
@@ -122,10 +123,10 @@ public class JDBCDiskCacheManager
      * @param tableState
      * @return AuxiliaryCache
      */
-    protected AuxiliaryCache createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState )
+    protected <K extends Serializable, V extends Serializable> JDBCDiskCache<K, V> createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState )
     {
-        AuxiliaryCache raf;
-        raf = new JDBCDiskCache( cattr, tableState, getCompositeCacheManager() );
+        JDBCDiskCache<K, V> raf;
+        raf = new JDBCDiskCache<K, V>( cattr, tableState, getCompositeCacheManager() );
         return raf;
     }
 

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java Wed May 30 18:14:43 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.disk.jd
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Map;
@@ -52,7 +53,8 @@ public abstract class JDBCDiskCacheManag
     protected static int clients;
 
     /** A map of JDBCDiskCache objects to region names. */
-    protected static Hashtable<String, AuxiliaryCache> caches = new Hashtable<String, AuxiliaryCache>();
+    protected static Hashtable<String, JDBCDiskCache<? extends Serializable, ? extends Serializable>> caches =
+        new Hashtable<String, JDBCDiskCache<? extends Serializable, ? extends Serializable>>();
 
     /**
      * A map of TableState objects to table names. Each cache has a table state object, which is
@@ -76,7 +78,7 @@ public abstract class JDBCDiskCacheManag
      * @param tableState An object used by multiple processes to indicate state.
      * @return AuxiliaryCache -- a JDBCDiskCache
      */
-    protected abstract AuxiliaryCache createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState );
+    protected abstract <K extends Serializable, V extends Serializable> JDBCDiskCache<K, V> createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState );
 
     /**
      * Creates a JDBCDiskCache for the region if one doesn't exist, else it returns the pre-created
@@ -85,15 +87,15 @@ public abstract class JDBCDiskCacheManag
      * @param cattr
      * @return The cache value
      */
-    public AuxiliaryCache getCache( JDBCDiskCacheAttributes cattr )
+    public <K extends Serializable, V extends Serializable> JDBCDiskCache<K, V> getCache( JDBCDiskCacheAttributes cattr )
     {
-        AuxiliaryCache diskCache = null;
+        JDBCDiskCache<K, V> diskCache = null;
 
         log.debug( "cacheName = " + cattr.getCacheName() );
 
         synchronized ( caches )
         {
-            diskCache = caches.get( cattr.getCacheName() );
+            diskCache = (JDBCDiskCache<K, V>) caches.get( cattr.getCacheName() );
 
             if ( diskCache == null )
             {
@@ -128,7 +130,7 @@ public abstract class JDBCDiskCacheManag
      * @param cattr
      * @param raf
      */
-    protected void createShrinkerWhenNeeded( JDBCDiskCacheAttributes cattr, AuxiliaryCache raf )
+    protected void createShrinkerWhenNeeded( JDBCDiskCacheAttributes cattr, AuxiliaryCache<?, ?> raf )
     {
         // add cache to shrinker.
         if ( cattr.isUseDiskShrinker() )
@@ -152,7 +154,7 @@ public abstract class JDBCDiskCacheManag
                 }
                 shrinkerDaemon.scheduleAtFixedRate(shrinkerThread, 0, intervalMillis, TimeUnit.MILLISECONDS);
             }
-            shrinkerThread.addDiskCacheToShrinkList( (JDBCDiskCache) raf );
+            shrinkerThread.addDiskCacheToShrinkList( (JDBCDiskCache<?, ?>) raf );
         }
     }
 
@@ -161,7 +163,7 @@ public abstract class JDBCDiskCacheManag
      */
     public void freeCache( String name )
     {
-        JDBCDiskCache raf = (JDBCDiskCache) caches.get( name );
+        JDBCDiskCache<?, ?> raf = caches.get( name );
         if ( raf != null )
         {
             try
@@ -195,11 +197,11 @@ public abstract class JDBCDiskCacheManag
         }
         synchronized ( caches )
         {
-            Enumeration<AuxiliaryCache> allCaches = caches.elements();
+            Enumeration<JDBCDiskCache<?, ?>> allCaches = caches.elements();
 
             while ( allCaches.hasMoreElements() )
             {
-                JDBCDiskCache raf = (JDBCDiskCache) allCaches.nextElement();
+                JDBCDiskCache<?, ?> raf = allCaches.nextElement();
                 if ( raf != null )
                 {
                     try

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=1344374&r1=1344373&r2=1344374&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 Wed May 30 18:14:43 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.auxiliary.disk.jd
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -39,7 +40,8 @@ public class ShrinkerThread
     private final static Log log = LogFactory.getLog( ShrinkerThread.class );
 
     /** A set of JDBCDiskCache objects to call deleteExpired on. */
-    private final Set<JDBCDiskCache> shrinkSet = Collections.synchronizedSet( new HashSet<JDBCDiskCache>() );
+    private final Set<JDBCDiskCache<? extends Serializable, ? extends Serializable>> shrinkSet =
+        Collections.synchronizedSet( new HashSet<JDBCDiskCache<? extends Serializable, ? extends Serializable>>() );
 
     /** Default time period to use. */
     private static final long DEFAULT_PAUSE_BETWEEN_REGION_CALLS_MILLIS = 5000;
@@ -64,7 +66,7 @@ public class ShrinkerThread
      * <p>
      * @param diskCache
      */
-    public void addDiskCacheToShrinkList( JDBCDiskCache diskCache )
+    public void addDiskCacheToShrinkList( JDBCDiskCache<? extends Serializable, ? extends Serializable> diskCache )
     {
         // the set will prevent dupes.
         // we could also just add these to a hashmap by region name
@@ -109,7 +111,7 @@ public class ShrinkerThread
         {
             for ( int i = 0; i < caches.length; i++ )
             {
-                JDBCDiskCache cache = (JDBCDiskCache) caches[i];
+                JDBCDiskCache<?, ?> cache = (JDBCDiskCache<?, ?>) caches[i];
 
                 long start = System.currentTimeMillis();
                 int deleted = cache.deleteExpired();

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java Wed May 30 18:14:43 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.auxiliary.disk.jd
  * under the License.
  */
 
+import java.io.Serializable;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
@@ -65,7 +66,7 @@ public class HSQLDiskCacheFactory
      * @param elementSerializer
      * @return AuxiliaryCache
      */
-    public AuxiliaryCache createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager arg1,
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager arg1,
                                        ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
         JDBCDiskCacheManager mgr = JDBCDiskCacheManager.getInstance( (JDBCDiskCacheAttributes) rawAttr,

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.java Wed May 30 18:14:43 2012
@@ -37,8 +37,8 @@ import org.apache.jcs.engine.behavior.IC
  * <p>
  * @author Aaron Smuts
  */
-public class MySQLDiskCache
-    extends JDBCDiskCache
+public class MySQLDiskCache<K extends Serializable, V extends Serializable>
+    extends JDBCDiskCache<K, V>
 {
     /** don't change */
     private static final long serialVersionUID = -7169488308515823491L;
@@ -77,7 +77,7 @@ public class MySQLDiskCache
      * @return An object matching key, or null.
      */
     @Override
-    protected ICacheElement processGet( Serializable key )
+    protected ICacheElement<K, V> processGet( K key )
     {
         if ( this.getTableState().getState() == TableState.OPTIMIZATION_RUNNING )
         {
@@ -97,7 +97,7 @@ public class MySQLDiskCache
      * @return An object matching key, or null.
      */
     @Override
-    protected Map<Serializable, ICacheElement> processGetMatching( String pattern )
+    protected Map<K, ICacheElement<K, V>> processGetMatching( String pattern )
     {
         if ( this.getTableState().getState() == TableState.OPTIMIZATION_RUNNING )
         {
@@ -134,7 +134,7 @@ public class MySQLDiskCache
      * @param element
      */
     @Override
-    protected void processUpdate( ICacheElement element )
+    protected void processUpdate( ICacheElement<K, V> element )
     {
         if ( this.getTableState().getState() == TableState.OPTIMIZATION_RUNNING )
         {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java Wed May 30 18:14:43 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.disk.jd
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.AuxiliaryCacheFactory;
@@ -40,13 +42,13 @@ public class MySQLDiskCacheFactory
     /**
      * This factory method should create an instance of the mysqlcache.
      * <p>
-     * @param rawAttr 
-     * @param cacheManager 
-     * @param cacheEventLogger 
-     * @param elementSerializer 
+     * @param rawAttr
+     * @param cacheManager
+     * @param cacheEventLogger
+     * @param elementSerializer
      * @return AuxiliaryCache
      */
-    public AuxiliaryCache createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager cacheManager,
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager cacheManager,
                                        ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
         MySQLDiskCacheManager mgr = MySQLDiskCacheManager.getInstance( (MySQLDiskCacheAttributes) rawAttr, cacheManager, cacheEventLogger, elementSerializer );
@@ -56,7 +58,7 @@ public class MySQLDiskCacheFactory
     /**
      * The name of the factory.
      * <p>
-     * @param nameArg 
+     * @param nameArg
      */
     public void setName( String nameArg )
     {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java Wed May 30 18:14:43 2012
@@ -19,13 +19,14 @@ package org.apache.jcs.auxiliary.disk.jd
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.Date;
 import java.util.Timer;
 import java.util.TimerTask;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCache;
 import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
 import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheManagerAbstractTemplate;
 import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCachePoolAccess;
@@ -128,7 +129,7 @@ public class MySQLDiskCacheManager
      * @param cacheName
      * @return The cache value
      */
-    public AuxiliaryCache getCache( String cacheName )
+    public <K extends Serializable, V extends Serializable> JDBCDiskCache<K, V> getCache( String cacheName )
     {
         MySQLDiskCacheAttributes cattr = (MySQLDiskCacheAttributes) defaultJDBCDiskCacheAttributes.copy();
         cattr.setCacheName( cacheName );
@@ -143,9 +144,9 @@ public class MySQLDiskCacheManager
      * @return AuxiliaryCache
      */
     @Override
-    protected AuxiliaryCache createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState )
+    protected <K extends Serializable, V extends Serializable> MySQLDiskCache<K, V> createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState )
     {
-        MySQLDiskCache diskCache = new MySQLDiskCache( (MySQLDiskCacheAttributes) cattr, tableState, getCompositeCacheManager() );
+        MySQLDiskCache<K, V> diskCache = new MySQLDiskCache<K, V>( (MySQLDiskCacheAttributes) cattr, tableState, getCompositeCacheManager() );
 
         scheduleOptimizations( (MySQLDiskCacheAttributes) cattr, tableState, diskCache.getPoolAccess() );
 

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java Wed May 30 18:14:43 2012
@@ -42,8 +42,8 @@ import org.apache.jcs.engine.stats.behav
 /**
  * Lateral distributor. Returns null on get by default. Net search not implemented.
  */
-public class LateralCache
-    extends AbstractAuxiliaryCacheEventLogging
+public class LateralCache<K extends Serializable, V extends Serializable>
+    extends AbstractAuxiliaryCacheEventLogging<K, V>
 {
     /** Don't change. */
     private static final long serialVersionUID = 6274549256562382782L;
@@ -58,7 +58,7 @@ public class LateralCache
     final String cacheName;
 
     /** either http, socket.udp, or socket.tcp can set in config */
-    private ILateralCacheService lateralCacheService;
+    private ILateralCacheService<K, V> lateralCacheService;
 
     /** Monitors the connection. */
     private LateralCacheMonitor monitor;
@@ -70,7 +70,7 @@ public class LateralCache
      * @param lateral
      * @param monitor
      */
-    public LateralCache( ILateralCacheAttributes cattr, ILateralCacheService lateral, LateralCacheMonitor monitor )
+    public LateralCache( ILateralCacheAttributes cattr, ILateralCacheService<K, V> lateral, LateralCacheMonitor monitor )
     {
         this.cacheName = cattr.getCacheName();
         this.lateralCacheAttribures = cattr;
@@ -96,7 +96,7 @@ public class LateralCache
      * @throws IOException
      */
     @Override
-    protected void processUpdate( ICacheElement ce )
+    protected void processUpdate( ICacheElement<K, V> ce )
         throws IOException
     {
         try
@@ -124,14 +124,14 @@ public class LateralCache
      * The performance costs are too great. It is not recommended that you enable lateral gets.
      * <p>
      * @param key
-     * @return ICacheElement or null
+     * @return ICacheElement<K, V> or null
      * @throws IOException
      */
     @Override
-    protected ICacheElement processGet( Serializable key )
+    protected ICacheElement<K, V> processGet( K key )
         throws IOException
     {
-        ICacheElement obj = null;
+        ICacheElement<K, V> obj = null;
 
         if ( this.lateralCacheAttribures.getPutOnlyMode() )
         {
@@ -151,17 +151,17 @@ public class LateralCache
 
     /**
      * @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 for any of these keys
      * @throws IOException
      */
     @Override
-    protected Map<Serializable, ICacheElement> processGetMatching( String pattern )
+    protected Map<K, ICacheElement<K, V>> processGetMatching( String pattern )
         throws IOException
     {
         if ( this.lateralCacheAttribures.getPutOnlyMode() )
         {
-            return Collections.<Serializable, ICacheElement>emptyMap();
+            return Collections.emptyMap();
         }
         try
         {
@@ -171,7 +171,7 @@ public class LateralCache
         {
             log.error( e );
             handleException( e, "Failed to getMatching [" + pattern + "] from " + lateralCacheAttribures.getCacheName() + "@" + lateralCacheAttribures );
-            return Collections.<Serializable, ICacheElement>emptyMap();
+            return Collections.emptyMap();
         }
     }
 
@@ -179,21 +179,21 @@ public class LateralCache
      * 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
+     * @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
      */
     @Override
-    protected Map<Serializable, ICacheElement> processGetMultiple( Set<Serializable> keys )
+    protected Map<K, ICacheElement<K, V>> processGetMultiple( Set<K> keys )
         throws IOException
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
 
         if ( keys != null && !keys.isEmpty() )
         {
-            for (Serializable key : keys)
+            for (K key : keys)
             {
-                ICacheElement element = get( key );
+                ICacheElement<K, V> element = get( key );
 
                 if ( element != null )
                 {
@@ -210,7 +210,7 @@ public class LateralCache
      * @return A set of group keys.
      * @throws IOException
      */
-    public Set<Serializable> getGroupKeys( String groupName )
+    public Set<K> getGroupKeys( String groupName )
         throws IOException
     {
         try
@@ -234,7 +234,7 @@ public class LateralCache
      * @throws IOException
      */
     @Override
-    protected boolean processRemove( Serializable key )
+    protected boolean processRemove( K key )
         throws IOException
     {
         if ( log.isDebugEnabled() )
@@ -352,13 +352,13 @@ public class LateralCache
     {
         log.error( "Disabling lateral cache due to error " + msg, ex );
 
-        lateralCacheService = new ZombieLateralCacheService( lateralCacheAttribures.getZombieQueueMaxSize() );
+        lateralCacheService = new ZombieLateralCacheService<K, V>( lateralCacheAttribures.getZombieQueueMaxSize() );
         // may want to flush if region specifies
         // Notify the cache monitor about the error, and kick off the recovery
         // process.
         monitor.notifyError();
 
-        // could stop the net serach if it is built and try to reconnect?
+        // could stop the net search if it is built and try to reconnect?
         if ( ex instanceof IOException )
         {
             throw (IOException) ex;
@@ -371,11 +371,11 @@ public class LateralCache
      * <p>
      * @param restoredLateral
      */
-    public void fixCache( ILateralCacheService restoredLateral )
+    public void fixCache( ILateralCacheService<K, V> restoredLateral )
     {
         if ( this.lateralCacheService != null && this.lateralCacheService instanceof ZombieLateralCacheService )
         {
-            ZombieLateralCacheService zombie = (ZombieLateralCacheService) this.lateralCacheService;
+            ZombieLateralCacheService<K, V> zombie = (ZombieLateralCacheService<K, V>) this.lateralCacheService;
             this.lateralCacheService = restoredLateral;
             try
             {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java Wed May 30 18:14:43 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.lateral
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.AuxiliaryCacheFactory;
@@ -52,12 +54,13 @@ public abstract class LateralCacheAbstra
      * <p>
      * @param attr
      * @param cacheMgr
-     * @param cacheEventLogger 
-     * @param elementSerializer 
+     * @param cacheEventLogger
+     * @param elementSerializer
      * @return AuxiliaryCache
      */
-    public abstract AuxiliaryCache createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr,
-                                                ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer );
+    public abstract <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> createCache(
+            AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr,
+            ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer );
 
     /**
      * Makes sure a listener gets created. It will get monitored as soon as it

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java Wed May 30 18:14:43 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.lateral
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -58,18 +59,13 @@ public abstract class LateralCacheAbstra
     private final static Log log = LogFactory.getLog( LateralCacheAbstractManager.class );
 
     /** Each manager instance has caches.   */
-    protected final Map<String, LateralCacheNoWait> caches = new HashMap<String, LateralCacheNoWait>();
+    protected final Map<String, LateralCacheNoWait<? extends Serializable, ? extends Serializable>> caches =
+        new HashMap<String, LateralCacheNoWait<? extends Serializable, ? extends Serializable>>();
 
     /** Configuration */
     protected ILateralCacheAttributes lca;
 
     /**
-     * Handle to the lateral cache service; or a zombie handle if failed to
-     * connect.
-     */
-    private ILateralCacheService lateralService;
-
-    /**
      * Wrapper of the lateral cache watch service; or wrapper of a zombie
      * service if failed to connect.
      */
@@ -90,7 +86,7 @@ public abstract class LateralCacheAbstra
      *            The feature to be added to the LateralCacheListener attribute
      * @exception IOException
      */
-    public void addLateralCacheListener( String cacheName, ILateralCacheListener listener )
+    public <K extends Serializable, V extends Serializable> void addLateralCacheListener( String cacheName, ILateralCacheListener<K, V> listener )
         throws IOException
     {
         synchronized ( this.caches )
@@ -100,7 +96,7 @@ public abstract class LateralCacheAbstra
     }
 
     /**
-     * Called to access a precreated region or construct one with defaults.
+     * Called to access a pre-created region or construct one with defaults.
      * Since all aux cache access goes through the manager, this will never be
      * called.
      * <p>
@@ -113,7 +109,7 @@ public abstract class LateralCacheAbstra
      * @return AuxiliaryCache
      * @param cacheName
      */
-    public abstract AuxiliaryCache getCache( String cacheName );
+    public abstract <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( String cacheName );
 
     /**
      * Gets the cacheType attribute of the LateralCacheManager object
@@ -148,13 +144,12 @@ public abstract class LateralCacheAbstra
 
         synchronized ( this.caches )
         {
-            this.lateralService = lateralService;
             // need to implement an observer for some types of laterals( http and
             // tcp)
             //this.lateralWatch.setCacheWatch(lateralWatch);
-            for (LateralCacheNoWait cache : this.caches.values())
+            for (LateralCacheNoWait<? extends Serializable, ? extends Serializable> cache : this.caches.values())
             {
-                cache.fixCache( this.lateralService );
+                cache.fixCache( lateralService );
             }
         }
     }
@@ -163,7 +158,7 @@ public abstract class LateralCacheAbstra
      * @return Map
      *
      */
-    public Map<String, LateralCacheNoWait> getCaches()
+    public Map<String, LateralCacheNoWait<? extends Serializable, ? extends Serializable>> getCaches()
     {
         return caches;
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java Wed May 30 18:14:43 2012
@@ -49,8 +49,8 @@ import org.apache.jcs.engine.stats.behav
  * Used to queue up update requests to the underlying cache. These requests will be processed in
  * their order of arrival via the cache event queue processor.
  */
-public class LateralCacheNoWait
-    extends AbstractAuxiliaryCache
+public class LateralCacheNoWait<K extends Serializable, V extends Serializable>
+    extends AbstractAuxiliaryCache<K, V>
 {
     /** Don't change */
     private static final long serialVersionUID = -7251187566116178475L;
@@ -59,10 +59,10 @@ public class LateralCacheNoWait
     private final static Log log = LogFactory.getLog( LateralCacheNoWait.class );
 
     /** The cache */
-    private final LateralCache cache;
+    private final LateralCache<K, V> cache;
 
     /** The event queue */
-    private ICacheEventQueue eventQueue;
+    private ICacheEventQueue<K, V> eventQueue;
 
     /** times get called */
     private int getCount = 0;
@@ -79,7 +79,7 @@ public class LateralCacheNoWait
      * <p>
      * @param cache
      */
-    public LateralCacheNoWait( LateralCache cache )
+    public LateralCacheNoWait( LateralCache<K, V> cache )
     {
         this.cache = cache;
 
@@ -88,15 +88,15 @@ public class LateralCacheNoWait
             log.debug( "Constructing LateralCacheNoWait, LateralCache = [" + cache + "]" );
         }
 
-        CacheEventQueueFactory fact = new CacheEventQueueFactory();
-        this.eventQueue = fact.createCacheEventQueue( new CacheAdaptor( cache ), LateralCacheInfo.listenerId, cache
+        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<K, V>();
+        this.eventQueue = fact.createCacheEventQueue( new CacheAdaptor<K, V>( cache ), LateralCacheInfo.listenerId, cache
             .getCacheName(), cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(), cache
             .getAuxiliaryCacheAttributes().getEventQueueType() );
 
         // need each no wait to handle each of its real updates and removes,
         // since there may
         // be more than one per cache? alternative is to have the cache
-        // perform updates using a different method that spcifies the listener
+        // perform updates using a different method that specifies the listener
         // this.q = new CacheEventQueue(new CacheAdaptor(this),
         // LateralCacheInfo.listenerId, cache.getCacheName());
         if ( cache.getStatus() == CacheConstants.STATUS_ERROR )
@@ -109,7 +109,7 @@ public class LateralCacheNoWait
      * @param ce
      * @throws IOException
      */
-    public void update( ICacheElement ce )
+    public void update( ICacheElement<K, V> ce )
         throws IOException
     {
         putCount++;
@@ -128,9 +128,9 @@ public class LateralCacheNoWait
      * Synchronously reads from the lateral cache.
      * <p>
      * @param key
-     * @return ICacheElement if found, else null
+     * @return ICacheElement<K, V> if found, else null
      */
-    public ICacheElement get( Serializable key )
+    public ICacheElement<K, V> get( K key )
     {
         getCount++;
         if ( this.getStatus() != CacheConstants.STATUS_ERROR )
@@ -164,18 +164,18 @@ public class LateralCacheNoWait
      * 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
+     * @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
      */
-    public Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
+    public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
 
         if ( keys != null && !keys.isEmpty() )
         {
-            for (Serializable key : keys)
+            for (K key : keys)
             {
-                ICacheElement element = get( key );
+                ICacheElement<K, V> element = get( key );
 
                 if ( element != null )
                 {
@@ -191,9 +191,9 @@ public class LateralCacheNoWait
      * Synchronously reads from the lateral cache.
      * <p>
      * @param pattern
-     * @return ICacheElement if found, else empty
+     * @return ICacheElement<K, V> if found, else empty
      */
-    public Map<Serializable, ICacheElement> getMatching(String pattern)
+    public Map<K, ICacheElement<K, V>> getMatching(String pattern)
     {
         getCount++;
         if ( this.getStatus() != CacheConstants.STATUS_ERROR )
@@ -227,7 +227,7 @@ public class LateralCacheNoWait
      * @param groupName
      * @return Set
      */
-    public Set<Serializable> getGroupKeys(String groupName)
+    public Set<K> getGroupKeys(String groupName)
     {
         try
         {
@@ -247,7 +247,7 @@ public class LateralCacheNoWait
      * @param key
      * @return always false
      */
-    public boolean remove( Serializable key )
+    public boolean remove( K key )
     {
         removeCount++;
         try
@@ -337,7 +337,7 @@ public class LateralCacheNoWait
      * <p>
      * @param lateral
      */
-    public void fixCache( ILateralCacheService lateral )
+    public void fixCache( ILateralCacheService<K, V> lateral )
     {
         cache.fixCache( lateral );
         resetEventQ();
@@ -352,8 +352,8 @@ public class LateralCacheNoWait
         {
             eventQueue.destroy();
         }
-        CacheEventQueueFactory fact = new CacheEventQueueFactory();
-        this.eventQueue = fact.createCacheEventQueue( new CacheAdaptor( cache ), LateralCacheInfo.listenerId, cache
+        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<K, V>();
+        this.eventQueue = fact.createCacheEventQueue( new CacheAdaptor<K, V>( cache ), LateralCacheInfo.listenerId, cache
             .getCacheName(), cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(), cache
             .getAuxiliaryCacheAttributes().getEventQueueType() );
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java Wed May 30 18:14:43 2012
@@ -48,8 +48,8 @@ import org.apache.jcs.engine.stats.behav
  * from the varies manager to lateral services. Perhaps the lateralcache factory should be able to
  * do this.
  */
-public class LateralCacheNoWaitFacade
-    extends AbstractAuxiliaryCache
+public class LateralCacheNoWaitFacade<K extends Serializable, V extends Serializable>
+    extends AbstractAuxiliaryCache<K, V>
 {
     /** Don't change */
     private static final long serialVersionUID = -9047687810358008955L;
@@ -58,7 +58,7 @@ public class LateralCacheNoWaitFacade
     private final static Log log = LogFactory.getLog( LateralCacheNoWaitFacade.class );
 
     /** The queuing facade to the client. */
-    public LateralCacheNoWait[] noWaits;
+    public LateralCacheNoWait<K, V>[] noWaits;
 
     /** The region name */
     private final String cacheName;
@@ -72,7 +72,7 @@ public class LateralCacheNoWaitFacade
      * @param noWaits
      * @param cattr
      */
-    public LateralCacheNoWaitFacade( LateralCacheNoWait[] noWaits, ILateralCacheAttributes cattr )
+    public LateralCacheNoWaitFacade( LateralCacheNoWait<K, V>[] noWaits, ILateralCacheAttributes cattr )
     {
         if ( log.isDebugEnabled() )
         {
@@ -89,7 +89,7 @@ public class LateralCacheNoWaitFacade
      * @param noWait
      * @return true if the noWait is in the list.
      */
-    public boolean containsNoWait( LateralCacheNoWait noWait )
+    public boolean containsNoWait( LateralCacheNoWait<K, V> noWait )
     {
         for ( int i = 0; i < noWaits.length; i++ )
         {
@@ -108,7 +108,7 @@ public class LateralCacheNoWaitFacade
      * @param noWait
      * @return true if it wasn't already contained
      */
-    public synchronized boolean addNoWait( LateralCacheNoWait noWait )
+    public synchronized boolean addNoWait( LateralCacheNoWait<K, V> noWait )
     {
         if ( noWait == null )
         {
@@ -124,7 +124,7 @@ public class LateralCacheNoWaitFacade
             return false;
         }
 
-        LateralCacheNoWait[] newArray = new LateralCacheNoWait[noWaits.length + 1];
+        LateralCacheNoWait<K, V>[] newArray = new LateralCacheNoWait[noWaits.length + 1];
 
         System.arraycopy( noWaits, 0, newArray, 0, noWaits.length );
 
@@ -142,7 +142,7 @@ public class LateralCacheNoWaitFacade
      * @param noWait
      * @return true if it was already in the array
      */
-    public synchronized boolean removeNoWait( LateralCacheNoWait noWait )
+    public synchronized boolean removeNoWait( LateralCacheNoWait<K, V> noWait )
     {
         if ( noWait == null )
         {
@@ -165,7 +165,7 @@ public class LateralCacheNoWaitFacade
             return false;
         }
 
-        LateralCacheNoWait[] newArray = new LateralCacheNoWait[noWaits.length - 1];
+        LateralCacheNoWait<K, V>[] newArray = new LateralCacheNoWait[noWaits.length - 1];
 
         System.arraycopy( noWaits, 0, newArray, 0, position );
         if ( noWaits.length != position )
@@ -181,7 +181,7 @@ public class LateralCacheNoWaitFacade
      * @param ce
      * @throws IOException
      */
-    public void update( ICacheElement ce )
+    public void update( ICacheElement<K, V> ce )
         throws IOException
     {
         if ( log.isDebugEnabled() )
@@ -207,20 +207,20 @@ public class LateralCacheNoWaitFacade
      * @param key
      * @return ICacheElement
      */
-    public ICacheElement get( Serializable key )
+    public ICacheElement<K, V> get( K key )
     {
         for ( int i = 0; i < noWaits.length; i++ )
         {
             try
             {
-                Object obj = noWaits[i].get( key );
+                ICacheElement<K, V> obj = noWaits[i].get( key );
 
                 if ( obj != null )
                 {
                     // TODO: return after first success
                     // could do this simultaneously
                     // serious blocking risk here
-                    return (ICacheElement) obj;
+                    return obj;
                 }
             }
             catch ( Exception ex )
@@ -235,18 +235,18 @@ public class LateralCacheNoWaitFacade
      * 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
+     * @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
      */
-    public Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
+    public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
 
         if ( keys != null && !keys.isEmpty() )
         {
-            for (Serializable key : keys)
+            for (K key : keys)
             {
-                ICacheElement element = get( key );
+                ICacheElement<K, V> element = get( key );
 
                 if ( element != null )
                 {
@@ -265,9 +265,9 @@ public class LateralCacheNoWaitFacade
      * @param pattern
      * @return ICacheElement
      */
-    public Map<Serializable, ICacheElement> getMatching(String pattern)
+    public Map<K, ICacheElement<K, V>> getMatching(String pattern)
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
         for ( int i = 0; i < noWaits.length; i++ )
         {
             try
@@ -286,12 +286,12 @@ public class LateralCacheNoWaitFacade
      * @param group
      * @return Set
      */
-    public Set<Serializable> getGroupKeys( String group )
+    public Set<K> getGroupKeys( String group )
     {
-        HashSet<Serializable> allKeys = new HashSet<Serializable>();
+        HashSet<K> allKeys = new HashSet<K>();
         for ( int i = 0; i < noWaits.length; i++ )
         {
-            AuxiliaryCache aux = noWaits[i];
+            AuxiliaryCache<K, V> aux = noWaits[i];
             if ( aux != null )
             {
                 try
@@ -313,7 +313,7 @@ public class LateralCacheNoWaitFacade
      * @param key
      * @return always false.
      */
-    public boolean remove( Serializable key )
+    public boolean remove( K key )
     {
         try
         {

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java Wed May 30 18:14:43 2012
@@ -28,7 +28,7 @@ import org.apache.jcs.engine.behavior.IC
  * JCS-TCP-Lateral packet. The headers specify the action the receiver should
  * take.
  */
-public class LateralElementDescriptor
+public class LateralElementDescriptor<K extends Serializable, V extends Serializable>
     implements Serializable
 {
     /** Don't change */
@@ -53,7 +53,7 @@ public class LateralElementDescriptor
     public final static int GET_MATCHING = 6;
 
     /** The Cache Element that we are distributing. */
-    public ICacheElement ce;
+    public ICacheElement<K, V> ce;
 
     /**
      * The id of the the source of the request. This is used to prevent infinite
@@ -78,9 +78,9 @@ public class LateralElementDescriptor
     /**
      * Constructor for the LateralElementDescriptor object
      * <p>
-     * @param ce ICacheElement payload
+     * @param ce ICacheElement<K, V> payload
      */
-    public LateralElementDescriptor( ICacheElement ce )
+    public LateralElementDescriptor( ICacheElement<K, V> ce )
     {
         this.ce = ce;
     }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java Wed May 30 18:14:43 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.lateral
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
 import org.apache.jcs.engine.ZombieCacheServiceNonLocal;
 
@@ -29,9 +31,9 @@ import org.apache.jcs.engine.ZombieCache
  * <p>
  * Extends a queing non-local service.
  */
-public class ZombieLateralCacheService
-    extends ZombieCacheServiceNonLocal
-    implements ILateralCacheService
+public class ZombieLateralCacheService<K extends Serializable, V extends Serializable>
+    extends ZombieCacheServiceNonLocal<K, V>
+    implements ILateralCacheService<K, V>
 {
     // backwards compatibility
 

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheListener.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheListener.java Wed May 30 18:14:43 2012
@@ -19,14 +19,16 @@ package org.apache.jcs.auxiliary.lateral
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.engine.behavior.ICacheListener;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 
 /**
  * Listens for lateral cache event notification.
  */
-public interface ILateralCacheListener
-    extends ICacheListener
+public interface ILateralCacheListener<K extends Serializable, V extends Serializable>
+    extends ICacheListener<K, V>
 {
     /** Description of the Method */
     public void init();

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java Wed May 30 18:14:43 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.lateral
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.Map;
 
 import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
@@ -48,7 +49,7 @@ public interface ILateralCacheManager
      * <p>
      * @return Map
      */
-    public abstract Map<String, LateralCacheNoWait> getCaches();
+    public abstract Map<String, LateralCacheNoWait<? extends Serializable, ? extends Serializable>> getCaches();
 
     /**
      * The restore calls this on the manger if a cache if found to be in error.

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java Wed May 30 18:14:43 2012
@@ -19,11 +19,13 @@ package org.apache.jcs.auxiliary.lateral
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
 
 /** Used to retrieve and update the lateral cache. */
-public interface ILateralCacheService
-    extends ICacheServiceNonLocal
+public interface ILateralCacheService<K extends Serializable, V extends Serializable>
+    extends ICacheServiceNonLocal<K, V>
 {
     // backwards compatibility
 }

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java Wed May 30 18:14:43 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.auxiliary.lateral
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.StringTokenizer;
 
@@ -67,11 +68,12 @@ public class LateralTCPCacheFactory
      * @return AuxiliaryCache
      */
     @Override
-    public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr,
-                                       ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> createCache(
+            AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr,
+           ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
         ITCPLateralCacheAttributes lac = (ITCPLateralCacheAttributes) iaca;
-        ArrayList<ICache> noWaits = new ArrayList<ICache>();
+        ArrayList<ICache<K, V>> noWaits = new ArrayList<ICache<K, V>>();
 
         // pairs up the tcp servers and set the tcpServer value and
         // get the manager and then get the cache
@@ -101,7 +103,7 @@ public class LateralTCPCacheFactory
                     ( (IShutdownObservable) cacheMgr ).registerShutdownObserver( lcm );
                 }
 
-                ICache ic = lcm.getCache( lacC.getCacheName() );
+                ICache<K, V> ic = lcm.getCache( lacC.getCacheName() );
                 if ( ic != null )
                 {
                     noWaits.add( ic );
@@ -119,7 +121,7 @@ public class LateralTCPCacheFactory
         createListener( (ILateralCacheAttributes) iaca, cacheMgr );
 
         // create the no wait facade.
-        LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( noWaits
+        LateralCacheNoWaitFacade<K, V> lcnwf = new LateralCacheNoWaitFacade<K, V>( noWaits
             .toArray( new LateralCacheNoWait[0] ), (ILateralCacheAttributes) iaca );
 
         // create udp discovery if available.
@@ -147,7 +149,7 @@ public class LateralTCPCacheFactory
             try
             {
                 // make a listener. if one doesn't exist
-                ICacheListener listener = LateralTCPListener.getInstance( attr, cacheMgr );
+                ICacheListener<?, ?> listener = LateralTCPListener.getInstance( attr, cacheMgr );
 
                 // register for shutdown notification
                 if ( listener instanceof IShutdownObserver && cacheMgr instanceof IShutdownObservable )
@@ -179,11 +181,12 @@ public class LateralTCPCacheFactory
      * @param elementSerializer
      * @return null if none is created.
      */
-    private synchronized UDPDiscoveryService createDiscoveryService( ITCPLateralCacheAttributes lac,
-                                                                     LateralCacheNoWaitFacade lcnwf,
-                                                                     ICompositeCacheManager cacheMgr,
-                                                                     ICacheEventLogger cacheEventLogger,
-                                                                     IElementSerializer elementSerializer )
+    private synchronized <K extends Serializable, V extends Serializable> UDPDiscoveryService createDiscoveryService(
+            ITCPLateralCacheAttributes lac,
+            LateralCacheNoWaitFacade<K, V> lcnwf,
+            ICompositeCacheManager cacheMgr,
+            ICacheEventLogger cacheEventLogger,
+            IElementSerializer elementSerializer )
     {
         UDPDiscoveryService discovery = null;
 

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java Wed May 30 18:14:43 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.lateral
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -215,7 +216,7 @@ public class LateralTCPCacheManager
      * @exception IOException
      */
     @Override
-    public void addLateralCacheListener( String cacheName, ILateralCacheListener listener )
+    public <K extends Serializable, V extends Serializable> void addLateralCacheListener( String cacheName, ILateralCacheListener<K, V> listener )
         throws IOException
     {
         synchronized ( this.caches )
@@ -237,18 +238,18 @@ public class LateralTCPCacheManager
      * @param cacheName
      */
     @Override
-    public AuxiliaryCache getCache( String cacheName )
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( String cacheName )
     {
-        LateralCacheNoWait lateralNoWait = null;
+        LateralCacheNoWait<K, V> lateralNoWait = null;
         synchronized ( caches )
         {
-            lateralNoWait = caches.get( cacheName );
+            lateralNoWait = (LateralCacheNoWait<K, V>) caches.get( cacheName );
             if ( lateralNoWait == null )
             {
                 LateralCacheAttributes attr = (LateralCacheAttributes) lateralCacheAttribures.copy();
                 attr.setCacheName( cacheName );
 
-                LateralCache cache = new LateralCache( attr, this.lateralService, monitor );
+                LateralCache<K, V> cache = new LateralCache<K, V>( attr, this.lateralService, monitor );
                 cache.setCacheEventLogger( cacheEventLogger );
                 cache.setElementSerializer( elementSerializer );
 
@@ -257,7 +258,7 @@ public class LateralTCPCacheManager
                     log.debug( "Created cache for noWait, cache [" + cache + "]" );
                 }
 
-                lateralNoWait = new LateralCacheNoWait( cache );
+                lateralNoWait = new LateralCacheNoWait<K, V>( cache );
                 lateralNoWait.setCacheEventLogger( cacheEventLogger );
                 lateralNoWait.setElementSerializer( elementSerializer );
 

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java Wed May 30 18:14:43 2012
@@ -1,5 +1,6 @@
 package org.apache.jcs.auxiliary.lateral.socket.tcp;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -21,7 +22,7 @@ import org.apache.jcs.utils.discovery.Di
 import org.apache.jcs.utils.discovery.behavior.IDiscoveryListener;
 
 /**
- * This knows how to add and remove discovered services. It observers UDP discovery events.
+ * This knows how to add and remove discovered services. It observes UDP discovery events.
  * <p>
  * We can have one listener per region, or one shared by all regions.
  */
@@ -35,8 +36,8 @@ public class LateralTCPDiscoveryListener
      * Map of no wait facades. these are used to determine which regions are locally configured to
      * use laterals.
      */
-    private final Map<String, LateralCacheNoWaitFacade> facades =
-        Collections.synchronizedMap( new HashMap<String, LateralCacheNoWaitFacade>() );
+    private final Map<String, LateralCacheNoWaitFacade<? extends Serializable, ? extends Serializable>> facades =
+        Collections.synchronizedMap( new HashMap<String, LateralCacheNoWaitFacade<? extends Serializable, ? extends Serializable>>() );
 
     /**
      * List of regions that are configured differently here than on another server. We keep track of
@@ -79,7 +80,7 @@ public class LateralTCPDiscoveryListener
      * @param facade - facade (for region) => multiple lateral clients.
      * @return true if the facade was not already registered.
      */
-    public synchronized boolean addNoWaitFacade( String cacheName, LateralCacheNoWaitFacade facade )
+    public synchronized boolean addNoWaitFacade( String cacheName, LateralCacheNoWaitFacade<? extends Serializable, ? extends Serializable> facade )
     {
         boolean isNew = !containsNoWaitFacade( cacheName );
 
@@ -108,9 +109,9 @@ public class LateralTCPDiscoveryListener
      * @param noWait - is this no wait in the facade
      * @return do we contain the no wait. true if so
      */
-    public boolean containsNoWait( String cacheName, LateralCacheNoWait noWait )
+    public <K extends Serializable, V extends Serializable> boolean containsNoWait( String cacheName, LateralCacheNoWait<K, V> noWait )
     {
-        LateralCacheNoWaitFacade facade = facades.get( noWait.getCacheName() );
+        LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() );
         if ( facade == null )
         {
             return false;
@@ -131,9 +132,9 @@ public class LateralTCPDiscoveryListener
      * @return true if we found the no wait and added it. False if the no wait was not present or it
      *         we already had it.
      */
-    protected boolean addNoWait( LateralCacheNoWait noWait )
+    protected <K extends Serializable, V extends Serializable> boolean addNoWait( LateralCacheNoWait<K, V> noWait )
     {
-        LateralCacheNoWaitFacade facade = facades.get( noWait.getCacheName() );
+        LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() );
         if ( log.isDebugEnabled() )
         {
             log.debug( "addNoWait > Got facade for " + noWait.getCacheName() + " = " + facade );
@@ -170,9 +171,9 @@ public class LateralTCPDiscoveryListener
      * @param noWait
      * @return true if we found the no wait and removed it. False if the no wait was not present.
      */
-    protected boolean removeNoWait( LateralCacheNoWait noWait )
+    protected <K extends Serializable, V extends Serializable> boolean removeNoWait( LateralCacheNoWait<K, V> noWait )
     {
-        LateralCacheNoWaitFacade facade = facades.get( noWait.getCacheName() );
+        LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() );
         if ( log.isDebugEnabled() )
         {
             log.debug( "removeNoWait > Got facade for " + noWait.getCacheName() + " = " + facade );
@@ -233,7 +234,7 @@ public class LateralTCPDiscoveryListener
             {
                 try
                 {
-                    ICache ic = lcm.getCache( cacheName );
+                    ICache<? extends Serializable, ? extends Serializable> ic = lcm.getCache( cacheName );
 
                     if ( log.isDebugEnabled() )
                     {
@@ -243,7 +244,7 @@ public class LateralTCPDiscoveryListener
                     // add this to the nowaits for this cachename
                     if ( ic != null )
                     {
-                        addNoWait( (LateralCacheNoWait) ic );
+                        addNoWait( (LateralCacheNoWait<? extends Serializable, ? extends Serializable>) ic );
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "Called addNoWait for cacheName [" + cacheName + "]" );
@@ -285,7 +286,7 @@ public class LateralTCPDiscoveryListener
             {
                 try
                 {
-                    ICache ic = lcm.getCache( cacheName );
+                    ICache<? extends Serializable, ? extends Serializable> ic = lcm.getCache( cacheName );
 
                     if ( log.isDebugEnabled() )
                     {
@@ -295,7 +296,7 @@ public class LateralTCPDiscoveryListener
                     // remove this to the nowaits for this cachename
                     if ( ic != null )
                     {
-                        removeNoWait( (LateralCacheNoWait) ic );
+                        removeNoWait( (LateralCacheNoWait<? extends Serializable, ? extends Serializable>) ic );
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "Called removeNoWait for cacheName [" + cacheName + "]" );

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Wed May 30 18:14:43 2012
@@ -50,8 +50,8 @@ import org.apache.jcs.engine.control.Com
  * starts a listening thread, which creates a socket server. When messages are received they are
  * passed to a pooled executor which then calls the appropriate handle method.
  */
-public class LateralTCPListener
-    implements ILateralCacheListener, Serializable, IShutdownObserver
+public class LateralTCPListener<K extends Serializable, V extends Serializable>
+    implements ILateralCacheListener<K, V>, Serializable, IShutdownObserver
 {
     /** Don't change. */
     private static final long serialVersionUID = -9107062664967131738L;
@@ -66,8 +66,8 @@ public class LateralTCPListener
     private transient ICompositeCacheManager cacheManager;
 
     /** Map of available instances, keyed by port */
-    protected final static HashMap<String, ILateralCacheListener> instances =
-        new HashMap<String, ILateralCacheListener>();
+    protected final static HashMap<String, ILateralCacheListener<?, ?>> instances =
+        new HashMap<String, ILateralCacheListener<?, ?>>();
 
     /** The socket listener */
     private ListenerThread receiver;
@@ -106,14 +106,14 @@ public class LateralTCPListener
      * @param cacheMgr
      * @return The instance value
      */
-    public synchronized static ILateralCacheListener getInstance( ITCPLateralCacheAttributes ilca,
-                                                                  ICompositeCacheManager cacheMgr )
+    public synchronized static <K extends Serializable, V extends Serializable> ILateralCacheListener<K, V>
+        getInstance( ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr )
     {
-        ILateralCacheListener ins = instances.get( String.valueOf( ilca.getTcpListenerPort() ) );
+        ILateralCacheListener<K, V> ins = (ILateralCacheListener<K, V>) instances.get( String.valueOf( ilca.getTcpListenerPort() ) );
 
         if ( ins == null )
         {
-            ins = new LateralTCPListener( ilca );
+            ins = new LateralTCPListener<K, V>( ilca );
 
             ins.init();
 
@@ -206,7 +206,7 @@ public class LateralTCPListener
      * <p>
      * @see org.apache.jcs.engine.behavior.ICacheListener#handlePut(org.apache.jcs.engine.behavior.ICacheElement)
      */
-    public void handlePut( ICacheElement element )
+    public void handlePut( ICacheElement<K, V> element )
         throws IOException
     {
         putCnt++;
@@ -234,7 +234,7 @@ public class LateralTCPListener
      * @see org.apache.jcs.engine.behavior.ICacheListener#handleRemove(java.lang.String,
      *      java.io.Serializable)
      */
-    public void handleRemove( String cacheName, Serializable key )
+    public void handleRemove( String cacheName, K key )
         throws IOException
     {
         removeCnt++;
@@ -278,7 +278,7 @@ public class LateralTCPListener
      * @return Serializable
      * @throws IOException
      */
-    public Serializable handleGet( String cacheName, Serializable key )
+    public Serializable handleGet( String cacheName, K key )
         throws IOException
     {
         getCnt++;
@@ -307,7 +307,7 @@ public class LateralTCPListener
      * @return Map
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> handleGetMatching( String cacheName, String pattern )
+    public Map<K, ICacheElement<K, V>> handleGetMatching( String cacheName, String pattern )
         throws IOException
     {
         getCnt++;
@@ -353,7 +353,7 @@ public class LateralTCPListener
      * @param name
      * @return CompositeCache
      */
-    protected CompositeCache getCache( String name )
+    protected CompositeCache<K, V> getCache( String name )
     {
         if ( getCacheManager() == null )
         {
@@ -483,7 +483,7 @@ public class LateralTCPListener
     }
 
     /**
-     * A Separate thread taht runs when a command comes into the LateralTCPReceiver.
+     * A Separate thread that runs when a command comes into the LateralTCPReceiver.
      */
     public class ConnectionHandler
         implements Runnable
@@ -518,13 +518,13 @@ public class LateralTCPListener
                 return;
             }
 
-            LateralElementDescriptor led;
+            LateralElementDescriptor<K, V> led;
 
             try
             {
                 while ( true )
                 {
-                    led = (LateralElementDescriptor) ois.readObject();
+                    led = (LateralElementDescriptor<K, V>) ois.readObject();
 
                     if ( led == null )
                     {
@@ -577,11 +577,11 @@ public class LateralTCPListener
          * @param led
          * @throws IOException
          */
-        private void handle( LateralElementDescriptor led )
+        private void handle( LateralElementDescriptor<K, V> led )
             throws IOException
         {
             String cacheName = led.ce.getCacheName();
-            Serializable key = led.ce.getKey();
+            K key = led.ce.getKey();
 
             if ( led.command == LateralElementDescriptor.UPDATE )
             {
@@ -596,7 +596,7 @@ public class LateralTCPListener
                 {
                     if ( getTcpLateralCacheAttributes().isFilterRemoveByHashCode() )
                     {
-                        ICacheElement test = getCache( cacheName ).localGet( key );
+                        ICacheElement<K, V> test = getCache( cacheName ).localGet( key );
                         if ( test != null )
                         {
                             if ( test.getVal().hashCode() == led.valHashCode )
@@ -636,7 +636,7 @@ public class LateralTCPListener
             }
             else if ( led.command == LateralElementDescriptor.GET_MATCHING )
             {
-                Map<Serializable, ICacheElement> obj = handleGetMatching( cacheName, (String) key );
+                Map<K, ICacheElement<K, V>> obj = handleGetMatching( cacheName, (String) key );
 
                 ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
 

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java Wed May 30 18:14:43 2012
@@ -22,6 +22,7 @@ package org.apache.jcs.auxiliary.lateral
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.net.InetAddress;
 import java.net.Socket;
 
@@ -169,7 +170,7 @@ public class LateralTCPSender
      * @param led
      * @throws IOException
      */
-    public void send( LateralElementDescriptor led )
+    public <K extends Serializable, V extends Serializable> void send( LateralElementDescriptor<K, V> led )
         throws IOException
     {
         sendCnt++;
@@ -225,7 +226,7 @@ public class LateralTCPSender
      * @return ICacheElement
      * @throws IOException
      */
-    public Object sendAndReceive( LateralElementDescriptor led )
+    public <K extends Serializable, V extends Serializable> Object sendAndReceive( LateralElementDescriptor<K, V> led )
         throws IOException
     {
         if ( led == null )
@@ -302,8 +303,8 @@ public class LateralTCPSender
     }
 
     /**
-     * Closes connection used by all LateralTCPSenders for this lateral conneciton. Dispose request
-     * should come into the facade and be sent to all lateral cache sevices. The lateral cache
+     * Closes connection used by all LateralTCPSenders for this lateral connection. Dispose request
+     * should come into the facade and be sent to all lateral cache services. The lateral cache
      * service will then call this method.
      * <p>
      * @param cache



Mime
View raw message