You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2011/07/27 20:08:57 UTC
svn commit: r1151575 [4/6] - in /commons/proper/jcs/trunk: ./
src/experimental/org/apache/jcs/engine/memory/arc/
src/java/org/apache/jcs/access/ src/java/org/apache/jcs/access/behavior/
src/java/org/apache/jcs/admin/ src/java/org/apache/jcs/auxiliary/ ...
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java Wed Jul 27 18:08:23 2011
@@ -20,7 +20,6 @@ package org.apache.jcs.auxiliary.remote.
*/
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.apache.commons.logging.Log;
@@ -31,7 +30,6 @@ import org.apache.jcs.auxiliary.remote.R
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
import org.apache.jcs.auxiliary.remote.http.client.behavior.IRemoteHttpCacheClient;
-import org.apache.jcs.engine.behavior.ICache;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.engine.behavior.IShutdownObserver;
@@ -55,19 +53,19 @@ public class RemoteHttpCacheManager
private static RemoteHttpCacheManager instance;
/** Contains instances of RemoteCacheNoWait managed by a RemoteCacheManager instance. */
- static final Map caches = new HashMap();
+ static final Map<String, RemoteCacheNoWait> caches = new HashMap<String, RemoteCacheNoWait>();
/** The configuration attributes. */
private IRemoteCacheAttributes remoteCacheAttributes;
/** The event logger. */
- private ICacheEventLogger cacheEventLogger;
+ private final ICacheEventLogger cacheEventLogger;
/** The serializer. */
- private IElementSerializer elementSerializer;
+ private final IElementSerializer elementSerializer;
/** The cache manager listeners will need to use to get a cache. */
- private ICompositeCacheManager cacheMgr;
+ private final ICompositeCacheManager cacheMgr;
/** Remote cache monitor. */
private static RemoteHttpCacheMonitor monitor;
@@ -177,7 +175,7 @@ public class RemoteHttpCacheManager
synchronized ( caches )
{
- remoteCacheNoWait = (RemoteCacheNoWait) caches.get( cattr.getCacheName() + cattr.getUrl() );
+ remoteCacheNoWait = caches.get( cattr.getCacheName() + cattr.getUrl() );
if ( remoteCacheNoWait == null )
{
RemoteHttpClientListener listener = new RemoteHttpClientListener( cattr, cacheMgr );
@@ -232,10 +230,8 @@ public class RemoteHttpCacheManager
public String getStats()
{
StringBuffer stats = new StringBuffer();
- Iterator allCaches = caches.values().iterator();
- while ( allCaches.hasNext() )
+ for (RemoteCacheNoWait c : caches.values())
{
- ICache c = (ICache) allCaches.next();
if ( c != null )
{
stats.append( c.getCacheName() );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java Wed Jul 27 18:08:23 2011
@@ -20,7 +20,6 @@ package org.apache.jcs.auxiliary.remote.
*/
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -46,7 +45,7 @@ public class RemoteHttpCacheMonitor
private static long idlePeriod = 3 * 1000;
/** Set of remote caches to monitor. This are added on error, if not before. */
- private Set remoteHttpCaches = new HashSet();
+ private final Set<RemoteHttpCache> remoteHttpCaches = new HashSet<RemoteHttpCache>();
/**
* Must make sure RemoteCacheMonitor is started before any remote error can be detected!
@@ -185,7 +184,7 @@ public class RemoteHttpCacheMonitor
}
// Make a copy
- Set remoteCachesToExamine = new HashSet();
+ Set<RemoteHttpCache> remoteCachesToExamine = new HashSet<RemoteHttpCache>();
synchronized ( this )
{
remoteCachesToExamine.addAll( this.remoteHttpCaches );
@@ -194,13 +193,10 @@ public class RemoteHttpCacheMonitor
// managed by the
// same RmicCacheManager instance are in error. So we fix
// them once and for all.
- Iterator itr2 = remoteCachesToExamine.iterator();
- while ( itr2.hasNext() )
+ for (RemoteHttpCache remoteCache : remoteCachesToExamine)
{
try
{
- RemoteHttpCache remoteCache = (RemoteHttpCache) itr2.next();
-
if ( remoteCache.getStatus() == CacheConstants.STATUS_ERROR )
{
RemoteHttpCacheAttributes attributes = remoteCache.getRemoteHttpCacheAttributes();
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java Wed Jul 27 18:08:23 2011
@@ -58,7 +58,7 @@ public abstract class AbstractRemoteCach
private int puts = 0;
/** The interval at which we will log updates. */
- private int logInterval = 100;
+ private final int logInterval = 100;
/** log instance */
private final static Log log = LogFactory.getLog( AbstractRemoteCacheService.class );
@@ -207,7 +207,7 @@ public abstract class AbstractRemoteCach
* @return Map of keys and wrapped objects
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern )
+ public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
throws IOException
{
return getMatching( cacheName, pattern, 0 );
@@ -222,7 +222,7 @@ public abstract class AbstractRemoteCach
* @return Map of keys and wrapped objects
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern, long requesterId )
+ public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
throws IOException
{
ICacheEvent cacheEvent = createICacheEvent( cacheName, pattern, requesterId,
@@ -246,7 +246,7 @@ public abstract class AbstractRemoteCach
* @return Map of keys and wrapped objects
* @throws IOException
*/
- abstract Map processGetMatching( String cacheName, String pattern, long requesterId )
+ abstract Map<Serializable, ICacheElement> processGetMatching( String cacheName, String pattern, long requesterId )
throws IOException;
/**
@@ -258,7 +258,7 @@ public abstract class AbstractRemoteCach
* data in cache for any of these keys
* @throws IOException
*/
- public Map getMultiple( String cacheName, Set keys )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
throws IOException
{
return this.getMultiple( cacheName, keys, 0 );
@@ -276,7 +276,7 @@ public abstract class AbstractRemoteCach
* data in cache for any of these keys
* @throws IOException
*/
- public Map getMultiple( String cacheName, Set keys, long requesterId )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
throws IOException
{
ICacheEvent cacheEvent = createICacheEvent( cacheName, (Serializable) keys, requesterId,
@@ -301,7 +301,7 @@ public abstract class AbstractRemoteCach
* data in cache for any of these keys
* @throws IOException
*/
- abstract Map processGetMultiple( String cacheName, Set keys, long requesterId )
+ abstract Map<Serializable, ICacheElement> processGetMultiple( String cacheName, Set<Serializable> keys, long requesterId )
throws IOException;
/**
@@ -311,7 +311,7 @@ public abstract class AbstractRemoteCach
* @param group
* @return A Set of group keys
*/
- public Set getGroupKeys( String cacheName, String group )
+ public Set<Serializable> getGroupKeys( String cacheName, String group )
{
return processGetGroupKeys( cacheName, group );
}
@@ -323,9 +323,9 @@ public abstract class AbstractRemoteCach
* @param groupName
* @return Set
*/
- public Set processGetGroupKeys( String cacheName, String groupName )
+ public Set<Serializable> processGetGroupKeys( String cacheName, String groupName )
{
- CompositeCache cache = (CompositeCache) getCacheManager().getCache( cacheName );
+ CompositeCache cache = getCacheManager().getCache( cacheName );
return cache.getGroupKeys( groupName );
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java Wed Jul 27 18:08:23 2011
@@ -19,6 +19,7 @@ package org.apache.jcs.auxiliary.remote.
* under the License.
*/
+import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@@ -93,7 +94,7 @@ public class RemoteCacheServiceAdaptor
}
break;
case RemoteCacheRequest.REQUEST_TYPE_GET_MULTIPLE:
- Map elementMap = getRemoteCacheService().getMultiple( request.getCacheName(),
+ Map<Serializable, ICacheElement> elementMap = getRemoteCacheService().getMultiple( request.getCacheName(),
request.getKeySet(),
request.getRequesterId() );
if ( elementMap != null )
@@ -102,7 +103,7 @@ public class RemoteCacheServiceAdaptor
}
break;
case RemoteCacheRequest.REQUEST_TYPE_GET_MATCHING:
- Map elementMapMatching = getRemoteCacheService().getMatching( request.getCacheName(),
+ Map<Serializable, ICacheElement> elementMapMatching = getRemoteCacheService().getMatching( request.getCacheName(),
request.getPattern(),
request.getRequesterId() );
if ( elementMapMatching != null )
@@ -128,11 +129,11 @@ public class RemoteCacheServiceAdaptor
// DO NOTHING
break;
case RemoteCacheRequest.REQUEST_TYPE_GET_GROUP_KEYS:
- Set groupKeys = getRemoteCacheService().getGroupKeys( request.getCacheName(),
+ Set<Serializable> groupKeys = getRemoteCacheService().getGroupKeys( request.getCacheName(),
request.getKey() + "" );
if ( groupKeys == null )
{
- groupKeys = Collections.EMPTY_SET;
+ groupKeys = Collections.emptySet();
}
response.getPayload().put( request.getKey(), groupKeys );
break;
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheService.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheService.java Wed Jul 27 18:08:23 2011
@@ -43,7 +43,7 @@ public class RemoteHttpCacheService
private static final String EVENT_LOG_SOURCE_NAME = "RemoteHttpCacheServer";
/** The configuration */
- private RemoteHttpCacheServerAttributes remoteHttpCacheServerAttributes;
+ private final RemoteHttpCacheServerAttributes remoteHttpCacheServerAttributes;
/**
* Create a process with a cache manager.
@@ -72,10 +72,11 @@ public class RemoteHttpCacheService
* @return ICacheElement
* @throws IOException
*/
+ @Override
public ICacheElement processGet( String cacheName, Serializable key, long requesterId )
throws IOException
{
- CompositeCache cache = (CompositeCache) getCacheManager().getCache( cacheName );
+ CompositeCache cache = getCacheManager().getCache( cacheName );
boolean keepLocal = !remoteHttpCacheServerAttributes.isAllowClusterGet();
if ( keepLocal )
@@ -100,10 +101,11 @@ public class RemoteHttpCacheService
* @return Map
* @throws IOException
*/
- public Map processGetMultiple( String cacheName, Set keys, long requesterId )
+ @Override
+ public Map<Serializable, ICacheElement> processGetMultiple( String cacheName, Set<Serializable> keys, long requesterId )
throws IOException
{
- CompositeCache cache = (CompositeCache) getCacheManager().getCache( cacheName );
+ CompositeCache cache = getCacheManager().getCache( cacheName );
boolean keepLocal = !remoteHttpCacheServerAttributes.isAllowClusterGet();
if ( keepLocal )
@@ -128,10 +130,11 @@ public class RemoteHttpCacheService
* @return Map
* @throws IOException
*/
- public Map processGetMatching( String cacheName, String pattern, long requesterId )
+ @Override
+ public Map<Serializable, ICacheElement> processGetMatching( String cacheName, String pattern, long requesterId )
throws IOException
{
- CompositeCache cache = (CompositeCache) getCacheManager().getCache( cacheName );
+ CompositeCache cache = getCacheManager().getCache( cacheName );
boolean keepLocal = !remoteHttpCacheServerAttributes.isAllowClusterGet();
if ( keepLocal )
@@ -154,10 +157,11 @@ public class RemoteHttpCacheService
* @param requesterId
* @throws IOException
*/
+ @Override
public void processUpdate( ICacheElement item, long requesterId )
throws IOException
{
- CompositeCache cache = (CompositeCache) getCacheManager().getCache( item.getCacheName() );
+ CompositeCache cache = getCacheManager().getCache( item.getCacheName() );
boolean keepLocal = !remoteHttpCacheServerAttributes.isLocalClusterConsistency();
if ( keepLocal )
@@ -181,10 +185,11 @@ public class RemoteHttpCacheService
* @param requesterId
* @throws IOException
*/
+ @Override
public void processRemove( String cacheName, Serializable key, long requesterId )
throws IOException
{
- CompositeCache cache = (CompositeCache) getCacheManager().getCache( cacheName );
+ CompositeCache cache = getCacheManager().getCache( cacheName );
boolean keepLocal = !remoteHttpCacheServerAttributes.isLocalClusterConsistency();
if ( keepLocal )
@@ -207,10 +212,11 @@ public class RemoteHttpCacheService
* @param requesterId
* @throws IOException
*/
+ @Override
public void processRemoveAll( String cacheName, long requesterId )
throws IOException
{
- CompositeCache cache = (CompositeCache) getCacheManager().getCache( cacheName );
+ CompositeCache cache = getCacheManager().getCache( cacheName );
boolean keepLocal = !remoteHttpCacheServerAttributes.isLocalClusterConsistency();
if ( keepLocal )
@@ -230,10 +236,11 @@ public class RemoteHttpCacheService
* @param requesterId
* @throws IOException
*/
+ @Override
public void processDispose( String cacheName, long requesterId )
throws IOException
{
- CompositeCache cache = (CompositeCache) getCacheManager().getCache( cacheName );
+ CompositeCache cache = getCacheManager().getCache( cacheName );
cache.dispose();
}
@@ -254,6 +261,7 @@ public class RemoteHttpCacheService
* @param requesterId
* @return requesterId + ""
*/
+ @Override
protected String getExtraInfoForRequesterId( long requesterId )
{
return requesterId + "";
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java Wed Jul 27 18:08:23 2011
@@ -6,9 +6,9 @@ package org.apache.jcs.auxiliary.remote.
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -23,7 +23,6 @@ import java.rmi.server.RMISocketFactory;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.Unreferenced;
import java.util.Collections;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
@@ -80,28 +79,30 @@ class RemoteCacheServer
private int puts = 0;
/** Maps cache name to CacheListeners object. association of listeners (regions). */
- private final Hashtable cacheListenersMap = new Hashtable();
+ private final Hashtable<String, CacheListeners> cacheListenersMap =
+ new Hashtable<String, CacheListeners>();
/** maps cluster listeners to regions. */
- private final Hashtable clusterListenersMap = new Hashtable();
+ private final Hashtable<String, CacheListeners> clusterListenersMap =
+ new Hashtable<String, CacheListeners>();
/** The central hub */
private CompositeCacheManager cacheManager;
/** relates listener id with a type */
- private final Hashtable idTypeMap = new Hashtable();
+ private final Hashtable<Long, Integer> idTypeMap = new Hashtable<Long, Integer>();
/** relates listener id with an ip address */
- private final Hashtable idIPMap = new Hashtable();
+ private final Hashtable<Long, String> idIPMap = new Hashtable<Long, String>();
/** Used to get the next listener id. */
- private int[] listenerId = new int[1];
+ private final int[] listenerId = new int[1];
/** Configuration settings. */
protected IRemoteCacheServerAttributes remoteCacheServerAttributes;
/** The interval at which we will log updates. */
- private int logInterval = 100;
+ private final int logInterval = 100;
/** An optional event logger */
private transient ICacheEventLogger cacheEventLogger;
@@ -544,7 +545,7 @@ class RemoteCacheServer
* @return Map of keys and wrapped objects
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern )
+ public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
throws IOException
{
return getMatching( cacheName, pattern, 0 );
@@ -559,7 +560,7 @@ class RemoteCacheServer
* @return Map of keys and wrapped objects
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern, long requesterId )
+ public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
throws IOException
{
ICacheEvent cacheEvent = createICacheEvent( cacheName, pattern, requesterId,
@@ -582,7 +583,7 @@ class RemoteCacheServer
* @param requesterId
* @return Map of keys and wrapped objects
*/
- protected Map processGetMatching( String cacheName, String pattern, long requesterId )
+ protected Map<Serializable, ICacheElement> processGetMatching( String cacheName, String pattern, long requesterId )
{
boolean fromCluster = isRequestFromCluster( requesterId );
@@ -619,14 +620,14 @@ class RemoteCacheServer
* @param cacheDesc
* @return Map of keys to results
*/
- private Map getMatchingFromCacheListeners( String pattern, boolean fromCluster, CacheListeners cacheDesc )
+ private Map<Serializable, ICacheElement> getMatchingFromCacheListeners( String pattern, boolean fromCluster, CacheListeners cacheDesc )
{
- Map elements = null;
+ Map<Serializable, ICacheElement> elements = null;
if ( cacheDesc != null )
{
CompositeCache c = (CompositeCache) cacheDesc.cache;
- // We always want to go remote and then merge the items. But this can lead to inconsistencies after
+ // We always want to go remote and then merge the items. But this can lead to inconsistencies after
// failover recovery. Removed items may show up. There is no good way to prevent this.
// We should make it configurable.
@@ -665,7 +666,7 @@ class RemoteCacheServer
* data in cache for any of these keys
* @throws IOException
*/
- public Map getMultiple( String cacheName, Set keys )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
throws IOException
{
return this.getMultiple( cacheName, keys, 0 );
@@ -683,7 +684,7 @@ class RemoteCacheServer
* data in cache for any of these keys
* @throws IOException
*/
- public Map getMultiple( String cacheName, Set keys, long requesterId )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
throws IOException
{
ICacheEvent cacheEvent = createICacheEvent( cacheName, (Serializable) keys, requesterId,
@@ -707,9 +708,9 @@ class RemoteCacheServer
* @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
*/
- private Map processGetMultiple( String cacheName, Set keys, long requesterId )
+ private Map<Serializable, ICacheElement> processGetMultiple( String cacheName, Set<Serializable> keys, long requesterId )
{
- Map elements = null;
+ Map<Serializable, ICacheElement> elements = null;
boolean fromCluster = isRequestFromCluster( requesterId );
@@ -743,7 +744,7 @@ class RemoteCacheServer
*/
private boolean isRequestFromCluster( long requesterId )
{
- Integer remoteTypeL = (Integer) idTypeMap.get( new Long( requesterId ) );
+ Integer remoteTypeL = idTypeMap.get( new Long( requesterId ) );
boolean fromCluster = false;
if ( remoteTypeL != null && remoteTypeL.intValue() == IRemoteCacheAttributes.CLUSTER )
@@ -762,7 +763,7 @@ class RemoteCacheServer
* @param cacheDesc
* @return Map
*/
- private Map getMultipleFromCacheListeners( Set keys, Map elements, boolean fromCluster, CacheListeners cacheDesc )
+ private Map<Serializable, ICacheElement> getMultipleFromCacheListeners( Set<Serializable> keys, Map<Serializable, ICacheElement> elements, boolean fromCluster, CacheListeners cacheDesc )
{
if ( cacheDesc != null )
{
@@ -817,7 +818,7 @@ class RemoteCacheServer
* @param group
* @return A Set of group keys
*/
- public Set getGroupKeys( String cacheName, String group )
+ public Set<Serializable> getGroupKeys( String cacheName, String group )
{
return processGetGroupKeys( cacheName, group );
}
@@ -829,7 +830,7 @@ class RemoteCacheServer
* @param group
* @return Set
*/
- protected Set processGetGroupKeys( String cacheName, String group )
+ protected Set<Serializable> processGetGroupKeys( String cacheName, String group )
{
CacheListeners cacheDesc = null;
try
@@ -843,7 +844,7 @@ class RemoteCacheServer
if ( cacheDesc == null )
{
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
CompositeCache c = (CompositeCache) cacheDesc.cache;
@@ -905,7 +906,7 @@ class RemoteCacheServer
log.debug( "remove [" + key + "] from cache [" + cacheName + "]" );
}
- CacheListeners cacheDesc = (CacheListeners) cacheListenersMap.get( cacheName );
+ CacheListeners cacheDesc = cacheListenersMap.get( cacheName );
boolean fromCluster = isRequestFromCluster( requesterId );
@@ -1004,7 +1005,7 @@ class RemoteCacheServer
private void processRemoveAll( String cacheName, long requesterId )
throws IOException
{
- CacheListeners cacheDesc = (CacheListeners) cacheListenersMap.get( cacheName );
+ CacheListeners cacheDesc = cacheListenersMap.get( cacheName );
boolean fromCluster = isRequestFromCluster( requesterId );
@@ -1105,7 +1106,7 @@ class RemoteCacheServer
log.info( "Dispose request received from listener [" + requesterId + "]" );
}
- CacheListeners cacheDesc = (CacheListeners) cacheListenersMap.get( cacheName );
+ CacheListeners cacheDesc = cacheListenersMap.get( cacheName );
// this is dangerous
if ( cacheDesc != null )
@@ -1134,9 +1135,8 @@ class RemoteCacheServer
{
synchronized ( cacheListenersMap )
{
- for ( Enumeration en = cacheListenersMap.elements(); en.hasMoreElements(); )
+ for (CacheListeners cacheDesc : cacheListenersMap.values())
{
- CacheListeners cacheDesc = (CacheListeners) en.nextElement();
ICacheEventQueue[] qlist = getEventQList( cacheDesc, 0 );
for ( int i = 0; i < qlist.length; i++ )
@@ -1158,12 +1158,12 @@ class RemoteCacheServer
*/
protected CacheListeners getCacheListeners( String cacheName )
{
- CacheListeners cacheListeners = (CacheListeners) cacheListenersMap.get( cacheName );
+ CacheListeners cacheListeners = cacheListenersMap.get( cacheName );
synchronized ( cacheListenersMap )
{
if ( cacheListeners == null )
{
- cacheListeners = (CacheListeners) cacheListenersMap.get( cacheName );
+ cacheListeners = cacheListenersMap.get( cacheName );
if ( cacheListeners == null )
{
cacheListeners = new CacheListeners( cacheManager.getCache( cacheName ) );
@@ -1183,12 +1183,12 @@ class RemoteCacheServer
*/
protected CacheListeners getClusterListeners( String cacheName )
{
- CacheListeners cacheListeners = (CacheListeners) clusterListenersMap.get( cacheName );
+ CacheListeners cacheListeners = clusterListenersMap.get( cacheName );
synchronized ( clusterListenersMap )
{
if ( cacheListeners == null )
{
- cacheListeners = (CacheListeners) clusterListenersMap.get( cacheName );
+ cacheListeners = clusterListenersMap.get( cacheName );
if ( cacheListeners == null )
{
cacheListeners = new CacheListeners( cacheManager.getCache( cacheName ) );
@@ -1216,7 +1216,7 @@ class RemoteCacheServer
ICacheEventQueue[] list = null;
synchronized ( cacheListeners.eventQMap )
{
- list = (ICacheEventQueue[]) cacheListeners.eventQMap.values().toArray( new ICacheEventQueue[0] );
+ list = cacheListeners.eventQMap.values().toArray( new ICacheEventQueue[0] );
}
int count = 0;
// Set those not qualified to null; Count those qualified.
@@ -1256,14 +1256,14 @@ class RemoteCacheServer
* <p>
* @param eventQMap
*/
- private static void cleanupEventQMap( Map eventQMap )
+ private static void cleanupEventQMap( Map<Long, ICacheEventQueue> eventQMap )
{
synchronized ( eventQMap )
{
- for ( Iterator itr = eventQMap.entrySet().iterator(); itr.hasNext(); )
+ for (Iterator<Map.Entry<Long, ICacheEventQueue>> itr = eventQMap.entrySet().iterator(); itr.hasNext(); )
{
- Map.Entry e = (Map.Entry) itr.next();
- ICacheEventQueue q = (ICacheEventQueue) e.getValue();
+ Map.Entry<Long, ICacheEventQueue> e = itr.next();
+ ICacheEventQueue q = e.getValue();
// this does not care if the q is alive (i.e. if
// there are active threads; it cares if the queue
@@ -1313,7 +1313,7 @@ class RemoteCacheServer
log.debug( "adding normal listener, listenerAddress [" + listenerAddress + "]" );
cacheListeners = getCacheListeners( cacheName );
}
- Map eventQMap = cacheListeners.eventQMap;
+ Map<Long, ICacheEventQueue> eventQMap = cacheListeners.eventQMap;
cleanupEventQMap( eventQMap );
// synchronized ( listenerId )
@@ -1381,7 +1381,7 @@ class RemoteCacheServer
ICacheEventQueue q = fact.createCacheEventQueue( listener, id, cacheName, remoteCacheServerAttributes
.getEventQueuePoolName(), remoteCacheServerAttributes.getEventQueueType() );
- eventQMap.put( new Long( listener.getListenerId() ), q );
+ eventQMap.put(Long.valueOf(listener.getListenerId()), q);
if ( log.isInfoEnabled() )
{
@@ -1399,9 +1399,8 @@ class RemoteCacheServer
public void addCacheListener( ICacheListener listener )
throws IOException
{
- for ( Enumeration en = cacheListenersMap.keys(); en.hasMoreElements(); )
+ for (String cacheName : cacheListenersMap.keySet())
{
- String cacheName = (String) en.nextElement();
addCacheListener( cacheName, listener );
if ( log.isDebugEnabled() )
@@ -1453,9 +1452,9 @@ class RemoteCacheServer
{
cacheDesc = getCacheListeners( cacheName );
}
- Map eventQMap = cacheDesc.eventQMap;
+ Map<Long, ICacheEventQueue> eventQMap = cacheDesc.eventQMap;
cleanupEventQMap( eventQMap );
- ICacheEventQueue q = (ICacheEventQueue) eventQMap.remove( new Long( listenerId ) );
+ ICacheEventQueue q = eventQMap.remove( new Long( listenerId ) );
if ( q != null )
{
@@ -1495,9 +1494,8 @@ class RemoteCacheServer
public void removeCacheListener( ICacheListener listener )
throws IOException
{
- for ( Enumeration en = cacheListenersMap.keys(); en.hasMoreElements(); )
+ for (String cacheName : cacheListenersMap.keySet())
{
- String cacheName = (String) en.nextElement();
removeCacheListener( cacheName, listener );
if ( log.isInfoEnabled() )
@@ -1670,7 +1668,7 @@ class RemoteCacheServer
*/
protected String getExtraInfoForRequesterId( long requesterId )
{
- String ipAddress = (String) idIPMap.get( new Long( requesterId ) );
+ String ipAddress = idIPMap.get( new Long( requesterId ) );
return ipAddress;
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java Wed Jul 27 18:08:23 2011
@@ -29,6 +29,10 @@ import java.rmi.registry.Registry;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMISocketFactory;
import java.util.Properties;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,9 +44,6 @@ import org.apache.jcs.engine.logging.beh
import org.apache.jcs.utils.config.OptionConverter;
import org.apache.jcs.utils.config.PropertySetter;
-import EDU.oswego.cs.dl.util.concurrent.ClockDaemon;
-import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
-
/**
* Provides remote cache services. This creates remote cache servers and can proxy command line
* requests to a running server.
@@ -60,7 +61,7 @@ public class RemoteCacheServerFactory
private static String serviceName = IRemoteCacheConstants.REMOTE_CACHE_SERVICE_VAL;
/** Executes the registry keep alive. */
- private static ClockDaemon keepAliveDaemon;
+ private static ScheduledExecutorService keepAliveDaemon;
/** Constructor for the RemoteCacheServerFactory object. */
private RemoteCacheServerFactory()
@@ -155,12 +156,11 @@ public class RemoteCacheServerFactory
{
if ( keepAliveDaemon == null )
{
- keepAliveDaemon = new ClockDaemon();
- keepAliveDaemon.setThreadFactory( new MyThreadFactory() );
+ keepAliveDaemon = Executors.newScheduledThreadPool(1, new MyThreadFactory());
}
RegistryKeepAliveRunner runner = new RegistryKeepAliveRunner( host, port, serviceName );
runner.setCacheEventLogger( cacheEventLogger );
- keepAliveDaemon.executePeriodically( rcsa.getRegistryKeepAliveDelayMillis(), runner, false );
+ keepAliveDaemon.scheduleAtFixedRate(runner, 0, rcsa.getRegistryKeepAliveDelayMillis(), TimeUnit.MILLISECONDS);
}
}
}
@@ -358,10 +358,6 @@ public class RemoteCacheServerFactory
String lccStr = prop.getProperty( REMOTE_LOCAL_CLUSTER_CONSISTENCY );
if ( lccStr != null )
{
- if ( lccStr == null )
- {
- lccStr = "true";
- }
boolean lcc = Boolean.valueOf( lccStr ).booleanValue();
rcsa.setLocalClusterConsistency( lcc );
}
@@ -369,10 +365,6 @@ public class RemoteCacheServerFactory
String acgStr = prop.getProperty( REMOTE_ALLOW_CLUSTER_GET );
if ( acgStr != null )
{
- if ( acgStr == null )
- {
- acgStr = "true";
- }
boolean acg = Boolean.valueOf( acgStr ).booleanValue();
rcsa.setAllowClusterGet( acg );
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java Wed Jul 27 18:08:23 2011
@@ -16,7 +16,7 @@ public class RemoteCacheRequestFactory
{
/** The Logger. */
private final static Log log = LogFactory.getLog( RemoteCacheRequestFactory.class );
-
+
/**
* Creates a get Request.
* <p>
@@ -73,7 +73,7 @@ public class RemoteCacheRequestFactory
* @param requesterId
* @return RemoteHttpCacheRequest
*/
- public static RemoteCacheRequest createGetMultipleRequest( String cacheName, Set keys, long requesterId )
+ public static RemoteCacheRequest createGetMultipleRequest( String cacheName, Set<Serializable> keys, long requesterId )
{
RemoteCacheRequest request = new RemoteCacheRequest();
request.setCacheName( cacheName );
@@ -112,7 +112,7 @@ public class RemoteCacheRequestFactory
return request;
}
-
+
/**
* Creates a GetGroupKeys Request.
* <p>
@@ -180,7 +180,7 @@ public class RemoteCacheRequestFactory
return request;
}
-
+
/**
* Creates an Update Request.
* <p>
@@ -211,7 +211,7 @@ public class RemoteCacheRequestFactory
return request;
}
-
+
/**
* Creates an alive check Request.
* <p>
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheRequest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheRequest.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheRequest.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheRequest.java Wed Jul 27 18:08:23 2011
@@ -57,9 +57,9 @@ public class RemoteCacheRequest
private Serializable key;
/** The keySet, if this request has a keySet. Only getMultiple requests. */
- private Set keySet;
+ private Set<Serializable> keySet;
- /** The pattern, if this request uses a pattern. Ony getMatching requests. */
+ /** The pattern, if this request uses a pattern. Only getMatching requests. */
private String pattern;
/** The ICacheEleemnt, if this request contains a value. Only update requests will have this. */
@@ -164,7 +164,7 @@ public class RemoteCacheRequest
/**
* @param keySet the keySet to set
*/
- public void setKeySet( Set keySet )
+ public void setKeySet( Set<Serializable> keySet )
{
this.keySet = keySet;
}
@@ -172,12 +172,13 @@ public class RemoteCacheRequest
/**
* @return the keySet
*/
- public Set getKeySet()
+ public Set<Serializable> getKeySet()
{
return keySet;
}
/** @return string */
+ @Override
public String toString()
{
StringBuffer buf = new StringBuffer();
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/value/RemoteCacheResponse.java Wed Jul 27 18:08:23 2011
@@ -19,12 +19,12 @@ public class RemoteCacheResponse
/** Simple error messaging */
private String errorMessage;
-
+
/**
* The payload. Typically a key / ICacheElement map. A normal get will return a map with one
* record.
*/
- private Map payload = new HashMap();
+ private Map<Serializable, ? super Object> payload = new HashMap<Serializable, Object>();
/**
* @param success the success to set
@@ -61,7 +61,7 @@ public class RemoteCacheResponse
/**
* @param payload the payload to set
*/
- public void setPayload( Map payload )
+ public void setPayload( Map<Serializable, ? super Object> payload )
{
this.payload = payload;
}
@@ -69,12 +69,13 @@ public class RemoteCacheResponse
/**
* @return the payload
*/
- public Map getPayload()
+ public Map<Serializable, ? super Object> getPayload()
{
return payload;
}
/** @return string */
+ @Override
public String toString()
{
StringBuffer buf = new StringBuffer();
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -44,7 +44,7 @@ public class CacheEventQueue
implements ICacheEventQueue
{
/** The logger. */
- private static final Log log = LogFactory.getLog( CacheEventQueue.class );
+ protected static final Log log = LogFactory.getLog( CacheEventQueue.class );
/** The type of queue -- there are pooled and single */
private static final String queueType = SINGLE_QUEUE_TYPE;
@@ -62,19 +62,19 @@ public class CacheEventQueue
* 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.
*/
- private ICacheListener listener;
+ protected ICacheListener listener;
- /** Id of the listener registed with this queue */
+ /** Id of the listener registered with this queue */
private long listenerId;
/** The cache region name, if applicable. */
- private String cacheName;
+ protected String cacheName;
/** Maximum number of failures before we buy the farm. */
- private int maxFailure;
+ protected int maxFailure;
/** in milliseconds */
- private int waitBeforeRetry;
+ protected int waitBeforeRetry;
/** this is true if there is no worker thread. */
private boolean destroyed = true;
@@ -89,7 +89,7 @@ public class CacheEventQueue
private Thread processorThread;
/** sync */
- private Object queueLock = new Object();
+ protected final Object queueLock = new Object();
/** the head of the queue */
private Node head = new Node();
@@ -156,7 +156,7 @@ public class CacheEventQueue
log.debug( "Constructed: " + this );
}
}
-
+
/**
* What type of queue is this.
* <p>
@@ -202,6 +202,7 @@ public class CacheEventQueue
* <p>
* @return String debugging info.
*/
+ @Override
public String toString()
{
return "CacheEventQueue [listenerId=" + listenerId + ", cacheName=" + cacheName + "]";
@@ -414,7 +415,7 @@ public class CacheEventQueue
* <p>
* @return An event to process.
*/
- private AbstractCacheEvent take()
+ protected AbstractCacheEvent take()
{
synchronized ( queueLock )
{
@@ -455,7 +456,7 @@ public class CacheEventQueue
IStats stats = new Stats();
stats.setTypeName( "Cache Event Queue" );
- ArrayList elems = new ArrayList();
+ ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
IStatElement se = null;
@@ -499,7 +500,7 @@ public class CacheEventQueue
}
// get an array and put them in the Stats object
- IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[0] );
+ IStatElement[] ses = elems.toArray( new StatElement[0] );
stats.setStatElements( ses );
return stats;
@@ -508,7 +509,7 @@ public class CacheEventQueue
// /////////////////////////// Inner classes /////////////////////////////
/** The queue is composed of nodes. */
- private static class Node
+ protected static class Node
{
/** Next node in the singly linked list. */
Node next = null;
@@ -548,6 +549,7 @@ public class CacheEventQueue
* Waits for a specified time (waitToDieMillis) for something to come in and if no new
* events come in during that period the run method can exit and the thread is dereferenced.
*/
+ @Override
public void run()
{
AbstractCacheEvent event = null;
@@ -604,7 +606,7 @@ public class CacheEventQueue
* @author asmuts
* @created January 15, 2002
*/
- private abstract class AbstractCacheEvent
+ protected abstract class AbstractCacheEvent
implements Runnable
{
/** Number of failures encountered processing this event. */
@@ -679,7 +681,7 @@ public class CacheEventQueue
extends AbstractCacheEvent
{
/** The element to put to the listener */
- private ICacheElement ice;
+ private final ICacheElement ice;
/**
* Constructor for the PutEvent object.
@@ -698,6 +700,7 @@ public class CacheEventQueue
* <p>
* @exception IOException
*/
+ @Override
protected void doRun()
throws IOException
{
@@ -709,6 +712,7 @@ public class CacheEventQueue
* <p>
* @return Info on the key and value.
*/
+ @Override
public String toString()
{
return new StringBuffer( "PutEvent for key: " ).append( ice.getKey() ).append( " value: " )
@@ -727,7 +731,7 @@ public class CacheEventQueue
extends AbstractCacheEvent
{
/** The key to remove from the listener */
- private Serializable key;
+ private final Serializable key;
/**
* Constructor for the RemoveEvent object
@@ -746,6 +750,7 @@ public class CacheEventQueue
* <p>
* @exception IOException
*/
+ @Override
protected void doRun()
throws IOException
{
@@ -757,6 +762,7 @@ public class CacheEventQueue
* <p>
* @return Info on the key to remove.
*/
+ @Override
public String toString()
{
return new StringBuffer( "RemoveEvent for " ).append( key ).toString();
@@ -770,7 +776,7 @@ public class CacheEventQueue
* @author asmuts
* @created January 15, 2002
*/
- private class RemoveAllEvent
+ protected class RemoveAllEvent
extends AbstractCacheEvent
{
/**
@@ -778,6 +784,7 @@ public class CacheEventQueue
* <p>
* @exception IOException
*/
+ @Override
protected void doRun()
throws IOException
{
@@ -789,6 +796,7 @@ public class CacheEventQueue
* <p>
* @return The name of the event.
*/
+ @Override
public String toString()
{
return "RemoveAllEvent";
@@ -802,7 +810,7 @@ public class CacheEventQueue
* @author asmuts
* @created January 15, 2002
*/
- private class DisposeEvent
+ protected class DisposeEvent
extends AbstractCacheEvent
{
/**
@@ -810,6 +818,7 @@ public class CacheEventQueue
* <p>
* @exception IOException
*/
+ @Override
protected void doRun()
throws IOException
{
@@ -821,6 +830,7 @@ public class CacheEventQueue
* <p>
* @return The name of the event.
*/
+ @Override
public String toString()
{
return "DisposeEvent";
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -24,6 +24,7 @@ import java.util.Iterator;
import java.util.Map;
import org.apache.jcs.engine.behavior.ICache;
+import org.apache.jcs.engine.behavior.ICacheEventQueue;
/**
* Used to associates a set of [cache listener to cache event queue] for a
@@ -35,7 +36,8 @@ public class CacheListeners
public final ICache cache;
/** Map ICacheListener to ICacheEventQueue */
- public final Map eventQMap = new Hashtable();
+ public final Map<Long, ICacheEventQueue> eventQMap =
+ new Hashtable<Long, ICacheEventQueue>();
/**
* Constructs with the given cache.
@@ -50,8 +52,9 @@ public class CacheListeners
}
this.cache = cache;
}
-
+
/** @return info on the listeners */
+ @Override
public String toString()
{
StringBuffer buffer = new StringBuffer();
@@ -64,11 +67,11 @@ public class CacheListeners
{
buffer.append( "\n Event Queue Map " );
buffer.append( "\n size = " + eventQMap.size() );
- Iterator it = eventQMap.entrySet().iterator();
+ Iterator<Map.Entry<Long, ICacheEventQueue>> it = eventQMap.entrySet().iterator();
while ( it.hasNext() )
{
- buffer.append( "\n Entry: " + it.next() );
- }
+ buffer.append( "\n Entry: " + it.next() );
+ }
}
else
{
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -22,7 +22,6 @@ package org.apache.jcs.engine;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -46,7 +45,7 @@ public class CacheWatchRepairable
private ICacheObserver cacheWatch;
/** Map of cache regions. */
- private Map cacheMap = new HashMap();
+ private final Map<String, Set<ICacheListener>> cacheMap = new HashMap<String, Set<ICacheListener>>();
/**
* Replaces the underlying cache watch service and reattached all existing listeners to the new
@@ -59,14 +58,11 @@ public class CacheWatchRepairable
this.cacheWatch = cacheWatch;
synchronized ( cacheMap )
{
- for ( Iterator itr = cacheMap.entrySet().iterator(); itr.hasNext(); )
+ for (Map.Entry<String, Set<ICacheListener>> entry : cacheMap.entrySet())
{
- Map.Entry entry = (Map.Entry) itr.next();
- String cacheName = (String) entry.getKey();
- Set listenerSet = (Set) entry.getValue();
- for ( Iterator itr2 = listenerSet.iterator(); itr2.hasNext(); )
+ String cacheName = entry.getKey();
+ for (ICacheListener listener : entry.getValue())
{
- ICacheListener listener = (ICacheListener) itr2.next();
try
{
if ( log.isInfoEnabled() )
@@ -100,11 +96,10 @@ public class CacheWatchRepairable
// remote add-listener operation succeeds or fails.
synchronized ( cacheMap )
{
- Set listenerSet = (Set) cacheMap.get( cacheName );
+ Set<ICacheListener> listenerSet = cacheMap.get( cacheName );
if ( listenerSet == null )
{
- listenerSet = new HashSet();
-
+ listenerSet = new HashSet<ICacheListener>();
cacheMap.put( cacheName, listenerSet );
}
listenerSet.add( obj );
@@ -130,9 +125,8 @@ public class CacheWatchRepairable
// remote add-listener operation succeeds or fails.
synchronized ( cacheMap )
{
- for ( Iterator itr = cacheMap.values().iterator(); itr.hasNext(); )
+ for (Set<ICacheListener> listenerSet : cacheMap.values())
{
- Set listenerSet = (Set) itr.next();
listenerSet.add( obj );
}
}
@@ -140,7 +134,7 @@ public class CacheWatchRepairable
{
log.info( "Adding listener to cache watch. ICacheListener = " + obj
+ " | ICacheObserver = " + cacheWatch );
- }
+ }
cacheWatch.addCacheListener( obj );
}
@@ -162,7 +156,7 @@ public class CacheWatchRepairable
// remove-listener operation succeeds or fails.
synchronized ( cacheMap )
{
- Set listenerSet = (Set) cacheMap.get( cacheName );
+ Set<ICacheListener> listenerSet = cacheMap.get( cacheName );
if ( listenerSet != null )
{
listenerSet.remove( obj );
@@ -187,9 +181,8 @@ public class CacheWatchRepairable
// remove-listener operation succeeds or fails.
synchronized ( cacheMap )
{
- for ( Iterator itr = cacheMap.values().iterator(); itr.hasNext(); )
+ for (Set<ICacheListener> listenerSet : cacheMap.values())
{
- Set listenerSet = (Set) itr.next();
if ( log.isDebugEnabled() )
{
log.debug( "Before removing [" + obj + "] the listenerSet = " + listenerSet );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java Wed Jul 27 18:08:23 2011
@@ -25,7 +25,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Iterator;
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
@@ -88,7 +87,7 @@ public class ElementAttributes
* TODO we need to check that when an item is passed to a non-local cache that if the local
* cache had a copy with event handlers, that those handlers are used.
*/
- public transient ArrayList eventHandlers;
+ public transient ArrayList<IElementEventHandler> eventHandlers;
/**
* Constructor for the IElementAttributes object
@@ -398,7 +397,7 @@ public class ElementAttributes
// lazy here, no concurrency problems expected
if ( this.eventHandlers == null )
{
- this.eventHandlers = new ArrayList();
+ this.eventHandlers = new ArrayList<IElementEventHandler>();
}
this.eventHandlers.add( eventHandler );
}
@@ -411,16 +410,16 @@ public class ElementAttributes
* <p>
* @param eventHandlers List of IElementEventHandler objects
*/
- public void addElementEventHandlers( ArrayList eventHandlers )
+ public void addElementEventHandlers( ArrayList<IElementEventHandler> eventHandlers )
{
if ( eventHandlers == null )
{
return;
}
- for ( Iterator iter = eventHandlers.iterator(); iter.hasNext(); )
+ for (IElementEventHandler handler : eventHandlers)
{
- addElementEventHandler( (IElementEventHandler) iter.next() );
+ addElementEventHandler(handler);
}
}
@@ -429,7 +428,7 @@ public class ElementAttributes
* <p>
* @return The elementEventHandlers List of IElementEventHandler objects
*/
- public ArrayList getElementEventHandlers()
+ public ArrayList<IElementEventHandler> getElementEventHandlers()
{
return this.eventHandlers;
}
@@ -439,6 +438,7 @@ public class ElementAttributes
* <p>
* @return String info about the values.
*/
+ @Override
public String toString()
{
StringBuffer dump = new StringBuffer();
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -22,6 +22,8 @@ package org.apache.jcs.engine;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -32,11 +34,8 @@ import org.apache.jcs.engine.stats.StatE
import org.apache.jcs.engine.stats.Stats;
import org.apache.jcs.engine.stats.behavior.IStatElement;
import org.apache.jcs.engine.stats.behavior.IStats;
-import org.apache.jcs.utils.threadpool.ThreadPool;
import org.apache.jcs.utils.threadpool.ThreadPoolManager;
-import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
-
/**
* An event queue is used to propagate ordered cache events to one and only one target listener.
* <p>
@@ -54,26 +53,26 @@ public class PooledCacheEventQueue
private static final String queueType = POOLED_QUEUE_TYPE;
/** The logger */
- private static final Log log = LogFactory.getLog( PooledCacheEventQueue.class );
+ protected static final Log log = LogFactory.getLog( PooledCacheEventQueue.class );
/** time to wait for an event before snuffing the background thread
if the queue is empty. make configurable later */
private int waitToDieMillis = 10000;
/** The listener to process events */
- private ICacheListener listener;
+ protected ICacheListener listener;
/** The listener id */
private long listenerId;
/** The name of the cache */
- private String cacheName;
+ protected String cacheName;
/** Max failures before self destruction */
- private int maxFailure;
+ protected int maxFailure;
/** in milliseconds */
- private int waitBeforeRetry;
+ protected int waitBeforeRetry;
/** Has the pool been destroyed */
private boolean destroyed = true;
@@ -82,7 +81,7 @@ public class PooledCacheEventQueue
private boolean working = true;
/** The Thread Pool to execute events with. */
- private ThreadPool pool = null;
+ private ThreadPoolExecutor pool = null;
/**
* Constructor for the CacheEventQueue object
@@ -176,6 +175,7 @@ public class PooledCacheEventQueue
/**
* @return String info.
*/
+ @Override
public String toString()
{
return "CacheEventQueue [listenerId=" + listenerId + ", cacheName=" + cacheName + "]";
@@ -213,9 +213,7 @@ public class PooledCacheEventQueue
if ( !destroyed )
{
destroyed = true;
- // TODO decide whether to shutdown or interrupt
- // pool.getPool().shutdownNow();
- pool.getPool().interruptAll();
+ pool.shutdownNow();
if ( log.isInfoEnabled() )
{
log.info( "Cache event queue destroyed: " + this );
@@ -310,14 +308,7 @@ public class PooledCacheEventQueue
*/
private void put( AbstractCacheEvent event )
{
- try
- {
- pool.execute( event );
- }
- catch ( InterruptedException e )
- {
- log.error( e );
- }
+ pool.execute( event );
}
/**
@@ -336,7 +327,7 @@ public class PooledCacheEventQueue
IStats stats = new Stats();
stats.setTypeName( "Pooled Cache Event Queue" );
- ArrayList elems = new ArrayList();
+ ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
IStatElement se = null;
@@ -357,33 +348,30 @@ public class PooledCacheEventQueue
if ( pool.getQueue() != null )
{
- if ( pool.getQueue() instanceof BoundedBuffer )
- {
- BoundedBuffer bb = (BoundedBuffer) pool.getQueue();
- se = new StatElement();
- se.setName( "Queue Size" );
- se.setData( "" + bb.size() );
- elems.add( se );
-
- se = new StatElement();
- se.setName( "Queue Capacity" );
- se.setData( "" + bb.capacity() );
- elems.add( se );
- }
+ BlockingQueue<Runnable> bb = pool.getQueue();
+ se = new StatElement();
+ se.setName( "Queue Size" );
+ se.setData( "" + bb.size() );
+ elems.add( se );
+
+ se = new StatElement();
+ se.setName( "Queue Capacity" );
+ se.setData( "" + bb.remainingCapacity() );
+ elems.add( se );
}
se = new StatElement();
se.setName( "Pool Size" );
- se.setData( "" + pool.getPool().getPoolSize() );
+ se.setData( "" + pool.getPoolSize() );
elems.add( se );
se = new StatElement();
se.setName( "Maximum Pool Size" );
- se.setData( "" + pool.getPool().getMaximumPoolSize() );
+ se.setData( "" + pool.getMaximumPoolSize() );
elems.add( se );
// get an array and put them in the Stats object
- IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[elems.size()] );
+ IStatElement[] ses = elems.toArray( new StatElement[elems.size()] );
stats.setStatElements( ses );
return stats;
@@ -397,7 +385,7 @@ public class PooledCacheEventQueue
* @author asmuts
* @created January 15, 2002
*/
- private abstract class AbstractCacheEvent
+ protected abstract class AbstractCacheEvent
implements Runnable
{
/** Times failed to process */
@@ -468,7 +456,7 @@ public class PooledCacheEventQueue
extends AbstractCacheEvent
{
/** The payload */
- private ICacheElement ice;
+ private final ICacheElement ice;
/**
* Constructor for the PutEvent object
@@ -486,6 +474,7 @@ public class PooledCacheEventQueue
* <p>
* @exception IOException
*/
+ @Override
protected void doRun()
throws IOException
{
@@ -493,6 +482,7 @@ public class PooledCacheEventQueue
}
/** @return debugging info */
+ @Override
public String toString()
{
return new StringBuffer( "PutEvent for key: " ).append( ice.getKey() ).append( " value: " )
@@ -507,7 +497,7 @@ public class PooledCacheEventQueue
extends AbstractCacheEvent
{
/** The payload, the key to remove */
- private Serializable key;
+ private final Serializable key;
/**
* Constructor for the RemoveEvent object
@@ -525,6 +515,7 @@ public class PooledCacheEventQueue
* <p>
* @exception IOException
*/
+ @Override
protected void doRun()
throws IOException
{
@@ -532,6 +523,7 @@ public class PooledCacheEventQueue
}
/** @return debugging info */
+ @Override
public String toString()
{
return new StringBuffer( "RemoveEvent for " ).append( key ).toString();
@@ -541,7 +533,7 @@ public class PooledCacheEventQueue
/**
* An event that knows how to call remove all on an ICacheListener
*/
- private class RemoveAllEvent
+ protected class RemoveAllEvent
extends AbstractCacheEvent
{
/**
@@ -549,6 +541,7 @@ public class PooledCacheEventQueue
* <p>
* @exception IOException
*/
+ @Override
protected void doRun()
throws IOException
{
@@ -556,6 +549,7 @@ public class PooledCacheEventQueue
}
/** @return debugging info */
+ @Override
public String toString()
{
return "RemoveAllEvent";
@@ -565,7 +559,7 @@ public class PooledCacheEventQueue
/**
* The Event put into the queue for dispose requests.
*/
- private class DisposeEvent
+ protected class DisposeEvent
extends AbstractCacheEvent
{
/**
@@ -573,6 +567,7 @@ public class PooledCacheEventQueue
* <p>
* @exception IOException
*/
+ @Override
protected void doRun()
throws IOException
{
@@ -580,6 +575,7 @@ public class PooledCacheEventQueue
}
/** @return debugging info */
+ @Override
public String toString()
{
return "DisposeEvent";
@@ -612,19 +608,11 @@ public class PooledCacheEventQueue
{
if ( pool.getQueue() == null )
{
- return pool.getQueue().peek() == null;
+ return true;
}
else
{
- if ( pool.getQueue() instanceof BoundedBuffer )
- {
- BoundedBuffer bb = (BoundedBuffer) pool.getQueue();
- return bb.size() == 0;
- }
- else
- {
- return true;
- }
+ return pool.getQueue().size() == 0;
}
}
@@ -638,19 +626,11 @@ public class PooledCacheEventQueue
{
if ( pool.getQueue() == null )
{
- return pool.getQueue().peek() == null ? 0 : 1;
+ return 0;
}
else
{
- if ( pool.getQueue() instanceof BoundedBuffer )
- {
- BoundedBuffer bb = (BoundedBuffer) pool.getQueue();
- return bb.size();
- }
- else
- {
- return 1;
- }
+ return pool.getQueue().size();
}
}
}
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -78,9 +78,9 @@ public class ZombieCacheService
* @param keys
* @return Collections.EMPTY_MAP
*/
- public Map getMultiple( String cacheName, Set keys )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
{
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
/**
@@ -90,9 +90,9 @@ public class ZombieCacheService
* @param pattern
* @return Collections.EMPTY_MAP
*/
- public Map getMatching( String cacheName, String pattern )
+ public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
{
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
/**
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -53,14 +53,14 @@ public class ZombieCacheServiceNonLocal
private int maxQueueSize = 0;
/** The queue */
- private BoundedQueue queue;
+ private final BoundedQueue<ZombieEvent> queue;
/**
* Default.
*/
public ZombieCacheServiceNonLocal()
{
- queue = new BoundedQueue( 0 );
+ queue = new BoundedQueue<ZombieEvent>( 0 );
}
/**
@@ -71,7 +71,7 @@ public class ZombieCacheServiceNonLocal
public ZombieCacheServiceNonLocal( int maxQueueSize )
{
this.maxQueueSize = maxQueueSize;
- queue = new BoundedQueue( maxQueueSize );
+ queue = new BoundedQueue<ZombieEvent>( maxQueueSize );
}
/**
@@ -161,10 +161,10 @@ public class ZombieCacheServiceNonLocal
* @return empty map
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern, long requesterId )
+ public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
throws IOException
{
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
/**
@@ -173,9 +173,9 @@ public class ZombieCacheServiceNonLocal
* @param requesterId - identity of the caller
* @return an empty map. zombies have no internal data
*/
- public Map getMultiple( String cacheName, Set keys, long requesterId )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
{
- return new HashMap();
+ return new HashMap<Serializable, ICacheElement>();
}
/**
@@ -185,9 +185,9 @@ public class ZombieCacheServiceNonLocal
* @param groupName - group name
* @return empty set
*/
- public Set getGroupKeys( String cacheName, String groupName )
+ public Set<Serializable> getGroupKeys( String cacheName, String groupName )
{
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
/**
@@ -210,7 +210,7 @@ public class ZombieCacheServiceNonLocal
cnt++;
// for each item, call the appropriate service method
- ZombieEvent event = (ZombieEvent) queue.take();
+ ZombieEvent event = queue.take();
if ( event instanceof PutEvent )
{
@@ -237,7 +237,7 @@ public class ZombieCacheServiceNonLocal
/**
* Base of the other events.
*/
- private abstract class ZombieEvent
+ protected abstract class ZombieEvent
{
/** The name of the region. */
String cacheName;
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -62,7 +62,7 @@ public interface ICache
* @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
* @throws IOException
*/
- Map getMultiple( Set keys )
+ Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
throws IOException;
/**
@@ -76,7 +76,7 @@ public interface ICache
* @return a map of Serializable key to ICacheElement element, or an empty map if there is no data matching the pattern.
* @throws IOException
*/
- Map getMatching( String pattern )
+ Map<Serializable, ICacheElement> getMatching(String pattern)
throws IOException;
/**
@@ -131,9 +131,9 @@ public interface ICache
* @return usually the region name.
*/
String getCacheName();
-
+
/**
- * Sets the key matcher used by get matching.
+ * Sets the key matcher used by get matching.
* <p>
* @param 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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -21,19 +21,17 @@ package org.apache.jcs.engine.behavior;
import java.io.Serializable;
-import org.apache.jcs.engine.behavior.IElementAttributes;
-
/**
* Every item is the cache is wrapped in an ICacheElement. This contains
* information about the element: the region name, the key, the value, and the
* element attributes.
* <p>
- * The element attributes have lots of useful information about each elment,
+ * The element attributes have lots of useful information about each element,
* such as when they were created, how long they have to live, and if they are
* allowed to be spooled, etc.
*
*/
-public interface ICacheElement
+public interface ICacheElement /* TODO: Should be generic */
extends Serializable
{
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -67,7 +67,7 @@ public interface ICacheService
* @throws ObjectNotFoundException
* @throws IOException
*/
- Map getMultiple( String cacheName, Set keys )
+ Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
throws ObjectNotFoundException, IOException;
/**
@@ -79,7 +79,7 @@ public interface ICacheService
* data in cache matching the pattern.
* @throws IOException
*/
- Map getMatching( String cacheName, String pattern )
+ Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
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=1151575&r1=1151574&r2=1151575&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 Jul 27 18:08:23 2011
@@ -90,7 +90,7 @@ public interface ICacheServiceNonLocal
* data in cache for any of these keys
* @throws IOException
*/
- Map getMultiple( String cacheName, Set keys, long requesterId )
+ Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
throws IOException;
/**
@@ -103,7 +103,7 @@ public interface ICacheServiceNonLocal
* data in cache matching the pattern.
* @throws IOException
*/
- Map getMatching( String cacheName, String pattern, long requesterId )
+ Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
throws IOException;
/**
@@ -114,6 +114,6 @@ public interface ICacheServiceNonLocal
* @return A Set of keys
* @throws IOException
*/
- Set getGroupKeys( String cacheName, String groupName )
+ Set<Serializable> getGroupKeys( String cacheName, String groupName )
throws IOException;
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java?rev=1151575&r1=1151574&r2=1151575&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java Wed Jul 27 18:08:23 2011
@@ -188,12 +188,12 @@ public interface IElementAttributes
* lost if the item goes to disk.
* @return The elementEventHandlers value, null if there are none
*/
- public ArrayList getElementEventHandlers();
+ public ArrayList<IElementEventHandler> getElementEventHandlers();
/**
* Sets the eventHandlers of the IElementAttributes object
* @param eventHandlers value
*/
- public void addElementEventHandlers( ArrayList eventHandlers );
+ public void addElementEventHandlers( ArrayList<IElementEventHandler> eventHandlers );
}