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 2017/09/24 19:02:17 UTC
svn commit: r1809534 - in /commons/proper/jcs/trunk/commons-jcs-core/src:
main/java/org/apache/commons/jcs/
main/java/org/apache/commons/jcs/auxiliary/disk/block/
main/java/org/apache/commons/jcs/auxiliary/remote/
main/java/org/apache/commons/jcs/auxil...
Author: tv
Date: Sun Sep 24 19:02:17 2017
New Revision: 1809534
URL: http://svn.apache.org/viewvc?rev=1809534&view=rev
Log:
Remove deprecated code
Removed:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/DefaultMemoryElementDescriptor.java
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/AbstractCacheEventQueue.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/ICacheEventQueue.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java?rev=1809534&r1=1809533&r2=1809534&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/JCS.java Sun Sep 24 19:02:17 2017
@@ -49,65 +49,6 @@ public abstract class JCS
private static CompositeCacheManager cacheMgr;
/**
- * Define a new cache region with the given name. In the oracle specification, these attributes
- * are global and not region specific, regional overrides is a value add each region should be
- * able to house both cache and element attribute sets. It is more efficient to define a cache
- * in the props file and then strictly use the get access method. Use of the define region
- * outside of an initialization block should be avoided.
- * <p>
- * @param name Name that will identify the region
- * @return CacheAccess instance for the new region
- * @throws CacheException
- *
- * @deprecated Duplicate of getInstance(String)
- */
- @Deprecated
- public static <K, V> CacheAccess<K, V> defineRegion( String name )
- throws CacheException
- {
- CompositeCache<K, V> cache = getCacheManager().getCache( name );
- return new CacheAccess<K, V>( cache );
- }
-
- /**
- * Define a new cache region with the specified name and attributes.
- * <p>
- * @param name Name that will identify the region
- * @param cattr CompositeCacheAttributes for the region
- * @return CacheAccess instance for the new region
- * @throws CacheException
- *
- * @deprecated Duplicate of getInstance(String, ICompositeCacheAttributes)
- */
- @Deprecated
- public static <K, V> CacheAccess<K, V> defineRegion( String name, ICompositeCacheAttributes cattr )
- throws CacheException
- {
- CompositeCache<K, V> cache = getCacheManager().getCache( name, cattr );
- return new CacheAccess<K, V>( cache );
- }
-
- /**
- * Define a new cache region with the specified name and attributes and return a CacheAccess to
- * it.
- * <p>
- * @param name Name that will identify the region
- * @param cattr CompositeCacheAttributes for the region
- * @param attr Attributes for the region
- * @return CacheAccess instance for the new region
- * @throws CacheException
- *
- * @deprecated Duplicate of getInstance(String, ICompositeCacheAttributes, IElementAttributes)
- */
- @Deprecated
- public static <K, V> CacheAccess<K, V> defineRegion( String name, ICompositeCacheAttributes cattr, IElementAttributes attr )
- throws CacheException
- {
- CompositeCache<K, V> cache = getCacheManager().getCache( name, cattr, attr );
- return new CacheAccess<K, V>( cache );
- }
-
- /**
* Set the filename that the cache manager will be initialized with. Only matters before the
* instance is initialized.
* <p>
@@ -221,7 +162,7 @@ public abstract class JCS
CompositeCache<K, V> cache = getCacheManager().getCache( region, icca, eattr );
return new CacheAccess<K, V>( cache );
}
-
+
/**
* Get a GroupCacheAccess which accesses the provided region.
* <p>
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java?rev=1809534&r1=1809533&r2=1809534&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java Sun Sep 24 19:02:17 2017
@@ -375,19 +375,6 @@ public class BlockDisk
* Calculates the file offset for a particular block.
* <p>
* @param block number
- * @return the byte offset for this block in the file as an int; may overflow
- * @deprecated (since 2.0) use {@link #calculateByteOffsetForBlockAsLong(int)} instead
- */
- @Deprecated
- protected int calculateByteOffsetForBlock( int block )
- {
- return block * blockSizeBytes;
- }
-
- /**
- * Calculates the file offset for a particular block.
- * <p>
- * @param block number
* @return the byte offset for this block in the file as a long
* @since 2.0
*/
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=1809534&r1=1809533&r2=1809534&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 Sun Sep 24 19:02:17 2017
@@ -30,9 +30,7 @@ import java.util.Set;
import org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCache;
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.commons.jcs.engine.CacheStatus;
-import org.apache.commons.jcs.engine.behavior.ICache;
import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.commons.jcs.engine.behavior.IElementSerializer;
import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.commons.jcs.engine.stats.StatElement;
@@ -81,37 +79,6 @@ public abstract class AbstractRemoteCach
}
}
- /**
- * Constructs with the given remote cache, and fires events to any listeners.
- * <p>
- * @param noWaits
- * @param rca
- * @param cacheMgr
- * @param cacheEventLogger
- * @param elementSerializer
- * @deprecated Unused parameter cacheMgr scheduled for removal
- */
- @Deprecated
- public AbstractRemoteCacheNoWaitFacade( List<ICache<K, V>> noWaits, RemoteCacheAttributes rca,
- ICompositeCacheManager cacheMgr, ICacheEventLogger cacheEventLogger,
- IElementSerializer elementSerializer )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( "CONSTRUCTING NO WAIT FACADE" );
- }
- this.remoteCacheAttributes = rca;
- setCacheEventLogger( cacheEventLogger );
- setElementSerializer( elementSerializer );
- this.noWaits = new ArrayList<RemoteCacheNoWait<K,V>>();
- for (ICache<K, V> nw : noWaits)
- {
- RemoteCacheNoWait<K,V> rcnw = (RemoteCacheNoWait<K,V>)nw;
- ((RemoteCache<K, V>)rcnw.getRemoteCache()).setFacade(this);
- this.noWaits.add(rcnw);
- }
- }
-
/**
* Put an element in the cache.
* <p>
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=1809534&r1=1809533&r2=1809534&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 Sun Sep 24 19:02:17 2017
@@ -24,8 +24,6 @@ import java.util.List;
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.commons.jcs.auxiliary.remote.server.behavior.RemoteType;
import org.apache.commons.jcs.engine.CacheStatus;
-import org.apache.commons.jcs.engine.behavior.ICache;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.commons.jcs.engine.behavior.IElementSerializer;
import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.commons.logging.Log;
@@ -67,29 +65,6 @@ public class RemoteCacheNoWaitFacade<K,
this.cacheFactory = cacheFactory;
}
- /**
- * Constructs with the given remote cache, and fires events to any listeners.
- * <p>
- * @param noWaits
- * @param rca
- * @param cacheMgr
- * @param cacheEventLogger
- * @param elementSerializer
- * @param cacheFactory
- * @deprecated Unused parameter cacheMgr scheduled for removal
- */
- @Deprecated
- public RemoteCacheNoWaitFacade( List<ICache<K, V>> noWaits,
- RemoteCacheAttributes rca,
- ICompositeCacheManager cacheMgr,
- ICacheEventLogger cacheEventLogger,
- IElementSerializer elementSerializer,
- RemoteCacheFactory cacheFactory)
- {
- super( noWaits, rca, cacheMgr, cacheEventLogger, elementSerializer );
- this.cacheFactory = cacheFactory;
- }
-
/**
* Begin the failover process if this is a local cache. Clustered remote caches do not failover.
* <p>
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=1809534&r1=1809533&r2=1809534&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 Sun Sep 24 19:02:17 2017
@@ -36,7 +36,6 @@ import java.util.concurrent.ConcurrentMa
import java.util.concurrent.locks.ReentrantLock;
import org.apache.commons.jcs.access.exception.CacheException;
-import org.apache.commons.jcs.auxiliary.remote.RemoteUtils;
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheListener;
import org.apache.commons.jcs.auxiliary.remote.server.behavior.IRemoteCacheServer;
import org.apache.commons.jcs.auxiliary.remote.server.behavior.IRemoteCacheServerAttributes;
@@ -127,7 +126,7 @@ public class RemoteCacheServer<K, V>
* Constructor for the RemoteCacheServer object. This initializes the server with the values
* from the properties object.
* <p>
- * @param rcsa
+ * @param rcsa
* @param config cache hub configuration
* @throws RemoteException
*/
@@ -157,69 +156,6 @@ public class RemoteCacheServer<K, V>
}
/**
- * Constructor for the RemoteCacheServer object. This initializes the server with the values
- * from the config file.
- * <p>
- * @param rcsa
- * @throws RemoteException
- *
- * @deprecated Use version with Properties object instead
- */
- @Deprecated
- protected RemoteCacheServer( IRemoteCacheServerAttributes rcsa )
- throws RemoteException
- {
- super( rcsa.getServicePort() );
- this.remoteCacheServerAttributes = rcsa;
- init( rcsa.getConfigFileName() );
- }
-
- /**
- * Constructor for the RemoteCacheServer object. This initializes the server with the values
- * from the config file.
- * <p>
- * @param rcsa
- * @param customRMISocketFactory
- * @throws RemoteException
- *
- * @deprecated Use version with Properties object instead
- */
- @Deprecated
- protected RemoteCacheServer( IRemoteCacheServerAttributes rcsa, RMISocketFactory customRMISocketFactory )
- throws RemoteException
- {
- super( rcsa.getServicePort(), customRMISocketFactory, customRMISocketFactory );
- this.remoteCacheServerAttributes = rcsa;
- init( rcsa.getConfigFileName() );
- }
-
- /**
- * Initialize the RMI Cache Server from a properties file.
- * <p>
- * @param prop
- * @throws RemoteException if the configuration of the cache manager instance fails
- *
- * @deprecated Use version with Properties parameter instead
- */
- @Deprecated
- private void init( String propFile ) throws RemoteException
- {
- String propFileName = propFile == null ? DFEAULT_REMOTE_CONFIGURATION_FILE : propFile;
-
- Properties prop = null;
- try
- {
- prop = RemoteUtils.loadProps(propFileName);
- }
- catch (IOException e)
- {
- throw new RemoteException(e.getMessage(), e);
- }
-
- init(prop);
- }
-
- /**
* Initialize the RMI Cache Server from a properties object.
* <p>
* @param prop the configuration properties
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=1809534&r1=1809533&r2=1809534&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 Sun Sep 24 19:02:17 2017
@@ -94,56 +94,6 @@ public class RemoteCacheServerFactory
* <p>
* A remote cache is either a local cache or a cluster cache.
* <p>
- * @param host the host name
- * @param port the port number
- * @param propFile the remote cache hub configuration file
- * @throws IOException
- *
- * @deprecated Use startup(String, int, Properties) instead
- */
- @Deprecated
- public static void startup( String host, int port, String propFile )
- throws IOException
- {
- if ( log.isInfoEnabled() )
- {
- log.info( "ConfigFileName = [" + propFile + "]" );
- }
- Properties props = RemoteUtils.loadProps( propFile );
- startup(host, port, props);
- }
-
- /**
- * Starts up the remote cache server on this JVM, and binds it to the registry on the given host
- * and port.
- * <p>
- * A remote cache is either a local cache or a cluster cache.
- * <p>
- * @param host the host name
- * @param port the port number
- * @param props the remote cache hub configuration
- * @param propFile the remote cache hub configuration file
- * @throws IOException
- *
- * @deprecated Use startup(String, int, Properties) instead
- */
- @Deprecated
- public static void startup( String host, int port, Properties props, String propFile )
- throws IOException
- {
- if ( log.isWarnEnabled() )
- {
- log.warn( "ConfigFileName = [" + propFile + "] ignored" );
- }
- startup(host, port, props);
- }
-
- /**
- * Starts up the remote cache server on this JVM, and binds it to the registry on the given host
- * and port.
- * <p>
- * A remote cache is either a local cache or a cluster cache.
- * <p>
* @param host
* @param port
* @param props
@@ -516,12 +466,12 @@ public class RemoteCacheServerFactory
/**
* Look up the remote cache service admin instance
- *
+ *
* @param config the configuration properties
* @param port the local port
* @return the admin object instance
- *
- * @throws Exception if lookup fails
+ *
+ * @throws Exception if lookup fails
*/
private static ICacheServiceAdmin lookupCacheServiceAdmin(Properties config, int port) throws Exception
{
@@ -537,10 +487,10 @@ public class RemoteCacheServerFactory
{
log.debug( "server found" );
}
-
+
return (ICacheServiceAdmin) obj;
}
-
+
/**
* @param serviceName the serviceName to set
*/
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/AbstractCacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/AbstractCacheEventQueue.java?rev=1809534&r1=1809533&r2=1809534&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/AbstractCacheEventQueue.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/AbstractCacheEventQueue.java Sun Sep 24 19:02:17 2017
@@ -102,33 +102,6 @@ public abstract class AbstractCacheEvent
}
/**
- * If they queue has an active thread it is considered alive.
- * <p>
- * @return The alive value
- *
- * @deprecated The alive-logic is not used
- */
- @Deprecated
- @Override
- public boolean isAlive()
- {
- return true;
- }
-
- /**
- * Sets whether the queue is actively processing -- if there are working threads.
- * <p>
- * @param aState
- *
- * @deprecated The alive-logic is not used
- */
- @Deprecated
- public void setAlive( boolean aState )
- {
- // do nothing
- }
-
- /**
* @return The listenerId value
*/
@Override
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/ICacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/ICacheEventQueue.java?rev=1809534&r1=1809533&r2=1809534&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/ICacheEventQueue.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/behavior/ICacheEventQueue.java Sun Sep 24 19:02:17 2017
@@ -95,15 +95,6 @@ public interface ICacheEventQueue<K, V>
void destroy();
/**
- * Gets the alive attribute of the ICacheEventQueue object. Alive just
- * indicates that there are active threads. This is less important that if
- * the queue is working.
- * <p>
- * @return The alive value
- */
- boolean isAlive();
-
- /**
* A Queue is working unless it has reached its max failure count.
* <p>
* @return boolean
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java?rev=1809534&r1=1809533&r2=1809534&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java Sun Sep 24 19:02:17 2017
@@ -107,7 +107,7 @@ public class ThreadPoolManager
{
return createPool(config, threadNamePrefix, Thread.NORM_PRIORITY);
}
-
+
/**
* Creates a pool based on the configuration info.
* <p>
@@ -183,12 +183,12 @@ public class ThreadPoolManager
public ScheduledExecutorService createSchedulerPool( PoolConfiguration config, String threadNamePrefix, int threadPriority )
{
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(
- config.getMaximumPoolSize(),
+ config.getMaximumPoolSize(),
new DaemonThreadFactory(threadNamePrefix, threadPriority));
return scheduler;
}
-
+
/**
* Returns a configured instance of the ThreadPoolManger To specify a configuration file or
* Properties object to use call the appropriate setter prior to calling getInstance.
@@ -222,7 +222,7 @@ public class ThreadPoolManager
log.warn("Failed to close pool " + pool, t);
}
}
-
+
for ( ScheduledExecutorService pool : INSTANCE.schedulerPools.values() )
{
try
@@ -234,7 +234,7 @@ public class ThreadPoolManager
log.warn("Failed to close pool " + pool, t);
}
}
-
+
INSTANCE = null;
}
}
@@ -280,23 +280,6 @@ public class ThreadPoolManager
return pool;
}
-
- /**
- * Returns a pool by name. If a pool by this name does not exist in the configuration file or
- * properties, one will be created using the default values.
- * <p>
- * Pools are lazily created.
- * <p>
- * @param name
- * @return The thread pool configured for the name.
- *
- * @deprecated Use getExecutorService() instead
- */
- @Deprecated
- public ThreadPoolExecutor getPool( String name )
- {
- return (ThreadPoolExecutor) getExecutorService(name);
- }
/**
* Returns a scheduler pool by name. If a pool by this name does not exist in the configuration file or
@@ -389,7 +372,7 @@ public class ThreadPoolManager
{
return loadConfig(root, defaultConfig);
}
-
+
/**
* Configures the PoolConfiguration settings.
* <p>
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java?rev=1809534&r1=1809533&r2=1809534&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java Sun Sep 24 19:02:17 2017
@@ -8,7 +8,6 @@ import java.util.Set;
import org.apache.commons.jcs.engine.CacheElement;
import org.apache.commons.jcs.engine.CacheStatus;
import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheEventQueue;
import org.apache.commons.jcs.utils.timing.SleepUtil;
/*
@@ -205,11 +204,8 @@ public class RemoteCacheNoWaitUnitTest
noWait.update( element );
SleepUtil.sleepAtLeast( 10 );
- ICacheEventQueue<String, String> newQueue = noWait.getCacheEventQueue();
// VERIFY
assertEquals( "Wrong status", service, client.fixed );
- // assertFalse( "Original queue should not alive", originalQueue.isAlive() );
- assertTrue( "New queue should be alive." + newQueue, newQueue.isAlive() );
}
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java?rev=1809534&r1=1809533&r2=1809534&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java Sun Sep 24 19:02:17 2017
@@ -21,9 +21,7 @@ package org.apache.commons.jcs.utils.thr
import java.util.ArrayList;
import java.util.Properties;
-import java.util.concurrent.RejectedExecutionHandler;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.ExecutorService;
import org.apache.commons.jcs.utils.props.PropertyLoader;
@@ -49,19 +47,8 @@ public class ThreadPoolManagerUnitTest
ThreadPoolManager mgr = ThreadPoolManager.getInstance();
assertNotNull( mgr );
- ThreadPoolExecutor pool = mgr.getPool( "test1" );
+ ExecutorService pool = mgr.getExecutorService( "test1" );
assertNotNull( pool );
-
- int poolSize = pool.getPoolSize();
- int expectedPoolSize = Integer.parseInt( props.getProperty( "thread_pool.test1.startUpSize" ) );
- assertEquals( poolSize, expectedPoolSize );
-
- // int qs = ((BoundedBuffer)pool.getQueue()).size();
-
- int max = pool.getMaximumPoolSize();
-
- int expected = Integer.parseInt( props.getProperty( "thread_pool.test1.maximumPoolSize" ) );
- assertEquals(expected, max );
}
/**
@@ -74,46 +61,8 @@ public class ThreadPoolManagerUnitTest
ThreadPoolManager mgr = ThreadPoolManager.getInstance();
assertNotNull( mgr );
- ThreadPoolExecutor pool = mgr.getPool( "aborttest" );
+ ExecutorService pool = mgr.getExecutorService( "aborttest" );
assertNotNull( pool );
-
- int poolSize = pool.getCorePoolSize();
- int expectedPoolSize = Integer.parseInt( props.getProperty( "thread_pool.aborttest.startUpSize" ) );
- assertEquals( expectedPoolSize, poolSize);
-
- int minPoolSize = pool.getPoolSize();
- int expectedMinPoolSize = Integer.parseInt( props.getProperty( "thread_pool.aborttest.minimumPoolSize" ) );
- assertEquals( expectedMinPoolSize, minPoolSize );
-
- int maxPoolSize = pool.getMaximumPoolSize();
- int expectedMaxPoolSize = Integer.parseInt( props.getProperty( "thread_pool.aborttest.maximumPoolSize" ) );
- assertEquals( expectedMaxPoolSize, maxPoolSize );
-
- long keepAliveTime = pool.getKeepAliveTime(TimeUnit.MILLISECONDS);
- long expectedKeepAliveTime = Long.parseLong( props.getProperty( "thread_pool.aborttest.keepAliveTime" ) );
- assertEquals( expectedKeepAliveTime, keepAliveTime );
-
- RejectedExecutionHandler whenBlockedPolicy = pool.getRejectedExecutionHandler();
- assertTrue( whenBlockedPolicy instanceof ThreadPoolExecutor.AbortPolicy );
- }
-
- /**
- * Try to get an undefined pool from an existing default file.
- */
- public void testDefaultConfigUndefinedPool()
- {
- Properties props = PropertyLoader.loadProperties( "thread_pool.properties" );
- ThreadPoolManager.setProps( props );
- ThreadPoolManager mgr = ThreadPoolManager.getInstance();
- assertNotNull( mgr );
-
- ThreadPoolExecutor pool = mgr.getPool( "doesnotexist" );
- assertNotNull( pool );
-
- int max = pool.getMaximumPoolSize();
-
- int expected = Integer.parseInt( props.getProperty( "thread_pool.default.maximumPoolSize" ) );
- assertEquals( expected, max );
}
/**
@@ -135,40 +84,4 @@ public class ThreadPoolManagerUnitTest
assertTrue( "Should have name in list.", names.contains( poolName1 ) );
assertTrue( "Should have name in list.", names.contains( poolName2 ) );
}
-
- /**
- * Verify that if we specify not to use a buffer boundary that we get a
- * linked queue.
- *
- */
-// public void testNoBoundary()
-// {
-// ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
-// ThreadPoolManager mgr = ThreadPoolManager.getInstance();
-// assertNotNull( mgr );
-//
-// ThreadPoolExecutor pool = mgr.getPool( "nobound" );
-// assertNotNull( "Should have gotten back a pool.", pool );
-//
-// assertTrue( "Should have a linked queue and not a bounded buffer.", pool.getQueue() instanceof LinkedQueue );
-// }
-
- /**
- * Verify that if we specify useBoundary=true that we get a BoundedBuffer.
- *
- */
-// public void testWithBoundary()
-// {
-// // SETUP
-// ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
-// ThreadPoolManager mgr = ThreadPoolManager.getInstance();
-// assertNotNull( mgr );
-//
-// // DO WORK
-// ThreadPoolExecutor pool = mgr.getPool( "withbound" );
-//
-// // VERIFY
-// assertNotNull( "Should have gotten back a pool.", pool );
-// assertTrue( "Should have a BoundedBuffer and not a linked queue.", pool.getQueue() instanceof BoundedBuffer );
-// }
}