You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2019/05/29 12:19:00 UTC
svn commit: r1860336 [3/7] - in /commons/proper/jcs:
branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/util/
branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/value/
branches/generics-interface/src/java/org/apache/...
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java Wed May 29 12:18:56 2019
@@ -71,7 +71,7 @@ public abstract class AbstractRemoteCach
this.remoteCacheAttributes = rca;
setCacheEventLogger( cacheEventLogger );
setElementSerializer( elementSerializer );
- this.noWaits = new ArrayList<>(noWaits);
+ this.noWaits = new ArrayList<RemoteCacheNoWait<K,V>>(noWaits);
for (RemoteCacheNoWait<K,V> nw : this.noWaits)
{
// FIXME: This cast is very brave. Remove this.
@@ -219,7 +219,7 @@ public abstract class AbstractRemoteCach
@Override
public Set<K> getKeySet() throws IOException
{
- HashSet<K> allKeys = new HashSet<>();
+ HashSet<K> allKeys = new HashSet<K>();
for (RemoteCacheNoWait<K, V> nw : noWaits)
{
if ( nw != null )
@@ -407,11 +407,11 @@ public abstract class AbstractRemoteCach
IStats stats = new Stats();
stats.setTypeName( "Remote Cache No Wait Facade" );
- ArrayList<IStatElement<?>> elems = new ArrayList<>();
+ ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
if ( noWaits != null )
{
- elems.add(new StatElement<>( "Number of No Waits", Integer.valueOf(noWaits.size()) ) );
+ elems.add(new StatElement<Integer>( "Number of No Waits", Integer.valueOf(noWaits.size()) ) );
for ( RemoteCacheNoWait<K, V> rcnw : noWaits )
{
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCache.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCache.java Wed May 29 12:18:56 2019
@@ -83,10 +83,10 @@ public class RemoteCache<K, V>
IStats stats = new Stats();
stats.setTypeName( "Remote Cache" );
- ArrayList<IStatElement<?>> elems = new ArrayList<>();
+ ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
- elems.add(new StatElement<>( "Remote Host:Port", getIPAddressForService() ) );
- elems.add(new StatElement<>( "Remote Type", this.getRemoteCacheAttributes().getRemoteTypeName() ) );
+ elems.add(new StatElement<String>( "Remote Host:Port", getIPAddressForService() ) );
+ elems.add(new StatElement<String>( "Remote Type", this.getRemoteCacheAttributes().getRemoteTypeName() ) );
// if ( this.getRemoteCacheAttributes().getRemoteType() == RemoteType.CLUSTER )
// {
@@ -144,7 +144,7 @@ public class RemoteCache<K, V>
if ( getRemoteCacheService() == null || !( getRemoteCacheService() instanceof ZombieCacheServiceNonLocal ) )
{
// TODO make configurable
- setRemoteCacheService( new ZombieCacheServiceNonLocal<>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
+ setRemoteCacheService( new ZombieCacheServiceNonLocal<K, V>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
}
// may want to flush if region specifies
// Notify the cache monitor about the error, and kick off the recovery
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java Wed May 29 12:18:56 2019
@@ -74,13 +74,13 @@ public class RemoteCacheFactory
{
RemoteCacheAttributes rca = (RemoteCacheAttributes) iaca;
- ArrayList<RemoteCacheNoWait<K,V>> noWaits = new ArrayList<>();
+ ArrayList<RemoteCacheNoWait<K,V>> noWaits = new ArrayList<RemoteCacheNoWait<K,V>>();
switch (rca.getRemoteType())
{
case LOCAL:
// a list to be turned into an array of failover server information
- ArrayList<RemoteLocation> failovers = new ArrayList<>();
+ ArrayList<RemoteLocation> failovers = new ArrayList<RemoteLocation>();
// not necessary if a failover list is defined
// REGISTER PRIMARY LISTENER
@@ -152,7 +152,7 @@ public class RemoteCacheFactory
}
RemoteCacheNoWaitFacade<K, V> rcnwf =
- new RemoteCacheNoWaitFacade<>(noWaits, rca, cacheEventLogger, elementSerializer, this );
+ new RemoteCacheNoWaitFacade<K, V>(noWaits, rca, cacheEventLogger, elementSerializer, this );
return rcnwf;
}
@@ -233,7 +233,7 @@ public class RemoteCacheFactory
{
super.initialize();
- managers = new ConcurrentHashMap<>();
+ managers = new ConcurrentHashMap<RemoteLocation, RemoteCacheManager>();
managerLock = new ReentrantLock();
monitor = new RemoteCacheMonitor();
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java Wed May 29 12:18:56 2019
@@ -54,7 +54,7 @@ public class RemoteCacheManager
/** Contains instances of RemoteCacheNoWait managed by a RemoteCacheManager instance. */
private final ConcurrentMap<String, RemoteCacheNoWait<?, ?>> caches =
- new ConcurrentHashMap<>();
+ new ConcurrentHashMap<String, RemoteCacheNoWait<?, ?>>();
/** The event logger. */
private final ICacheEventLogger cacheEventLogger;
@@ -151,7 +151,7 @@ public class RemoteCacheManager
// Failed to connect to the remote server.
// Configure this RemoteCacheManager instance to use the "zombie"
// services.
- this.remoteService = new ZombieCacheServiceNonLocal<>();
+ this.remoteService = new ZombieCacheServiceNonLocal<String, String>();
remoteWatch.setCacheWatch( new ZombieCacheWatch() );
throw new IOException( "Problem finding server at [" + registry + "]", ex );
}
@@ -268,7 +268,7 @@ public class RemoteCacheManager
RemoteCacheListener<K, V> listener = null;
try
{
- listener = new RemoteCacheListener<>( cattr, cacheMgr, elementSerializer );
+ listener = new RemoteCacheListener<K, V>( cattr, cacheMgr, elementSerializer );
addRemoteCacheListener( cattr, listener );
}
catch ( IOException ioe )
@@ -283,11 +283,11 @@ public class RemoteCacheManager
}
IRemoteCacheClient<K, V> remoteCacheClient =
- new RemoteCache<>( cattr, (ICacheServiceNonLocal<K, V>) remoteService, listener, monitor );
+ new RemoteCache<K, V>( cattr, (ICacheServiceNonLocal<K, V>) remoteService, listener, monitor );
remoteCacheClient.setCacheEventLogger( cacheEventLogger );
remoteCacheClient.setElementSerializer( elementSerializer );
- remoteCacheNoWait = new RemoteCacheNoWait<>( remoteCacheClient );
+ remoteCacheNoWait = new RemoteCacheNoWait<K, V>( remoteCacheClient );
remoteCacheNoWait.setCacheEventLogger( cacheEventLogger );
remoteCacheNoWait.setElementSerializer( elementSerializer );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java Wed May 29 12:18:56 2019
@@ -44,7 +44,7 @@ public class RemoteCacheMonitor extends
public RemoteCacheMonitor()
{
super("JCS-RemoteCacheMonitor");
- this.managers = new ConcurrentHashMap<>();
+ this.managers = new ConcurrentHashMap<RemoteCacheManager, RemoteCacheManager>();
setIdlePeriod(30000L);
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java Wed May 29 12:18:56 2019
@@ -113,9 +113,9 @@ public class RemoteCacheNoWait<K, V>
*/
private ICacheEventQueue<K, V> createCacheEventQueue( IRemoteCacheClient<K, V> client )
{
- CacheEventQueueFactory<K, V> factory = new CacheEventQueueFactory<>();
+ CacheEventQueueFactory<K, V> factory = new CacheEventQueueFactory<K, V>();
ICacheEventQueue<K, V> ceq = factory.createCacheEventQueue(
- new CacheAdaptor<>( client ),
+ new CacheAdaptor<K, V>( client ),
client.getListenerId(),
client.getCacheName(),
client.getAuxiliaryCacheAttributes().getEventQueuePoolName(),
@@ -282,7 +282,7 @@ public class RemoteCacheNoWait<K, V>
throw ex;
}
- return new HashMap<>();
+ return new HashMap<K, ICacheElement<K, V>>();
}
/**
@@ -498,9 +498,9 @@ public class RemoteCacheNoWait<K, V>
IStats stats = new Stats();
stats.setTypeName( "Remote Cache No Wait" );
- ArrayList<IStatElement<?>> elems = new ArrayList<>();
+ ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
- elems.add(new StatElement<>( "Status", getStatus() ) );
+ elems.add(new StatElement<CacheStatus>( "Status", getStatus() ) );
// get the stats from the cache queue too
IStats cStats = this.remoteCacheClient.getStatistics();
@@ -513,11 +513,11 @@ public class RemoteCacheNoWait<K, V>
IStats eqStats = this.cacheEventQueue.getStatistics();
elems.addAll(eqStats.getStatElements());
- elems.add(new StatElement<>( "Get Count", Integer.valueOf(this.getCount) ) );
- elems.add(new StatElement<>( "GetMatching Count", Integer.valueOf(this.getMatchingCount) ) );
- elems.add(new StatElement<>( "GetMultiple Count", Integer.valueOf(this.getMultipleCount) ) );
- elems.add(new StatElement<>( "Remove Count", Integer.valueOf(this.removeCount) ) );
- elems.add(new StatElement<>( "Put Count", Integer.valueOf(this.putCount) ) );
+ elems.add(new StatElement<Integer>( "Get Count", Integer.valueOf(this.getCount) ) );
+ elems.add(new StatElement<Integer>( "GetMatching Count", Integer.valueOf(this.getMatchingCount) ) );
+ elems.add(new StatElement<Integer>( "GetMultiple Count", Integer.valueOf(this.getMultipleCount) ) );
+ elems.add(new StatElement<Integer>( "Remove Count", Integer.valueOf(this.removeCount) ) );
+ elems.add(new StatElement<Integer>( "Put Count", Integer.valueOf(this.putCount) ) );
stats.setStatElements( elems );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java Wed May 29 12:18:56 2019
@@ -83,7 +83,7 @@ public class RemoteCacheNoWaitFacade<K,
if ( rcnw.getStatus() == CacheStatus.ERROR )
{
// start failover, primary recovery process
- RemoteCacheFailoverRunner<K, V> runner = new RemoteCacheFailoverRunner<>( this, this.cacheFactory );
+ RemoteCacheFailoverRunner<K, V> runner = new RemoteCacheFailoverRunner<K, V>( this, this.cacheFactory );
runner.setDaemon( true );
runner.start();
runner.notifyError();
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCache.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCache.java Wed May 29 12:18:56 2019
@@ -82,7 +82,7 @@ public class RemoteHttpCache<K, V>
logError( cacheName, "", message );
log.error( message, ex );
- setRemoteCacheService( new ZombieCacheServiceNonLocal<>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
+ setRemoteCacheService( new ZombieCacheServiceNonLocal<K, V>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
monitor.notifyError( this );
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java Wed May 29 12:18:56 2019
@@ -70,16 +70,16 @@ public class RemoteHttpCacheFactory
// TODO, use the configured value.
rca.setRemoteType( RemoteType.LOCAL );
- RemoteHttpClientListener<K, V> listener = new RemoteHttpClientListener<>( rca, cacheMgr, elementSerializer );
+ RemoteHttpClientListener<K, V> listener = new RemoteHttpClientListener<K, V>( rca, cacheMgr, elementSerializer );
IRemoteHttpCacheClient<K, V> remoteService = createRemoteHttpCacheClientForAttributes(rca);
IRemoteCacheClient<K, V> remoteCacheClient =
- new RemoteHttpCache<>( rca, remoteService, listener, monitor );
+ new RemoteHttpCache<K, V>( rca, remoteService, listener, monitor );
remoteCacheClient.setCacheEventLogger( cacheEventLogger );
remoteCacheClient.setElementSerializer( elementSerializer );
- RemoteCacheNoWait<K, V> remoteCacheNoWait = new RemoteCacheNoWait<>( remoteCacheClient );
+ RemoteCacheNoWait<K, V> remoteCacheNoWait = new RemoteCacheNoWait<K, V>( remoteCacheClient );
remoteCacheNoWait.setCacheEventLogger( cacheEventLogger );
remoteCacheNoWait.setElementSerializer( elementSerializer );
@@ -104,7 +104,7 @@ public class RemoteHttpCacheFactory
{
log.info( "Creating the default client for " + cattr.getCacheName());
}
- remoteService = new RemoteHttpCacheClient<>( );
+ remoteService = new RemoteHttpCacheClient<K, V>( );
}
remoteService.initialize( cattr );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java Wed May 29 12:18:56 2019
@@ -49,7 +49,7 @@ public class RemoteHttpCacheMonitor exte
{
super("JCS-RemoteHttpCacheMonitor");
this.factory = factory;
- this.remoteHttpCaches = new ConcurrentHashMap<>();
+ this.remoteHttpCaches = new ConcurrentHashMap<RemoteHttpCache<?, ?>, RemoteHttpCache<?, ?>>();
setIdlePeriod(3000L);
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java Wed May 29 12:18:56 2019
@@ -495,7 +495,7 @@ public abstract class AbstractRemoteCach
{
if ( cacheEventLogger == null )
{
- return new CacheEvent<>();
+ return new CacheEvent<ICacheElement<K, V>>();
}
String ipAddress = getExtraInfoForRequesterId( requesterId );
return cacheEventLogger.createICacheEvent( getEventLogSourceName(), item.getCacheName(), eventName, ipAddress,
@@ -515,7 +515,7 @@ public abstract class AbstractRemoteCach
{
if ( cacheEventLogger == null )
{
- return new CacheEvent<>();
+ return new CacheEvent<T>();
}
String ipAddress = getExtraInfoForRequesterId( requesterId );
return cacheEventLogger.createICacheEvent( getEventLogSourceName(), cacheName, eventName, ipAddress, key );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java Wed May 29 12:18:56 2019
@@ -214,7 +214,7 @@ public class RemoteHttpCacheServlet
*/
protected RemoteCacheResponse<Object> processRequest( RemoteCacheRequest<Serializable, Serializable> request )
{
- RemoteCacheResponse<Object> response = new RemoteCacheResponse<>();
+ RemoteCacheResponse<Object> response = new RemoteCacheResponse<Object>();
if ( request == null )
{
@@ -239,7 +239,7 @@ public class RemoteHttpCacheServlet
remoteCacheService.getMultiple( request.getCacheName(), request.getKeySet(), request.getRequesterId() );
if ( elementMap != null )
{
- Map<Serializable, ICacheElement<Serializable, Serializable>> map = new HashMap<>();
+ Map<Serializable, ICacheElement<Serializable, Serializable>> map = new HashMap<Serializable, ICacheElement<Serializable, Serializable>>();
map.putAll(elementMap);
response.setPayload(map);
}
@@ -249,7 +249,7 @@ public class RemoteHttpCacheServlet
remoteCacheService.getMatching( request.getCacheName(), request.getPattern(), request.getRequesterId() );
if ( elementMapMatching != null )
{
- Map<Serializable, ICacheElement<Serializable, Serializable>> map = new HashMap<>();
+ Map<Serializable, ICacheElement<Serializable, Serializable>> map = new HashMap<Serializable, ICacheElement<Serializable, Serializable>>();
map.putAll(elementMapMatching);
response.setPayload(map);
}
@@ -304,7 +304,7 @@ public class RemoteHttpCacheServlet
ICacheEventLogger cacheEventLogger = configureCacheEventLogger( props );
RemoteHttpCacheServerAttributes attributes = configureRemoteHttpCacheServerAttributes( props );
- RemoteHttpCacheService<K, V> service = new RemoteHttpCacheService<>( cacheManager, attributes, cacheEventLogger );
+ RemoteHttpCacheService<K, V> service = new RemoteHttpCacheService<K, V>( cacheManager, attributes, cacheEventLogger );
if ( log.isInfoEnabled() )
{
log.info( "Created new RemoteHttpCacheService " + service );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java Wed May 29 12:18:56 2019
@@ -27,6 +27,7 @@ import java.rmi.server.RMISocketFactory;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.Unreferenced;
import java.util.Collections;
+import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -86,20 +87,20 @@ public class RemoteCacheServer<K, V>
/** Maps cache name to CacheListeners object. association of listeners (regions). */
private final transient ConcurrentMap<String, CacheListeners<K, V>> cacheListenersMap =
- new ConcurrentHashMap<>();
+ new ConcurrentHashMap<String, CacheListeners<K, V>>();
/** maps cluster listeners to regions. */
private final transient ConcurrentMap<String, CacheListeners<K, V>> clusterListenersMap =
- new ConcurrentHashMap<>();
+ new ConcurrentHashMap<String, CacheListeners<K, V>>();
/** The central hub */
private transient CompositeCacheManager cacheManager;
/** relates listener id with a type */
- private final ConcurrentMap<Long, RemoteType> idTypeMap = new ConcurrentHashMap<>();
+ private final ConcurrentMap<Long, RemoteType> idTypeMap = new ConcurrentHashMap<Long, RemoteType>();
/** relates listener id with an ip address */
- private final ConcurrentMap<Long, String> idIPMap = new ConcurrentHashMap<>();
+ private final ConcurrentMap<Long, String> idIPMap = new ConcurrentHashMap<Long, String>();
/** Used to get the next listener id. */
private final int[] listenerId = new int[1];
@@ -171,7 +172,7 @@ public class RemoteCacheServer<K, V>
{
String name = list[i];
CompositeCache<K, V> cache = cacheManager.getCache( name );
- cacheListenersMap.put( name, new CacheListeners<>( cache ) );
+ cacheListenersMap.put( name, new CacheListeners<K, V>( cache ) );
}
}
@@ -1152,7 +1153,7 @@ public class RemoteCacheServer<K, V>
{
CacheListeners<K, V> cacheListeners = cacheListenersMap.computeIfAbsent(cacheName, key -> {
CompositeCache<K, V> cache = cacheManager.getCache(key);
- return new CacheListeners<>( cache );
+ return new CacheListeners<K, V>( cache );
});
return cacheListeners;
@@ -1169,7 +1170,7 @@ public class RemoteCacheServer<K, V>
{
CacheListeners<K, V> cacheListeners = clusterListenersMap.computeIfAbsent(cacheName, key -> {
CompositeCache<K, V> cache = cacheManager.getCache( cacheName );
- return new CacheListeners<>( cache );
+ return new CacheListeners<K, V>( cache );
});
return cacheListeners;
@@ -1233,11 +1234,21 @@ public class RemoteCacheServer<K, V>
{
synchronized ( eventQMap )
{
- // this does not care if the q is alive (i.e. if
- // there are active threads; it cares if the queue
- // is working -- if it has not encountered errors
- // above the failure threshold
- eventQMap.entrySet().removeIf(e -> !e.getValue().isWorking());
+ for (Iterator<Map.Entry<Long, ICacheEventQueue<KK, VV>>> itr = eventQMap.entrySet().iterator(); itr.hasNext(); )
+ {
+ Map.Entry<Long, ICacheEventQueue<KK, VV>> e = itr.next();
+ ICacheEventQueue<KK, VV> q = e.getValue();
+
+ // this does not care if the q is alive (i.e. if
+ // there are active threads; it cares if the queue
+ // is working -- if it has not encountered errors
+ // above the failure threshold
+ if ( !q.isWorking() )
+ {
+ itr.remove();
+ log.warn( "Cache event queue " + q + " is not working and removed from cache server." );
+ }
+ }
}
}
@@ -1342,7 +1353,7 @@ public class RemoteCacheServer<K, V>
}
}
- CacheEventQueueFactory<KK, VV> fact = new CacheEventQueueFactory<>();
+ CacheEventQueueFactory<KK, VV> fact = new CacheEventQueueFactory<KK, VV>();
ICacheEventQueue<KK, VV> q = fact.createCacheEventQueue( listener, id, cacheName, remoteCacheServerAttributes
.getEventQueuePoolName(), remoteCacheServerAttributes.getEventQueueType() );
@@ -1594,7 +1605,7 @@ public class RemoteCacheServer<K, V>
{
if ( cacheEventLogger == null )
{
- return new CacheEvent<>();
+ return new CacheEvent<ICacheElement<K, V>>();
}
String ipAddress = getExtraInfoForRequesterId( requesterId );
return cacheEventLogger
@@ -1614,7 +1625,7 @@ public class RemoteCacheServer<K, V>
{
if ( cacheEventLogger == null )
{
- return new CacheEvent<>();
+ return new CacheEvent<T>();
}
String ipAddress = getExtraInfoForRequesterId( requesterId );
return cacheEventLogger.createICacheEvent( "RemoteCacheServer", cacheName, eventName, ipAddress, key );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java Wed May 29 12:18:56 2019
@@ -139,11 +139,11 @@ public class RemoteCacheServerFactory
// CREATE SERVER
if ( customRMISocketFactory != null )
{
- remoteCacheServer = new RemoteCacheServer<>( rcsa, props, customRMISocketFactory );
+ remoteCacheServer = new RemoteCacheServer<Serializable, Serializable>( rcsa, props, customRMISocketFactory );
}
else
{
- remoteCacheServer = new RemoteCacheServer<>( rcsa, props );
+ remoteCacheServer = new RemoteCacheServer<Serializable, Serializable>( rcsa, props );
}
remoteCacheServer.setCacheEventLogger( cacheEventLogger );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java Wed May 29 12:18:56 2019
@@ -45,7 +45,7 @@ public class RemoteCacheRequestFactory
*/
private static <K, V> RemoteCacheRequest<K, V> createRequest(String cacheName, RemoteRequestType requestType, long requesterId)
{
- RemoteCacheRequest<K, V> request = new RemoteCacheRequest<>();
+ RemoteCacheRequest<K, V> request = new RemoteCacheRequest<K, V>();
request.setCacheName( cacheName );
request.setRequestType( requestType );
request.setRequesterId( requesterId );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheEventQueueFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheEventQueueFactory.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheEventQueueFactory.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheEventQueueFactory.java Wed May 29 12:18:56 2019
@@ -75,11 +75,11 @@ public class CacheEventQueueFactory<K, V
ICacheEventQueue<K, V> eventQueue = null;
if ( poolType == null || ICacheEventQueue.QueueType.SINGLE == poolType )
{
- eventQueue = new CacheEventQueue<>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
+ eventQueue = new CacheEventQueue<K, V>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
}
else if ( ICacheEventQueue.QueueType.POOLED == poolType )
{
- eventQueue = new PooledCacheEventQueue<>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry,
+ eventQueue = new PooledCacheEventQueue<K, V>( listener, listenerId, cacheName, maxFailure, waitBeforeRetry,
threadPoolName );
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheListeners.java Wed May 29 12:18:56 2019
@@ -1,5 +1,26 @@
package org.apache.commons.jcs.engine;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Iterator;
+import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -17,7 +38,7 @@ public class CacheListeners<K, V>
/** Map ICacheListener to ICacheEventQueue */
public final ConcurrentMap<Long, ICacheEventQueue<K, V>> eventQMap =
- new ConcurrentHashMap<>();
+ new ConcurrentHashMap<Long, ICacheEventQueue<K, V>>();
/**
* Constructs with the given cache.
@@ -47,9 +68,11 @@ public class CacheListeners<K, V>
{
buffer.append( "\n Event Queue Map " );
buffer.append( "\n size = " + eventQMap.size() );
- eventQMap.forEach((key, value)
- -> buffer.append( "\n Entry: key: ").append(key)
- .append(", value: ").append(value));
+ Iterator<Map.Entry<Long, ICacheEventQueue<K, V>>> it = eventQMap.entrySet().iterator();
+ while ( it.hasNext() )
+ {
+ buffer.append( "\n Entry: " + it.next() );
+ }
}
else
{
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheWatchRepairable.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheWatchRepairable.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheWatchRepairable.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/CacheWatchRepairable.java Wed May 29 12:18:56 2019
@@ -47,7 +47,7 @@ public class CacheWatchRepairable
/** Map of cache regions. */
private final ConcurrentMap<String, Set<ICacheListener<?, ?>>> cacheMap =
- new ConcurrentHashMap<>();
+ new ConcurrentHashMap<String, Set<ICacheListener<?, ?>>>();
/**
* Replaces the underlying cache watch service and re-attaches all existing listeners to the new
@@ -95,7 +95,7 @@ public class CacheWatchRepairable
// Record the added cache listener locally, regardless of whether the
// remote add-listener operation succeeds or fails.
Set<ICacheListener<?, ?>> listenerSet = cacheMap.computeIfAbsent(cacheName, key -> {
- return new CopyOnWriteArraySet<>();
+ return new CopyOnWriteArraySet<ICacheListener<?, ?>>();
});
listenerSet.add( obj );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ElementAttributes.java Wed May 29 12:18:56 2019
@@ -160,8 +160,7 @@ public class ElementAttributes
}
/**
- * Size in bytes. This is not used except in the admin pages. It will be 0 by default
- * and is only updated when the element is serialized.
+ * Size in bytes. This is not used except in the admin pages. It will be -1 by default.
* <p>
* @param size The new size value
*/
@@ -365,7 +364,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 );
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/PooledCacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/PooledCacheEventQueue.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/PooledCacheEventQueue.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/PooledCacheEventQueue.java Wed May 29 12:18:56 2019
@@ -145,15 +145,15 @@ public class PooledCacheEventQueue<K, V>
IStats stats = new Stats();
stats.setTypeName( "Pooled Cache Event Queue" );
- ArrayList<IStatElement<?>> elems = new ArrayList<>();
+ ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
- elems.add(new StatElement<>( "Working", Boolean.valueOf(isWorking()) ) );
- elems.add(new StatElement<>( "Empty", Boolean.valueOf(this.isEmpty()) ) );
+ elems.add(new StatElement<Boolean>( "Working", Boolean.valueOf(isWorking()) ) );
+ elems.add(new StatElement<Boolean>( "Empty", Boolean.valueOf(this.isEmpty()) ) );
if ( queue != null )
{
- elems.add(new StatElement<>( "Queue Size", Integer.valueOf(queue.size()) ) );
- elems.add(new StatElement<>( "Queue Capacity", Integer.valueOf(queue.remainingCapacity()) ) );
+ elems.add(new StatElement<Integer>( "Queue Size", Integer.valueOf(queue.size()) ) );
+ elems.add(new StatElement<Integer>( "Queue Capacity", Integer.valueOf(queue.remainingCapacity()) ) );
}
stats.setStatElements( elems );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java Wed May 29 12:18:56 2019
@@ -59,7 +59,7 @@ public class ZombieCacheServiceNonLocal<
*/
public ZombieCacheServiceNonLocal()
{
- queue = new ConcurrentLinkedQueue<>();
+ queue = new ConcurrentLinkedQueue<ZombieEvent>();
}
/**
@@ -70,7 +70,7 @@ public class ZombieCacheServiceNonLocal<
public ZombieCacheServiceNonLocal( int maxQueueSize )
{
this.maxQueueSize = maxQueueSize;
- queue = new ConcurrentLinkedQueue<>();
+ queue = new ConcurrentLinkedQueue<ZombieEvent>();
}
/**
@@ -103,7 +103,7 @@ public class ZombieCacheServiceNonLocal<
{
if ( maxQueueSize > 0 )
{
- PutEvent<K, V> event = new PutEvent<>( item, listenerId );
+ PutEvent<K, V> event = new PutEvent<K, V>( item, listenerId );
addQueue( event );
}
// Zombies have no inner life
@@ -121,7 +121,7 @@ public class ZombieCacheServiceNonLocal<
{
if ( maxQueueSize > 0 )
{
- RemoveEvent<K> event = new RemoveEvent<>( cacheName, key, listenerId );
+ RemoveEvent<K> event = new RemoveEvent<K>( cacheName, key, listenerId );
addQueue( event );
}
// Zombies have no inner life
@@ -186,7 +186,7 @@ public class ZombieCacheServiceNonLocal<
@Override
public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
{
- return new HashMap<>();
+ return new HashMap<K, ICacheElement<K, V>>();
}
/**
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/IElementAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/IElementAttributes.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/IElementAttributes.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/IElementAttributes.java Wed May 29 12:18:56 2019
@@ -60,8 +60,7 @@ public interface IElementAttributes exte
void setIdleTime( long idle );
/**
- * Size in bytes. This is not used except in the admin pages. It will be 0 by default
- * and is only updated when the element is serialized.
+ * Size in bytes. This is not used except in the admin pages. It will be -1 by default.
* <p>
* @param size The new size value
*/
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java Wed May 29 12:18:56 2019
@@ -23,13 +23,14 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -95,22 +96,22 @@ public class CompositeCache<K, V>
private ICompositeCacheAttributes cacheAttr;
/** How many times update was called. */
- private AtomicLong updateCount;
+ private AtomicInteger updateCount;
/** How many times remove was called. */
- private AtomicLong removeCount;
+ private AtomicInteger removeCount;
/** Memory cache hit count */
- private AtomicLong hitCountRam;
+ private AtomicInteger hitCountRam;
/** Auxiliary cache hit count (number of times found in ANY auxiliary) */
- private AtomicLong hitCountAux;
+ private AtomicInteger hitCountAux;
/** Count of misses where element was not found. */
- private AtomicLong missCountNotFound;
+ private AtomicInteger missCountNotFound;
/** Count of misses where element was expired. */
- private AtomicLong missCountExpired;
+ private AtomicInteger missCountExpired;
/** Cache manager. */
private CompositeCacheManager cacheManager = null;
@@ -122,7 +123,7 @@ public class CompositeCache<K, V>
private IMemoryCache<K, V> memCache;
/** Key matcher used by the getMatching API */
- private IKeyMatcher<K> keyMatcher = new KeyMatcherPatternImpl<>();
+ private IKeyMatcher<K> keyMatcher = new KeyMatcherPatternImpl<K>();
private ScheduledFuture<?> future;
@@ -137,12 +138,12 @@ public class CompositeCache<K, V>
this.attr = attr;
this.cacheAttr = cattr;
this.alive = new AtomicBoolean(true);
- this.updateCount = new AtomicLong(0);
- this.removeCount = new AtomicLong(0);
- this.hitCountRam = new AtomicLong(0);
- this.hitCountAux = new AtomicLong(0);
- this.missCountNotFound = new AtomicLong(0);
- this.missCountExpired = new AtomicLong(0);
+ this.updateCount = new AtomicInteger(0);
+ this.removeCount = new AtomicInteger(0);
+ this.hitCountRam = new AtomicInteger(0);
+ this.hitCountAux = new AtomicInteger(0);
+ this.missCountNotFound = new AtomicInteger(0);
+ this.missCountExpired = new AtomicInteger(0);
createMemoryCache(cattr);
@@ -181,7 +182,7 @@ public class CompositeCache<K, V>
if (cacheAttr.isUseMemoryShrinker())
{
future = scheduledExecutor.scheduleAtFixedRate(
- new ShrinkerThread<>(this), 0, cacheAttr.getShrinkerIntervalSeconds(),
+ new ShrinkerThread<K, V>(this), 0, cacheAttr.getShrinkerIntervalSeconds(),
TimeUnit.SECONDS);
}
}
@@ -260,8 +261,12 @@ public class CompositeCache<K, V>
}
updateCount.incrementAndGet();
- memCache.update(cacheElement);
- updateAuxiliaries(cacheElement, localOnly);
+
+ synchronized (this)
+ {
+ memCache.update(cacheElement);
+ updateAuxiliaries(cacheElement, localOnly);
+ }
cacheElement.getElementAttributes().setLastAccessTimeNow();
}
@@ -506,110 +511,113 @@ public class CompositeCache<K, V>
log.debug("get: key = " + key + ", localOnly = " + localOnly);
}
- try
+ synchronized (this)
{
- // First look in memory cache
- element = memCache.get(key);
-
- if (element != null)
+ try
{
- // Found in memory cache
- if (isExpired(element))
+ // First look in memory cache
+ element = memCache.get(key);
+
+ if (element != null)
{
- if (log.isDebugEnabled())
+ // Found in memory cache
+ if (isExpired(element))
{
- log.debug(cacheAttr.getCacheName() + " - Memory cache hit, but element expired");
- }
+ if (log.isDebugEnabled())
+ {
+ log.debug(cacheAttr.getCacheName() + " - Memory cache hit, but element expired");
+ }
- doExpires(element);
- element = null;
- }
- else
- {
- if (log.isDebugEnabled())
+ doExpires(element);
+ element = null;
+ }
+ else
{
- log.debug(cacheAttr.getCacheName() + " - Memory cache hit");
+ if (log.isDebugEnabled())
+ {
+ log.debug(cacheAttr.getCacheName() + " - Memory cache hit");
+ }
+
+ // Update counters
+ hitCountRam.incrementAndGet();
}
- // Update counters
- hitCountRam.incrementAndGet();
+ found = true;
}
-
- found = true;
- }
- else
- {
- // Item not found in memory. If local invocation look in aux
- // caches, even if not local look in disk auxiliaries
- for (AuxiliaryCache<K, V> aux : auxCaches)
+ else
{
- if (aux != null)
+ // Item not found in memory. If local invocation look in aux
+ // caches, even if not local look in disk auxiliaries
+ for (AuxiliaryCache<K, V> aux : auxCaches)
{
- CacheType cacheType = aux.getCacheType();
-
- if (!localOnly || cacheType == CacheType.DISK_CACHE)
+ if (aux != null)
{
- if (log.isDebugEnabled())
- {
- log.debug("Attempting to get from aux [" + aux.getCacheName() + "] which is of type: "
- + cacheType);
- }
+ CacheType cacheType = aux.getCacheType();
- try
+ if (!localOnly || cacheType == CacheType.DISK_CACHE)
{
- element = aux.get(key);
+ if (log.isDebugEnabled())
+ {
+ log.debug("Attempting to get from aux [" + aux.getCacheName() + "] which is of type: "
+ + cacheType);
+ }
+
+ try
+ {
+ element = aux.get(key);
+ }
+ catch (IOException e)
+ {
+ log.error("Error getting from aux", e);
+ }
}
- catch (IOException e)
+
+ if (log.isDebugEnabled())
{
- log.error("Error getting from aux", e);
+ log.debug("Got CacheElement: " + element);
}
- }
- if (log.isDebugEnabled())
- {
- log.debug("Got CacheElement: " + element);
- }
-
- // Item found in one of the auxiliary caches.
- if (element != null)
- {
- if (isExpired(element))
+ // Item found in one of the auxiliary caches.
+ if (element != null)
{
- if (log.isDebugEnabled())
+ if (isExpired(element))
{
- log.debug(cacheAttr.getCacheName() + " - Aux cache[" + aux.getCacheName() + "] hit, but element expired.");
+ if (log.isDebugEnabled())
+ {
+ log.debug(cacheAttr.getCacheName() + " - Aux cache[" + aux.getCacheName() + "] hit, but element expired.");
+ }
+
+ // This will tell the remotes to remove the item
+ // based on the element's expiration policy. The elements attributes
+ // associated with the item when it created govern its behavior
+ // everywhere.
+ doExpires(element);
+ element = null;
}
-
- // This will tell the remotes to remove the item
- // based on the element's expiration policy. The elements attributes
- // associated with the item when it created govern its behavior
- // everywhere.
- doExpires(element);
- element = null;
- }
- else
- {
- if (log.isDebugEnabled())
+ else
{
- log.debug(cacheAttr.getCacheName() + " - Aux cache[" + aux.getCacheName() + "] hit");
+ if (log.isDebugEnabled())
+ {
+ log.debug(cacheAttr.getCacheName() + " - Aux cache[" + aux.getCacheName() + "] hit");
+ }
+
+ // Update counters
+ hitCountAux.incrementAndGet();
+ copyAuxiliaryRetrievedItemToMemory(element);
}
- // Update counters
- hitCountAux.incrementAndGet();
- copyAuxiliaryRetrievedItemToMemory(element);
- }
-
- found = true;
+ found = true;
- break;
+ break;
+ }
}
}
}
}
- }
- catch (IOException e)
- {
- log.error("Problem encountered getting element.", e);
+ catch (IOException e)
+ {
+ log.error("Problem encountered getting element.", e);
+ }
}
if (!found)
@@ -675,7 +683,7 @@ public class CompositeCache<K, V>
*/
protected Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys, boolean localOnly)
{
- Map<K, ICacheElement<K, V>> elements = new HashMap<>();
+ Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
if (log.isDebugEnabled())
{
@@ -724,8 +732,13 @@ public class CompositeCache<K, V>
throws IOException
{
Map<K, ICacheElement<K, V>> elementsFromMemory = memCache.getMultiple(keys);
- elementsFromMemory.entrySet().removeIf(entry -> {
+ Iterator<Map.Entry<K, ICacheElement<K, V>>> elementFromMemoryIterator = elementsFromMemory.entrySet().iterator();
+
+ while (elementFromMemoryIterator.hasNext())
+ {
+ Map.Entry<K, ICacheElement<K, V>> entry = elementFromMemoryIterator.next();
ICacheElement<K, V> element = entry.getValue();
+
if (isExpired(element))
{
if (log.isDebugEnabled())
@@ -734,7 +747,7 @@ public class CompositeCache<K, V>
}
doExpires(element);
- return true;
+ elementFromMemoryIterator.remove();
}
else
{
@@ -745,9 +758,8 @@ public class CompositeCache<K, V>
// Update counters
hitCountRam.incrementAndGet();
- return false;
}
- });
+ }
return elementsFromMemory;
}
@@ -763,15 +775,15 @@ public class CompositeCache<K, V>
private Map<K, ICacheElement<K, V>> getMultipleFromAuxiliaryCaches(Set<K> keys, boolean localOnly)
throws IOException
{
- Map<K, ICacheElement<K, V>> elements = new HashMap<>();
- Set<K> remainingKeys = new HashSet<>(keys);
+ Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+ Set<K> remainingKeys = new HashSet<K>(keys);
for (AuxiliaryCache<K, V> aux : auxCaches)
{
if (aux != null)
{
Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
- new HashMap<>();
+ new HashMap<K, ICacheElement<K, V>>();
CacheType cacheType = aux.getCacheType();
@@ -877,7 +889,7 @@ public class CompositeCache<K, V>
log.error("Problem encountered getting elements.", e);
}
- return new HashMap<>();
+ return new HashMap<K, ICacheElement<K, V>>();
}
/**
@@ -916,7 +928,7 @@ public class CompositeCache<K, V>
private Map<K, ICacheElement<K, V>> getMatchingFromAuxiliaryCaches(String pattern, boolean localOnly)
throws IOException
{
- Map<K, ICacheElement<K, V>> elements = new HashMap<>();
+ Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
for (int i = auxCaches.length - 1; i >= 0; i--)
{
@@ -925,7 +937,7 @@ public class CompositeCache<K, V>
if (aux != null)
{
Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
- new HashMap<>();
+ new HashMap<K, ICacheElement<K, V>>();
CacheType cacheType = aux.getCacheType();
@@ -970,7 +982,11 @@ public class CompositeCache<K, V>
private void processRetrievedElements(AuxiliaryCache<K, V> aux, Map<K, ICacheElement<K, V>> elementsFromAuxiliary)
throws IOException
{
- elementsFromAuxiliary.entrySet().removeIf(entry -> {
+ Iterator<Map.Entry<K, ICacheElement<K, V>>> elementFromAuxiliaryIterator = elementsFromAuxiliary.entrySet().iterator();
+
+ while (elementFromAuxiliaryIterator.hasNext())
+ {
+ Map.Entry<K, ICacheElement<K, V>> entry = elementFromAuxiliaryIterator.next();
ICacheElement<K, V> element = entry.getValue();
// Item found in one of the auxiliary caches.
@@ -988,7 +1004,7 @@ public class CompositeCache<K, V>
// associated with the item when it created govern its behavior
// everywhere.
doExpires(element);
- return true;
+ elementFromAuxiliaryIterator.remove();
}
else
{
@@ -999,20 +1015,10 @@ public class CompositeCache<K, V>
// Update counters
hitCountAux.incrementAndGet();
- try
- {
- copyAuxiliaryRetrievedItemToMemory(element);
- }
- catch (IOException e)
- {
- log.error(cacheAttr.getCacheName()
- + " failed to copy element to memory " + element, e);
- }
+ copyAuxiliaryRetrievedItemToMemory(element);
}
}
-
- return false;
- });
+ }
}
/**
@@ -1048,7 +1054,7 @@ public class CompositeCache<K, V>
*/
private Set<K> pruneKeysFound(Set<K> keys, Map<K, ICacheElement<K, V>> foundElements)
{
- Set<K> remainingKeys = new HashSet<>(keys);
+ Set<K> remainingKeys = new HashSet<K>(keys);
remainingKeys.removeAll(foundElements.keySet());
return remainingKeys;
@@ -1073,7 +1079,7 @@ public class CompositeCache<K, V>
*/
public Set<K> getKeySet(boolean localOnly)
{
- HashSet<K> allKeys = new HashSet<>();
+ HashSet<K> allKeys = new HashSet<K>();
allKeys.addAll(memCache.getKeySet());
for (AuxiliaryCache<K, V> aux : auxCaches)
@@ -1143,48 +1149,51 @@ public class CompositeCache<K, V>
boolean removed = false;
- try
+ synchronized (this)
{
- removed = memCache.remove(key);
- }
- catch (IOException e)
- {
- log.error(e);
- }
-
- // Removes from all auxiliary caches.
- for (ICache<K, V> aux : auxCaches)
- {
- if (aux == null)
+ try
{
- continue;
+ removed = memCache.remove(key);
}
-
- CacheType cacheType = aux.getCacheType();
-
- // for now let laterals call remote remove but not vice versa
- if (localOnly && (cacheType == CacheType.REMOTE_CACHE || cacheType == CacheType.LATERAL_CACHE))
+ catch (IOException e)
{
- continue;
+ log.error(e);
}
- try
+
+ // Removes from all auxiliary caches.
+ for (ICache<K, V> aux : auxCaches)
{
- if (log.isDebugEnabled())
+ if (aux == null)
{
- log.debug("Removing " + key + " from cacheType" + cacheType);
+ continue;
}
- boolean b = aux.remove(key);
+ CacheType cacheType = aux.getCacheType();
- // Don't take the remote removal into account.
- if (!removed && cacheType != CacheType.REMOTE_CACHE)
+ // for now let laterals call remote remove but not vice versa
+ if (localOnly && (cacheType == CacheType.REMOTE_CACHE || cacheType == CacheType.LATERAL_CACHE))
{
- removed = b;
+ continue;
+ }
+ try
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Removing " + key + " from cacheType" + cacheType);
+ }
+
+ boolean b = aux.remove(key);
+
+ // Don't take the remote removal into account.
+ if (!removed && cacheType != CacheType.REMOTE_CACHE)
+ {
+ removed = b;
+ }
+ }
+ catch (IOException ex)
+ {
+ log.error("Failure removing from aux", ex);
}
- }
- catch (IOException ex)
- {
- log.error("Failure removing from aux", ex);
}
}
@@ -1225,37 +1234,40 @@ public class CompositeCache<K, V>
protected void removeAll(boolean localOnly)
throws IOException
{
- try
+ synchronized (this)
{
- memCache.removeAll();
+ try
+ {
+ memCache.removeAll();
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled())
+ {
+ log.debug("Removed All keys from the memory cache.");
+ }
+ }
+ catch (IOException ex)
{
- log.debug("Removed All keys from the memory cache.");
+ log.error("Trouble updating memory cache.", ex);
}
- }
- catch (IOException ex)
- {
- log.error("Trouble updating memory cache.", ex);
- }
- // Removes from all auxiliary disk caches.
- for (ICache<K, V> aux : auxCaches)
- {
- if (aux != null && (aux.getCacheType() == CacheType.DISK_CACHE || !localOnly))
+ // Removes from all auxiliary disk caches.
+ for (ICache<K, V> aux : auxCaches)
{
- try
+ if (aux != null && (aux.getCacheType() == CacheType.DISK_CACHE || !localOnly))
{
- if (log.isDebugEnabled())
+ try
{
- log.debug("Removing All keys from cacheType" + aux.getCacheType());
- }
+ if (log.isDebugEnabled())
+ {
+ log.debug("Removing All keys from cacheType" + aux.getCacheType());
+ }
- aux.removeAll();
- }
- catch (IOException ex)
- {
- log.error("Failure removing all from aux", ex);
+ aux.removeAll();
+ }
+ catch (IOException ex)
+ {
+ log.error("Failure removing all from aux", ex);
+ }
}
}
}
@@ -1290,90 +1302,93 @@ public class CompositeCache<K, V>
log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] fromRemote [" + fromRemote + "]");
}
- // Remove us from the cache managers list
- // This will call us back but exit immediately
- if (cacheManager != null)
+ synchronized (this)
{
- cacheManager.freeCache(getCacheName(), fromRemote);
- }
+ // Remove us from the cache managers list
+ // This will call us back but exit immediately
+ if (cacheManager != null)
+ {
+ cacheManager.freeCache(getCacheName(), fromRemote);
+ }
- // Try to stop shrinker thread
- if (future != null)
- {
- future.cancel(true);
- }
+ // Try to stop shrinker thread
+ if (future != null)
+ {
+ future.cancel(true);
+ }
- // Now, shut down the event queue
- if (elementEventQ != null)
- {
- elementEventQ.dispose();
- elementEventQ = null;
- }
+ // Now, shut down the event queue
+ if (elementEventQ != null)
+ {
+ elementEventQ.dispose();
+ elementEventQ = null;
+ }
- // Dispose of each auxiliary cache, Remote auxiliaries will be
- // skipped if 'fromRemote' is true.
- for (ICache<K, V> aux : auxCaches)
- {
- try
+ // Dispose of each auxiliary cache, Remote auxiliaries will be
+ // skipped if 'fromRemote' is true.
+ for (ICache<K, V> aux : auxCaches)
{
- // Skip this auxiliary if:
- // - The auxiliary is null
- // - The auxiliary is not alive
- // - The auxiliary is remote and the invocation was remote
- if (aux == null || aux.getStatus() != CacheStatus.ALIVE
- || (fromRemote && aux.getCacheType() == CacheType.REMOTE_CACHE))
+ try
{
- if (log.isInfoEnabled())
+ // Skip this auxiliary if:
+ // - The auxiliary is null
+ // - The auxiliary is not alive
+ // - The auxiliary is remote and the invocation was remote
+ if (aux == null || aux.getStatus() != CacheStatus.ALIVE
+ || (fromRemote && aux.getCacheType() == CacheType.REMOTE_CACHE))
{
- log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] SKIPPING auxiliary [" + aux.getCacheName() + "] fromRemote ["
- + fromRemote + "]");
+ if (log.isInfoEnabled())
+ {
+ log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] SKIPPING auxiliary [" + aux.getCacheName() + "] fromRemote ["
+ + fromRemote + "]");
+ }
+ continue;
}
- continue;
- }
-
- if (log.isInfoEnabled())
- {
- log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] auxiliary [" + aux.getCacheName() + "]");
- }
-
- // IT USED TO BE THE CASE THAT (If the auxiliary is not a lateral, or the cache
- // attributes
- // have 'getUseLateral' set, all the elements currently in
- // memory are written to the lateral before disposing)
- // I changed this. It was excessive. Only the disk cache needs the items, since only
- // the disk cache is in a situation to not get items on a put.
- if (aux.getCacheType() == CacheType.DISK_CACHE)
- {
- int numToFree = memCache.getSize();
- memCache.freeElements(numToFree);
if (log.isInfoEnabled())
{
- log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] put " + numToFree + " into auxiliary " + aux.getCacheName());
+ log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] auxiliary [" + aux.getCacheName() + "]");
}
+
+ // IT USED TO BE THE CASE THAT (If the auxiliary is not a lateral, or the cache
+ // attributes
+ // have 'getUseLateral' set, all the elements currently in
+ // memory are written to the lateral before disposing)
+ // I changed this. It was excessive. Only the disk cache needs the items, since only
+ // the disk cache is in a situation to not get items on a put.
+ if (aux.getCacheType() == CacheType.DISK_CACHE)
+ {
+ int numToFree = memCache.getSize();
+ memCache.freeElements(numToFree);
+
+ if (log.isInfoEnabled())
+ {
+ log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] put " + numToFree + " into auxiliary " + aux.getCacheName());
+ }
+ }
+
+ // Dispose of the auxiliary
+ aux.dispose();
}
+ catch (IOException ex)
+ {
+ log.error("Failure disposing of aux.", ex);
+ }
+ }
- // Dispose of the auxiliary
- aux.dispose();
+ if (log.isInfoEnabled())
+ {
+ log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] disposing of memory cache.");
+ }
+ try
+ {
+ memCache.dispose();
}
catch (IOException ex)
{
- log.error("Failure disposing of aux.", ex);
+ log.error("Failure disposing of memCache", ex);
}
}
-
- if (log.isInfoEnabled())
- {
- log.info("In DISPOSE, [" + this.cacheAttr.getCacheName() + "] disposing of memory cache.");
- }
- try
- {
- memCache.dispose();
- }
- catch (IOException ex)
- {
- log.error("Failure disposing of memCache", ex);
- }
}
/**
@@ -1388,29 +1403,31 @@ public class CompositeCache<K, V>
return;
}
- for (ICache<K, V> aux : auxCaches)
+ synchronized (this)
{
- try
+ for (ICache<K, V> aux : auxCaches)
{
- if (aux.getStatus() == CacheStatus.ALIVE)
+ try
{
- for (K key : memCache.getKeySet())
+ if (aux.getStatus() == CacheStatus.ALIVE)
{
- ICacheElement<K, V> ce = memCache.get(key);
-
- if (ce != null)
+ for (K key : memCache.getKeySet())
{
- aux.update(ce);
+ ICacheElement<K, V> ce = memCache.get(key);
+
+ if (ce != null)
+ {
+ aux.update(ce);
+ }
}
}
}
- }
- catch (IOException ex)
- {
- log.error("Failure saving aux caches.", ex);
+ catch (IOException ex)
+ {
+ log.error("Failure saving aux caches.", ex);
+ }
}
}
-
if (log.isDebugEnabled())
{
log.debug("Called save for [" + cacheAttr.getCacheName() + "]");
@@ -1473,16 +1490,16 @@ public class CompositeCache<K, V>
stats.setRegionName(this.getCacheName());
// store the composite cache stats first
- ArrayList<IStatElement<?>> elems = new ArrayList<>();
+ ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
- elems.add(new StatElement<>("HitCountRam", Long.valueOf(getHitCountRam())));
- elems.add(new StatElement<>("HitCountAux", Long.valueOf(getHitCountAux())));
+ elems.add(new StatElement<Integer>("HitCountRam", Integer.valueOf(getHitCountRam())));
+ elems.add(new StatElement<Integer>("HitCountAux", Integer.valueOf(getHitCountAux())));
stats.setStatElements(elems);
// memory + aux, memory is not considered an auxiliary internally
int total = auxCaches.length + 1;
- ArrayList<IStats> auxStats = new ArrayList<>(total);
+ ArrayList<IStats> auxStats = new ArrayList<IStats>(total);
auxStats.add(getMemoryCache().getStatistics());
@@ -1674,7 +1691,7 @@ public class CompositeCache<K, V>
log.warn("No element event queue available for cache " + getCacheName());
return;
}
- IElementEvent<ICacheElement<K, V>> event = new ElementEvent<>(element, eventType);
+ IElementEvent<ICacheElement<K, V>> event = new ElementEvent<ICacheElement<K, V>>(element, eventType);
for (IElementEventHandler hand : eventHandlers)
{
try
@@ -1712,7 +1729,7 @@ public class CompositeCache<K, V>
{
log.warn("Failed to init mem cache, using: LRUMemoryCache", e);
- this.memCache = new LRUMemoryCache<>();
+ this.memCache = new LRUMemoryCache<K, V>();
this.memCache.initialize(this);
}
}
@@ -1737,7 +1754,7 @@ public class CompositeCache<K, V>
* <p>
* @return number of hits in memory
*/
- public long getHitCountRam()
+ public int getHitCountRam()
{
return hitCountRam.get();
}
@@ -1746,7 +1763,7 @@ public class CompositeCache<K, V>
* Number of times a requested item was found in and auxiliary cache.
* @return number of auxiliary hits.
*/
- public long getHitCountAux()
+ public int getHitCountAux()
{
return hitCountAux.get();
}
@@ -1755,7 +1772,7 @@ public class CompositeCache<K, V>
* Number of times a requested element was not found.
* @return number of misses.
*/
- public long getMissCountNotFound()
+ public int getMissCountNotFound()
{
return missCountNotFound.get();
}
@@ -1764,7 +1781,7 @@ public class CompositeCache<K, V>
* Number of times a requested element was found but was expired.
* @return number of found but expired gets.
*/
- public long getMissCountExpired()
+ public int getMissCountExpired()
{
return missCountExpired.get();
}
@@ -1772,7 +1789,7 @@ public class CompositeCache<K, V>
/**
* @return Returns the updateCount.
*/
- public long getUpdateCount()
+ public int getUpdateCount()
{
return updateCount.get();
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java Wed May 29 12:18:56 2019
@@ -121,7 +121,7 @@ public class CompositeCacheConfigurator
*/
protected void parseRegions( Properties props, CompositeCacheManager ccm )
{
- List<String> regionNames = new ArrayList<>();
+ List<String> regionNames = new ArrayList<String>();
for (String key : props.stringPropertyNames() )
{
@@ -225,7 +225,7 @@ public class CompositeCacheConfigurator
if (auxiliaries != null)
{
// Next, create the auxiliaries for the new cache
- List<AuxiliaryCache<K, V>> auxList = new ArrayList<>();
+ List<AuxiliaryCache<K, V>> auxList = new ArrayList<AuxiliaryCache<K, V>>();
if ( log.isDebugEnabled() )
{
@@ -285,7 +285,7 @@ public class CompositeCacheConfigurator
protected <K, V> CompositeCache<K, V> newCache(
ICompositeCacheAttributes cca, IElementAttributes ea)
{
- return new CompositeCache<>( cca, ea );
+ return new CompositeCache<K, V>( cca, ea );
}
/**
@@ -565,7 +565,7 @@ public class CompositeCacheConfigurator
else
{
// use the default standard serializer
- keyMatcher = new KeyMatcherPatternImpl<>();
+ keyMatcher = new KeyMatcherPatternImpl<K>();
if ( log.isInfoEnabled() )
{
log.info( "Using standard key matcher [" + keyMatcher + "] for auxiliary [" + auxPrefix + "]" );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java Wed May 29 12:18:56 2019
@@ -83,7 +83,7 @@ public class CompositeCacheManager
/** Caches managed by this cache manager */
private final ConcurrentMap<String, ICache<?, ?>> caches =
- new ConcurrentHashMap<>();
+ new ConcurrentHashMap<String, ICache<?, ?>>();
/** Number of clients accessing this cache manager */
private final AtomicInteger clients = new AtomicInteger(0);
@@ -96,15 +96,15 @@ public class CompositeCacheManager
/** Used to keep track of configured auxiliaries */
private final ConcurrentMap<String, AuxiliaryCacheFactory> auxiliaryFactoryRegistry =
- new ConcurrentHashMap<>( );
+ new ConcurrentHashMap<String, AuxiliaryCacheFactory>( );
/** Used to keep track of attributes for auxiliaries. */
private final ConcurrentMap<String, AuxiliaryCacheAttributes> auxiliaryAttributeRegistry =
- new ConcurrentHashMap<>( );
+ new ConcurrentHashMap<String, AuxiliaryCacheAttributes>( );
/** Used to keep track of configured auxiliaries */
private final ConcurrentMap<String, AuxiliaryCache<?, ?>> auxiliaryCaches =
- new ConcurrentHashMap<>( );
+ new ConcurrentHashMap<String, AuxiliaryCache<?, ?>>( );
/** Properties with which this manager was configured. This is exposed for other managers. */
private Properties configurationProperties;
@@ -122,7 +122,7 @@ public class CompositeCacheManager
private static final boolean DEFAULT_FORCE_RECONFIGURATION = false;
/** Stack for those waiting for notification of a shutdown. */
- private final LinkedBlockingDeque<IShutdownObserver> shutdownObservers = new LinkedBlockingDeque<>();
+ private final LinkedBlockingDeque<IShutdownObserver> shutdownObservers = new LinkedBlockingDeque<IShutdownObserver>();
/** The central background scheduler. */
private ScheduledExecutorService scheduledExecutor;
@@ -839,7 +839,7 @@ public class CompositeCacheManager
*/
public ICacheStats[] getStatistics()
{
- ArrayList<ICacheStats> cacheStats = new ArrayList<>();
+ ArrayList<ICacheStats> cacheStats = new ArrayList<ICacheStats>();
for (ICache<?, ?> c : caches.values())
{
CompositeCache<?, ?> cache = (CompositeCache<?, ?>) c;
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java Wed May 29 12:18:56 2019
@@ -49,7 +49,7 @@ public class CacheEventLoggerDebugLogger
public <T> ICacheEvent<T> createICacheEvent( String source, String region, String eventName,
String optionalDetails, T key )
{
- ICacheEvent<T> event = new CacheEvent<>();
+ ICacheEvent<T> event = new CacheEvent<T>();
event.setSource( source );
event.setRegion( region );
event.setEventName( eventName );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java Wed May 29 12:18:56 2019
@@ -61,7 +61,7 @@ public abstract class AbstractDoubleLink
public void initialize(CompositeCache<K, V> hub)
{
super.initialize(hub);
- list = new DoubleLinkedList<>();
+ list = new DoubleLinkedList<MemoryElementDescriptor<K, V>>();
log.info("initialized MemoryCache for " + getCacheName());
}
@@ -77,7 +77,7 @@ public abstract class AbstractDoubleLink
@Override
public ConcurrentMap<K, MemoryElementDescriptor<K, V>> createMap()
{
- return new ConcurrentHashMap<>();
+ return new ConcurrentHashMap<K, MemoryElementDescriptor<K, V>>();
}
/**
@@ -341,7 +341,7 @@ public abstract class AbstractDoubleLink
lock.lock();
try
{
- MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<>(ce);
+ MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<K, V>(ce);
list.addFirst(me);
if ( log.isDebugEnabled() )
{
@@ -368,7 +368,7 @@ public abstract class AbstractDoubleLink
lock.lock();
try
{
- MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<>(ce);
+ MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<K, V>(ce);
list.addLast(me);
if ( log.isDebugEnabled() )
{
@@ -517,7 +517,7 @@ public abstract class AbstractDoubleLink
List<IStatElement<?>> elems = stats.getStatElements();
- elems.add(new StatElement<>("List Size", Integer.valueOf(list.size())));
+ elems.add(new StatElement<Integer>("List Size", Integer.valueOf(list.size())));
return stats;
}