You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by as...@apache.org on 2008/09/08 21:26:40 UTC
svn commit: r693210 [1/2] - in /jakarta/jcs/trunk: ./ src/conf/
src/java/org/apache/jcs/auxiliary/ src/java/org/apache/jcs/auxiliary/disk/
src/java/org/apache/jcs/auxiliary/disk/block/
src/java/org/apache/jcs/auxiliary/disk/indexed/ src/java/org/apache...
Author: asmuts
Date: Mon Sep 8 12:26:37 2008
New Revision: 693210
URL: http://svn.apache.org/viewvc?rev=693210&view=rev
Log:
Making sure that all the disk cache managers are configuring the disk caches with the factgory supplied event logger and element serializer.
Added:
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java (contents, props changed)
- copied, changed from r686881, jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java
Removed:
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheUtils.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java
Modified:
jakarta/jcs/trunk/project.properties
jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf
jakarta/jcs/trunk/src/conf/remote.cache.ccf
jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/AbstractJCSWorkerHelper.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/JCSServletContextListener.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SingleLinkedList.java
jakarta/jcs/trunk/src/test/org/apache/jcs/ConcurrentRemovalLoadTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java
jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java
jakarta/jcs/trunk/xdocs/CacheEventLogging.xml
jakarta/jcs/trunk/xdocs/changes.xml
Modified: jakarta/jcs/trunk/project.properties
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/project.properties?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/project.properties (original)
+++ jakarta/jcs/trunk/project.properties Mon Sep 8 12:26:37 2008
@@ -31,8 +31,8 @@
# -------------------------------------------------------------------
# Compilation options
# -------------------------------------------------------------------
-maven.compile.source = 1.3
-maven.compile.target = 1.3
+maven.compile.source = 1.4
+maven.compile.target = 1.4
# Add information on compilation options to the Manifest
maven.jar.manifest.attributes.list=X-Compile-Source-JDK,X-Compile-Target-JDK
@@ -65,6 +65,11 @@
maven.junit.jvmargs=-Xmx256m
# -------------------------------------------------------------------
+# Cobertura
+# -------------------------------------------------------------------
+maven.cobertura.datafile=${basedir}/cobertura.ser
+
+# -------------------------------------------------------------------
# C H E C K S T Y L E P R O P E R T I E S
# -------------------------------------------------------------------
maven.checkstyle.properties = ${basedir}/checkstyle.xml
Modified: jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf (original)
+++ jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf Mon Sep 8 12:26:37 2008
@@ -105,7 +105,7 @@
jcs.auxiliary.RC.attributes.GetTimeoutMillis=500
jcs.auxiliary.RC.attributes.ThreadPoolName=remote_cache_client
jcs.auxiliary.RC.attributes.GetOnly=false
-jcs.auxiliary.RC.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLoggerImpl
+jcs.auxiliary.RC.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLogger
jcs.auxiliary.RC.cacheeventlogger.attributes.logCategoryName=test.RCCEventLogCategory
Modified: jakarta/jcs/trunk/src/conf/remote.cache.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/remote.cache.ccf?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/conf/remote.cache.ccf (original)
+++ jakarta/jcs/trunk/src/conf/remote.cache.ccf Mon Sep 8 12:26:37 2008
@@ -21,7 +21,7 @@
registry.port=1101
remote.cache.service.port=1101
remote.cluster.LocalClusterConsistency=true
-#remote.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLoggerImpl
+#remote.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLogger
#remote.cacheeventlogger.attributes.logCategoryName=TestEventLogCategory
# #############################################################
Modified: jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf (original)
+++ jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf Mon Sep 8 12:26:37 2008
@@ -21,7 +21,7 @@
registry.port=1101
remote.cache.service.port=1101
remote.cluster.LocalClusterConsistency=true
-remote.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLoggerImpl
+remote.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLogger
remote.cacheeventlogger.attributes.logCategoryName=test.RCSEventLogCategory
# #############################################################
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java Mon Sep 8 12:26:37 2008
@@ -51,9 +51,9 @@
/**
* Logs an event if an event logger is configured.
* <p>
- * @param regionName
+ * @param regionName
* @param key
- * @param eventName
+ * @param eventName
* @return ICacheEvent
*/
protected ICacheEvent createICacheEvent( String regionName, Serializable key, String eventName )
@@ -129,13 +129,38 @@
}
/**
+ * Allows it to be injected.
+ * <p>
+ * @return cacheEventLogger
+ */
+ public ICacheEventLogger getCacheEventLogger()
+ {
+ return this.cacheEventLogger;
+ }
+
+ /**
* Allows you to inject a custom serializer. A good example would be a compressing standard
* serializer.
* <p>
+ * Does not allow you to set it to null.
+ * <p>
* @param elementSerializer
*/
public void setElementSerializer( IElementSerializer elementSerializer )
{
- this.elementSerializer = elementSerializer;
+ if ( elementSerializer != null )
+ {
+ this.elementSerializer = elementSerializer;
+ }
+ }
+
+ /**
+ * Allows it to be injected.
+ * <p>
+ * @return elementSerializer
+ */
+ public IElementSerializer getElementSerializer()
+ {
+ return this.elementSerializer;
}
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java Mon Sep 8 12:26:37 2008
@@ -2,10 +2,13 @@
import java.util.Properties;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.jcs.utils.config.OptionConverter;
import org.apache.jcs.utils.config.PropertySetter;
+import org.apache.jcs.utils.serialization.StandardSerializer;
/**
* Configuration util for auxiliary caches. I plan to move the auxiliary configuration from the
@@ -13,6 +16,9 @@
*/
public class AuxiliaryCacheConfigurator
{
+ /** The logger. */
+ private final static Log log = LogFactory.getLog( AuxiliaryCacheConfigurator.class );
+
/** .attributes */
public final static String ATTRIBUTE_PREFIX = ".attributes";
@@ -44,12 +50,23 @@
// auxFactory was not previously initialized.
String eventLoggerClassName = auxPrefix + CACHE_EVENT_LOGGER_PREFIX;
cacheEventLogger = (ICacheEventLogger) OptionConverter
- .instantiateByKey( props, eventLoggerClassName, org.apache.jcs.engine.logging.behavior.ICacheEventLogger.class,
- null );
+ .instantiateByKey( props, eventLoggerClassName,
+ org.apache.jcs.engine.logging.behavior.ICacheEventLogger.class, null );
if ( cacheEventLogger != null )
{
String cacheEventLoggerAttributePrefix = auxPrefix + CACHE_EVENT_LOGGER_PREFIX + ATTRIBUTE_PREFIX;
PropertySetter.setProperties( cacheEventLogger, props, cacheEventLoggerAttributePrefix + "." );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Using custom cache event logger [" + cacheEventLogger + "] for auxiliary [" + auxPrefix + "]" );
+ }
+ }
+ else
+ {
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "No cache event logger defined for auxiliary [" + auxPrefix + "]" );
+ }
}
return cacheEventLogger;
}
@@ -76,6 +93,20 @@
{
String cacheEventLoggerAttributePrefix = auxPrefix + SERIALIZER_PREFIX + ATTRIBUTE_PREFIX;
PropertySetter.setProperties( elementSerializer, props, cacheEventLoggerAttributePrefix + "." );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Using custom element serializer [" + elementSerializer + "] for auxiliary [" + auxPrefix
+ + "]" );
+ }
+ }
+ else
+ {
+ // use the default standard serializer
+ elementSerializer = new StandardSerializer();
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Using standard serializer [" + elementSerializer + "] for auxiliary [" + auxPrefix + "]" );
+ }
}
return elementSerializer;
}
Added: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheManager.java?rev=693210&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheManager.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheManager.java Mon Sep 8 12:26:37 2008
@@ -0,0 +1,51 @@
+package org.apache.jcs.auxiliary.disk;
+
+import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
+import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
+
+/** Common disk cache methods and properties. */
+public abstract class AbstractDiskCacheManager
+ implements AuxiliaryCacheManager
+{
+ /** Don't change. */
+ private static final long serialVersionUID = 7562753543611662136L;
+
+ /** The event logger. */
+ private ICacheEventLogger cacheEventLogger;
+
+ /** The serializer. */
+ private IElementSerializer elementSerializer;
+
+ /**
+ * @param cacheEventLogger the cacheEventLogger to set
+ */
+ public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
+ {
+ this.cacheEventLogger = cacheEventLogger;
+ }
+
+ /**
+ * @return the cacheEventLogger
+ */
+ public ICacheEventLogger getCacheEventLogger()
+ {
+ return cacheEventLogger;
+ }
+
+ /**
+ * @param elementSerializer the elementSerializer to set
+ */
+ public void setElementSerializer( IElementSerializer elementSerializer )
+ {
+ this.elementSerializer = elementSerializer;
+ }
+
+ /**
+ * @return the elementSerializer
+ */
+ public IElementSerializer getElementSerializer()
+ {
+ return elementSerializer;
+ }
+}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java Mon Sep 8 12:26:37 2008
@@ -27,6 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.utils.serialization.StandardSerializer;
import org.apache.jcs.utils.struct.SingleLinkedList;
@@ -59,8 +60,8 @@
/** Empty blocks that can be reused. */
private SingleLinkedList emptyBlocks = new SingleLinkedList();
- /** Handles serializing the objects */
- private static final StandardSerializer SERIALIZER = new StandardSerializer();
+ /** The serializer. Uses a standard serializer by default. */
+ protected IElementSerializer elementSerializer = new StandardSerializer();
/** Location of the spot on disk */
private final String filepath;
@@ -78,9 +79,10 @@
* Constructor for the Disk object
* <p>
* @param file
+ * @param elementSerializer
* @exception FileNotFoundException
*/
- public BlockDisk( File file )
+ public BlockDisk( File file, IElementSerializer elementSerializer )
throws FileNotFoundException
{
this( file, DEFAULT_BLOCK_SIZE_BYTES );
@@ -88,7 +90,7 @@
{
log.info( "Used default block size [" + DEFAULT_BLOCK_SIZE_BYTES + "]" );
}
-
+ this.elementSerializer = elementSerializer;
}
/**
@@ -132,7 +134,7 @@
throws IOException
{
// serialize the object
- byte[] data = SERIALIZER.serialize( object );
+ byte[] data = elementSerializer.serialize( object );
this.addToPutBytes( data.length );
this.incrementPutCount();
@@ -260,7 +262,7 @@
}
}
- return (Serializable) SERIALIZER.deSerialize( data );
+ return (Serializable) elementSerializer.deSerialize( data );
}
/**
@@ -421,21 +423,6 @@
}
/**
- * Returns the serialized form of the given object in a byte array.
- * <p>
- * Use the Serilizer abstraction layer.
- * <p>
- * @return a byte array of the serialized object.
- * @param obj
- * @exception IOException
- */
- protected static byte[] serialize( Serializable obj )
- throws IOException
- {
- return SERIALIZER.serialize( obj );
- }
-
- /**
* @return Returns the numberOfBlocks.
*/
protected int getNumberOfBlocks()
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java Mon Sep 8 12:26:37 2008
@@ -121,7 +121,7 @@
}
else
{
- this.dataFile = new BlockDisk( new File( rootDirectory, fileName + ".data" ) );
+ this.dataFile = new BlockDisk( new File( rootDirectory, fileName + ".data" ), getElementSerializer() );
}
keyStore = new BlockDiskKeyStore( this.blockDiskCacheAttributes, this );
@@ -599,7 +599,7 @@
}
else
{
- this.dataFile = new BlockDisk( new File( rootDirectory, fileName + ".data" ) );
+ this.dataFile = new BlockDisk( new File( rootDirectory, fileName + ".data" ), getElementSerializer() );
}
this.keyStore.reset();
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheFactory.java Mon Sep 8 12:26:37 2008
@@ -64,7 +64,7 @@
{
log.debug( "Creating DiskCache for attributes = " + idca );
}
- BlockDiskCacheManager dcm = BlockDiskCacheManager.getInstance( idca );
+ BlockDiskCacheManager dcm = BlockDiskCacheManager.getInstance( idca, cacheEventLogger, elementSerializer );
return dcm.getCache( idca );
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java Mon Sep 8 12:26:37 2008
@@ -19,21 +19,20 @@
* under the License.
*/
-import java.util.Enumeration;
import java.util.Hashtable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.auxiliary.AuxiliaryCache;
-import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
-import org.apache.jcs.engine.behavior.ICache;
+import org.apache.jcs.auxiliary.disk.AbstractDiskCacheManager;
+import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
- * Cache manager for BlockDiskCaches. This manages the instances of the disk
- * cache.
+ * Cache manager for BlockDiskCaches. This manages the instances of the disk cache.
*/
public class BlockDiskCacheManager
- implements AuxiliaryCacheManager
+ extends AbstractDiskCacheManager
{
/** Don't change */
private static final long serialVersionUID = -4153287154512274626L;
@@ -41,9 +40,6 @@
/** The logger */
private final static Log log = LogFactory.getLog( BlockDiskCacheManager.class );
- /** ? */
- private static int clients;
-
/** The singleton instance */
private static BlockDiskCacheManager instance;
@@ -56,43 +52,45 @@
/**
* Constructor for the BlockDiskCacheManager object
* <p>
- * @param defaultCacheAttributes
- * Default attributes for caches managed by the instance.
+ * @param defaultCacheAttributes Default attributes for caches managed by the instance.
+ * @param cacheEventLogger
+ * @param elementSerializer
*/
- private BlockDiskCacheManager( BlockDiskCacheAttributes defaultCacheAttributes )
+ private BlockDiskCacheManager( BlockDiskCacheAttributes defaultCacheAttributes, ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
this.defaultCacheAttributes = defaultCacheAttributes;
+ setElementSerializer( elementSerializer );
+ setCacheEventLogger( cacheEventLogger );
}
/**
* Gets the singleton instance of the manager
* <p>
- * @param defaultCacheAttributes
- * If the instance has not yet been created, it will be
+ * @param defaultCacheAttributes If the instance has not yet been created, it will be
* initialized with this set of default attributes.
+ * @param cacheEventLogger
+ * @param elementSerializer
* @return The instance value
*/
- public static BlockDiskCacheManager getInstance( BlockDiskCacheAttributes defaultCacheAttributes )
+ public static BlockDiskCacheManager getInstance( BlockDiskCacheAttributes defaultCacheAttributes,
+ ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
synchronized ( BlockDiskCacheManager.class )
{
if ( instance == null )
{
- instance = new BlockDiskCacheManager( defaultCacheAttributes );
+ instance = new BlockDiskCacheManager( defaultCacheAttributes, cacheEventLogger, elementSerializer );
}
}
-
- clients++;
-
return instance;
}
/**
- * Gets an BlockDiskCache for the supplied name using the default
- * attributes.
+ * Gets an BlockDiskCache for the supplied name using the default attributes.
* <p>
- * @param cacheName
- * Name that will be used when creating attributes.
+ * @param cacheName Name that will be used when creating attributes.
* @return A cache.
*/
public AuxiliaryCache getCache( String cacheName )
@@ -105,12 +103,10 @@
}
/**
- * Get an BlockDiskCache for the supplied attributes. Will provide an
- * existing cache for the name attribute if one has been created, or will
- * create a new cache.
+ * Get an BlockDiskCache for the supplied attributes. Will provide an existing cache for the
+ * name attribute if one has been created, or will create a new cache.
* <p>
- * @param cacheAttributes
- * Attributes the cache should have.
+ * @param cacheAttributes Attributes the cache should have.
* @return A cache, either from the existing set or newly created.
*/
public AuxiliaryCache getCache( BlockDiskCacheAttributes cacheAttributes )
@@ -134,7 +130,8 @@
if ( cache == null )
{
cache = new BlockDiskCache( cacheAttributes );
-
+ cache.setCacheEventLogger( getCacheEventLogger() );
+ cache.setElementSerializer( getElementSerializer() );
caches.put( cacheName, cache );
}
}
@@ -143,30 +140,6 @@
}
/**
- * Disposes the cache with the given name, if found in the set of managed
- * caches.
- * <p>
- * @param cacheName
- * Name of cache to dispose.
- */
- public void freeCache( String cacheName )
- {
- ICache cache = (ICache) caches.get( cacheName );
-
- if ( cache != null )
- {
- try
- {
- cache.dispose();
- }
- catch ( Exception e )
- {
- log.error( "Failure disposing cache: " + cacheName, e );
- }
- }
- }
-
- /**
* Gets the cacheType attribute of the DiskCacheManager object
* <p>
* @return The cacheType value
@@ -175,40 +148,4 @@
{
return DISK_CACHE;
}
-
- /**
- * Releases the cache manager instance. When all clients have released the
- * cache manager, all contained caches will be disposed.
- */
- public void release()
- {
- clients--;
-
- if ( --clients != 0 )
- {
- return;
- }
-
- synchronized ( caches )
- {
- Enumeration allCaches = caches.elements();
-
- while ( allCaches.hasMoreElements() )
- {
- ICache cache = (ICache) allCaches.nextElement();
-
- if ( cache != null )
- {
- try
- {
- cache.dispose();
- }
- catch ( Exception e )
- {
- log.error( "Failure disposing cache: " + cache.getCacheName(), e );
- }
- }
- }
- }
- }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java Mon Sep 8 12:26:37 2008
@@ -27,20 +27,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.utils.serialization.StandardSerializer;
-/**
- * Provides thread safe access to the underlying random access file.
- */
+/** Provides thread safe access to the underlying random access file. */
class IndexedDisk
{
- /**
- * The size of the header in bytes. The header describes the length of the entry.
- */
+ /** The size of the header in bytes. The header describes the length of the entry. */
public static final int RECORD_HEADER = 4;
- /** Serializes. */
- private static final StandardSerializer SERIALIZER = new StandardSerializer();
+ /** The serializer. Uses a standard serializer by default. */
+ protected IElementSerializer elementSerializer = new StandardSerializer();
/** The logger */
private static final Log log = LogFactory.getLog( IndexedDisk.class );
@@ -58,12 +55,14 @@
* Constructor for the Disk object
* <p>
* @param file
+ * @param elementSerializer
* @exception FileNotFoundException
*/
- public IndexedDisk( File file )
+ public IndexedDisk( File file, IElementSerializer elementSerializer )
throws FileNotFoundException
{
this.filepath = file.getAbsolutePath();
+ this.elementSerializer = elementSerializer;
raf = new RandomAccessFile( filepath, "rw" );
}
@@ -117,7 +116,7 @@
raf.readFully( data = new byte[ded.len] );
}
- return (Serializable) SERIALIZER.deSerialize( data );
+ return (Serializable) elementSerializer.deSerialize( data );
}
/**
@@ -211,7 +210,7 @@
protected boolean writeObject( Serializable obj, long pos )
throws IOException
{
- byte[] data = SERIALIZER.serialize( obj );
+ byte[] data = elementSerializer.serialize( obj );
write( new IndexedDiskElementDescriptor( pos, data.length ), data );
return true;
}
@@ -279,21 +278,6 @@
}
/**
- * Returns the serialized form of the given object in a byte array.
- * <p>
- * Use the Serilizer abstraction layer.
- * <p>
- * @return a byte array of the serialized object.
- * @param obj
- * @exception IOException
- */
- protected static byte[] serialize( Serializable obj )
- throws IOException
- {
- return SERIALIZER.serialize( obj );
- }
-
- /**
* Truncates the file to a given length.
* <p>
* @param length the new length of the file
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Mon Sep 8 12:26:37 2008
@@ -169,9 +169,9 @@
try
{
- this.dataFile = new IndexedDisk( new File( rafDir, fileName + ".data" ) );
+ this.dataFile = new IndexedDisk( new File( rafDir, fileName + ".data" ), getElementSerializer() );
- this.keyFile = new IndexedDisk( new File( rafDir, fileName + ".key" ) );
+ this.keyFile = new IndexedDisk( new File( rafDir, fileName + ".key" ), getElementSerializer() );
// If the key file has contents, try to initialize the keys
// from it. In no keys are loaded reset the data file.
@@ -444,7 +444,7 @@
try
{
- byte[] data = IndexedDisk.serialize( ce );
+ byte[] data = getElementSerializer().serialize( ce );
// make sure this only locks for one particular cache region
storageLock.writeLock().acquire();
@@ -873,9 +873,9 @@
File keyFileTemp = new File( rafDir, fileName + ".key" );
keyFileTemp.delete();
- dataFile = new IndexedDisk( new File( rafDir, fileName + ".data" ) );
+ dataFile = new IndexedDisk( new File( rafDir, fileName + ".data" ), getElementSerializer() );
- keyFile = new IndexedDisk( new File( rafDir, fileName + ".key" ) );
+ keyFile = new IndexedDisk( new File( rafDir, fileName + ".key" ), getElementSerializer() );
initRecycleBin();
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheFactory.java Mon Sep 8 12:26:37 2008
@@ -64,7 +64,7 @@
{
log.debug( "Creating DiskCache for attributes = " + idca );
}
- IndexedDiskCacheManager dcm = IndexedDiskCacheManager.getInstance( idca );
+ IndexedDiskCacheManager dcm = IndexedDiskCacheManager.getInstance( idca, cacheEventLogger, elementSerializer );
return dcm.getCache( idca );
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java Mon Sep 8 12:26:37 2008
@@ -19,21 +19,20 @@
* under the License.
*/
-import java.util.Enumeration;
import java.util.Hashtable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.auxiliary.AuxiliaryCache;
-import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
-import org.apache.jcs.engine.behavior.ICache;
+import org.apache.jcs.auxiliary.disk.AbstractDiskCacheManager;
+import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
- * Cache manager for IndexedDiskCaches. This manages the instances of the disk
- * cache.
+ * Cache manager for IndexedDiskCaches. This manages the instances of the disk cache.
*/
public class IndexedDiskCacheManager
- implements AuxiliaryCacheManager
+ extends AbstractDiskCacheManager
{
/** Don't change */
private static final long serialVersionUID = -4153287154512274626L;
@@ -41,58 +40,57 @@
/** The logger */
private final static Log log = LogFactory.getLog( IndexedDiskCacheManager.class );
- /** How many checkout have we received. Decremented on release. This isn't very useful. */
- private static int clients;
-
/** Singleton instance. */
private static IndexedDiskCacheManager instance;
/** Each region has an entry here. */
private Hashtable caches = new Hashtable();
- /** User configurable atributes */
+ /** User configurable attributes */
private IndexedDiskCacheAttributes defaultCacheAttributes;
/**
* Constructor for the IndexedDiskCacheManager object
* <p>
- * @param defaultCacheAttributes
- * Default attributes for caches managed by the instance.
+ * @param defaultCacheAttributes Default attributes for caches managed by the instance.
+ * @param cacheEventLogger
+ * @param elementSerializer
*/
- private IndexedDiskCacheManager( IndexedDiskCacheAttributes defaultCacheAttributes )
+ private IndexedDiskCacheManager( IndexedDiskCacheAttributes defaultCacheAttributes,
+ ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
{
this.defaultCacheAttributes = defaultCacheAttributes;
+ setElementSerializer( elementSerializer );
+ setCacheEventLogger( cacheEventLogger );
}
/**
* Gets the singleton instance of the manager
* <p>
- * @param defaultCacheAttributes
- * If the instance has not yet been created, it will be
+ * @param defaultCacheAttributes If the instance has not yet been created, it will be
* initialized with this set of default attributes.
+ * @param cacheEventLogger
+ * @param elementSerializer
* @return The instance value
*/
- public static IndexedDiskCacheManager getInstance( IndexedDiskCacheAttributes defaultCacheAttributes )
+ public static IndexedDiskCacheManager getInstance( IndexedDiskCacheAttributes defaultCacheAttributes,
+ ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
synchronized ( IndexedDiskCacheManager.class )
{
if ( instance == null )
{
- instance = new IndexedDiskCacheManager( defaultCacheAttributes );
+ instance = new IndexedDiskCacheManager( defaultCacheAttributes, cacheEventLogger, elementSerializer );
}
}
-
- clients++;
-
return instance;
}
/**
- * Gets an IndexedDiskCache for the supplied name using the default
- * attributes.
+ * Gets an IndexedDiskCache for the supplied name using the default attributes.
* <p>
- * @param cacheName
- * Name that will be used when creating attributes.
+ * @param cacheName Name that will be used when creating attributes.
* @return A cache.
*/
public AuxiliaryCache getCache( String cacheName )
@@ -105,12 +103,10 @@
}
/**
- * Get an IndexedDiskCache for the supplied attributes. Will provide an
- * existing cache for the name attribute if one has been created, or will
- * create a new cache.
+ * Get an IndexedDiskCache for the supplied attributes. Will provide an existing cache for the
+ * name attribute if one has been created, or will create a new cache.
* <p>
- * @param cacheAttributes
- * Attributes the cache should have.
+ * @param cacheAttributes Attributes the cache should have.
* @return A cache, either from the existing set or newly created.
*/
public AuxiliaryCache getCache( IndexedDiskCacheAttributes cacheAttributes )
@@ -134,7 +130,8 @@
if ( cache == null )
{
cache = new IndexedDiskCache( cacheAttributes );
-
+ cache.setCacheEventLogger( getCacheEventLogger() );
+ cache.setElementSerializer( getElementSerializer() );
caches.put( cacheName, cache );
}
}
@@ -143,30 +140,6 @@
}
/**
- * Disposes the cache with the given name, if found in the set of managed
- * caches.
- * <p>
- * @param cacheName
- * Name of cache to dispose.
- */
- public void freeCache( String cacheName )
- {
- ICache cache = (ICache) caches.get( cacheName );
-
- if ( cache != null )
- {
- try
- {
- cache.dispose();
- }
- catch ( Exception e )
- {
- log.error( "Failure disposing cache: " + cacheName, e );
- }
- }
- }
-
- /**
* Gets the cacheType attribute of the DiskCacheManager object
* <p>
* @return The cacheType value
@@ -175,38 +148,4 @@
{
return DISK_CACHE;
}
-
- /**
- * Releases the cache manager instance. When all clients have released the
- * cache manager, all contained caches will be disposed.
- */
- public void release()
- {
- if ( --clients != 0 )
- {
- return;
- }
-
- synchronized ( caches )
- {
- Enumeration allCaches = caches.elements();
-
- while ( allCaches.hasMoreElements() )
- {
- ICache cache = (ICache) allCaches.nextElement();
-
- if ( cache != null )
- {
- try
- {
- cache.dispose();
- }
- catch ( Exception e )
- {
- log.error( "Failure disposing cache: " + cache.getCacheName(), e );
- }
- }
- }
- }
- }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java Mon Sep 8 12:26:37 2008
@@ -40,23 +40,24 @@
/**
* This factory method should create an instance of the mysqlcache.
* <p>
- * @param rawAttr
- * @param arg1
- * @param cacheEventLogger
- * @param elementSerializer
+ * @param rawAttr
+ * @param arg1
+ * @param cacheEventLogger
+ * @param elementSerializer
* @return AuxiliaryCache
*/
public AuxiliaryCache createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager arg1,
ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
{
- JDBCDiskCacheManager mgr = JDBCDiskCacheManager.getInstance( (JDBCDiskCacheAttributes) rawAttr );
+ JDBCDiskCacheManager mgr = JDBCDiskCacheManager.getInstance( (JDBCDiskCacheAttributes) rawAttr,
+ cacheEventLogger, elementSerializer );
return mgr.getCache( (JDBCDiskCacheAttributes) rawAttr );
}
/**
* The name of the factory.
* <p>
- * @param nameArg
+ * @param nameArg
*/
public void setName( String nameArg )
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java Mon Sep 8 12:26:37 2008
@@ -22,6 +22,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
* This manages instances of the jdbc disk cache. It maintains one for each region. One for all
@@ -46,14 +48,19 @@
* Constructor for the HSQLCacheManager object
* <p>
* @param cattr
+ * @param cacheEventLogger
+ * @param elementSerializer
*/
- private JDBCDiskCacheManager( JDBCDiskCacheAttributes cattr )
+ private JDBCDiskCacheManager( JDBCDiskCacheAttributes cattr, ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
if ( log.isInfoEnabled() )
{
log.info( "Creating JDBCDiskCacheManager with " + cattr );
}
defaultJDBCDiskCacheAttributes = cattr;
+ setElementSerializer( elementSerializer );
+ setCacheEventLogger( cacheEventLogger );
}
/**
@@ -70,15 +77,18 @@
* Gets the instance attribute of the HSQLCacheManager class
* <p>
* @param cattr
+ * @param cacheEventLogger
+ * @param elementSerializer
* @return The instance value
*/
- public static JDBCDiskCacheManager getInstance( JDBCDiskCacheAttributes cattr )
+ public static JDBCDiskCacheManager getInstance( JDBCDiskCacheAttributes cattr, ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
synchronized ( JDBCDiskCacheManager.class )
{
if ( instance == null )
{
- instance = new JDBCDiskCacheManager( cattr );
+ instance = new JDBCDiskCacheManager( cattr, cacheEventLogger, elementSerializer );
}
}
clients++;
@@ -102,7 +112,7 @@
* Creates a JDBCDiskCache using the supplied attributes.
* <p>
* @param cattr
- * @param tableState
+ * @param tableState
* @return AuxiliaryCache
*/
protected AuxiliaryCache createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState )
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java Mon Sep 8 12:26:37 2008
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.auxiliary.AuxiliaryCache;
-import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
+import org.apache.jcs.auxiliary.disk.AbstractDiskCacheManager;
import EDU.oswego.cs.dl.util.concurrent.ClockDaemon;
import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
@@ -39,7 +39,7 @@
* @author Aaron Smuts
*/
public abstract class JDBCDiskCacheManagerAbstractTemplate
- implements AuxiliaryCacheManager
+ extends AbstractDiskCacheManager
{
/** Don't change. */
private static final long serialVersionUID = 218557927622128905L;
@@ -47,10 +47,10 @@
/** The logger. */
private static final Log log = LogFactory.getLog( JDBCDiskCacheManagerAbstractTemplate.class );
- /** Incremented on getIntance, decremented on release. */
+ /** Incremented on getIntance, decremented on release. */
protected static int clients;
- /** A map of JDBCDiskCache objects to region names. */
+ /** A map of JDBCDiskCache objects to region names. */
protected static Hashtable caches = new Hashtable();
/**
@@ -59,7 +59,7 @@
*/
protected static Hashtable tableStates = new Hashtable();
- /** The background disk shrinker, one for all regions. */
+ /** The background disk shrinker, one for all regions. */
private ClockDaemon shrinkerDaemon;
/**
@@ -104,7 +104,8 @@
}
diskCache = createJDBCDiskCache( cattr, tableState );
-
+ diskCache.setCacheEventLogger( getCacheEventLogger() );
+ diskCache.setElementSerializer( getElementSerializer() );
caches.put( cattr.getCacheName(), diskCache );
}
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java Mon Sep 8 12:26:37 2008
@@ -41,9 +41,7 @@
/** A set of JDBCDiskCache objects to call deleteExpired on. */
private Set shrinkSet = Collections.synchronizedSet( new HashSet() );
- /**
- * Default time period to use.
- */
+ /** Default time period to use. */
private static final long DEFAULT_PAUSE_BETWEEN_REGION_CALLS_MILLIS = 5000;
/**
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java Mon Sep 8 12:26:37 2008
@@ -67,7 +67,8 @@
public AuxiliaryCache createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager arg1,
ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
{
- JDBCDiskCacheManager mgr = JDBCDiskCacheManager.getInstance( (JDBCDiskCacheAttributes) rawAttr );
+ JDBCDiskCacheManager mgr = JDBCDiskCacheManager.getInstance( (JDBCDiskCacheAttributes) rawAttr,
+ cacheEventLogger, elementSerializer );
try
{
setupDatabase( (JDBCDiskCacheAttributes) rawAttr );
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java Mon Sep 8 12:26:37 2008
@@ -49,7 +49,7 @@
public AuxiliaryCache createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager cacheManager,
ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
{
- MySQLDiskCacheManager mgr = MySQLDiskCacheManager.getInstance( (MySQLDiskCacheAttributes) rawAttr );
+ MySQLDiskCacheManager mgr = MySQLDiskCacheManager.getInstance( (MySQLDiskCacheAttributes) rawAttr, cacheEventLogger, elementSerializer );
return mgr.getCache( (MySQLDiskCacheAttributes) rawAttr );
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java Mon Sep 8 12:26:37 2008
@@ -31,6 +31,8 @@
import org.apache.jcs.auxiliary.disk.jdbc.TableState;
import org.apache.jcs.auxiliary.disk.jdbc.mysql.util.ScheduleFormatException;
import org.apache.jcs.auxiliary.disk.jdbc.mysql.util.ScheduleParser;
+import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
* This manages instances of the MySQL jdbc disk cache. It maintains one for each region. One for
@@ -64,14 +66,19 @@
* Constructor for the HSQLCacheManager object
* <p>
* @param cattr
+ * @param cacheEventLogger
+ * @param elementSerializer
*/
- private MySQLDiskCacheManager( MySQLDiskCacheAttributes cattr )
+ private MySQLDiskCacheManager( MySQLDiskCacheAttributes cattr,
+ ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
{
if ( log.isInfoEnabled() )
{
log.info( "Creating MySQLDiskCacheManager with " + cattr );
}
defaultJDBCDiskCacheAttributes = cattr;
+ setElementSerializer( elementSerializer );
+ setCacheEventLogger( cacheEventLogger );
}
/**
@@ -88,15 +95,19 @@
* Gets the instance attribute of the HSQLCacheManager class
* <p>
* @param cattr
+ * @param cacheEventLogger
+ * @param elementSerializer
* @return The instance value
*/
- public static MySQLDiskCacheManager getInstance( MySQLDiskCacheAttributes cattr )
+ public static MySQLDiskCacheManager getInstance( MySQLDiskCacheAttributes cattr,
+ ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
synchronized ( MySQLDiskCacheManager.class )
{
if ( instance == null )
{
- instance = new MySQLDiskCacheManager( cattr );
+ instance = new MySQLDiskCacheManager( cattr, cacheEventLogger, elementSerializer );
}
}
clients++;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java Mon Sep 8 12:26:37 2008
@@ -147,6 +147,8 @@
* <p>
* @param lcaA
* @param cacheMgr
+ * @param cacheEventLogger
+ * @param elementSerializer
*/
private LateralTCPCacheManager( ITCPLateralCacheAttributes lcaA, ICompositeCacheManager cacheMgr,
ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java Mon Sep 8 12:26:37 2008
@@ -50,21 +50,28 @@
*/
private String failoverServers = "";
+ /** Cluster chain */
private String clusterServers = "";
+ /** callback */
private int localPort = 0;
+ /** THe type of remote cache, local or cluster */
private int remoteType = LOCAL;
- // what failover server we are connected to.
+ /** what failover server we are connected to. */
private int failoverIndex = 0;
+ /** Array of failover server addresses */
private String[] failovers;
+ /** Should we issue a local remove if we get a put from a remote server */
private boolean removeUponRemotePut = true;
+ /** Can we receive from or put to the remote. this probably shouldn't be used. Use receive. */
private boolean getOnly = false;
+ /** Should we put and get from the clusters. */
private boolean localClusterConsistency = false;
/** default name is remote_cache_client */
@@ -76,8 +83,13 @@
/** read and connect timeout */
private int rmiSocketFactoryTimeoutMillis = DEFAULT_RMI_SOCKET_FACTORY_TIMEOUT_MILLIS;
+ /**
+ * Can we receive from the server. You might have a 0 local store and keep everything on the
+ * remote. If so, you don't want to be notified of updates.
+ */
private boolean receive = DEFAULT_RECEIVE;
+ /** If the primary fails, we will queue items before reconnect. This limits the number of items that can be queued. */
private int zombieQueueMaxSize = DEFAULT_ZOMBIE_QUEUE_MAX_SIZE;
/** Default constructor for the RemoteCacheAttributes object */
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheAdaptor.java Mon Sep 8 12:26:37 2008
@@ -35,8 +35,10 @@
public class CacheAdaptor
implements ICacheListener
{
+ /** The logger */
private final static Log log = LogFactory.getLog( CacheAdaptor.class );
+ /** The cache we are adadpting. */
private final ICache cache;
/** The unique id of this listener. */
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElement.java Mon Sep 8 12:26:37 2008
@@ -30,6 +30,7 @@
public class CacheElement
implements ICacheElement, Serializable
{
+ /** Don't change */
private static final long serialVersionUID = -6062305728297627263L;
/** The name of the cache region. This is a namespace. */
@@ -165,5 +166,4 @@
return "[CacheElement: cacheName [" + cacheName + "], key [" + key + "], val [" + val + "], attr [" + attr
+ "]";
}
-
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java Mon Sep 8 12:26:37 2008
@@ -24,13 +24,11 @@
import org.apache.jcs.engine.behavior.ICacheElementSerialized;
import org.apache.jcs.engine.behavior.IElementAttributes;
-
-/**
- * Either serialized value or the value should be null;
- */
+/** Either serialized value or the value should be null; */
public class CacheElementSerialized
implements ICacheElementSerialized
{
+ /** Don't change. */
private static final long serialVersionUID = -7265084818647601874L;
/** The name of the cache region. This is a namespace. */
@@ -43,8 +41,7 @@
private final byte[] serializedValue;
/**
- * These attributes hold information about the element and what it is
- * allowed to do.
+ * These attributes hold information about the element and what it is allowed to do.
*/
private IElementAttributes elementAttributes;
@@ -57,7 +54,7 @@
* @param elementAttributesArg
*/
public CacheElementSerialized( String cacheNameArg, Serializable keyArg, byte[] serializedValueArg,
- IElementAttributes elementAttributesArg )
+ IElementAttributes elementAttributesArg )
{
this.cacheName = cacheNameArg;
this.key = keyArg;
@@ -75,36 +72,26 @@
return this.cacheName;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.ICacheElement#getKey()
- */
+ /** @return Serializable */
public Serializable getKey()
{
return this.key;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.ICacheElementSerialized#getSerializedValue()
- */
+ /** @return byte[] */
public byte[] getSerializedValue()
{
return this.serializedValue;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.ICacheElement#getElementAttributes()
- */
+ /** @return IElementAttributes */
public IElementAttributes getElementAttributes()
{
return this.elementAttributes;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.ICacheElement#setElementAttributes(org.apache.jcs.engine.behavior.IElementAttributes)
+ /**
+ * @param attr
*/
public void setElementAttributes( IElementAttributes attr )
{
@@ -113,6 +100,8 @@
/**
* Backward compatibility.
+ * <p>
+ * @return Serializable
*/
public Serializable getVal()
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java Mon Sep 8 12:26:37 2008
@@ -31,84 +31,62 @@
import org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
/**
- * This it the element attribute descriptor class. Each element in the cache has
- * an ElementAttribute object associated with it. An ElementAttributes object
- * can be associated with an element in 3 ways:
+ * This it the element attribute descriptor class. Each element in the cache has an ElementAttribute
+ * object associated with it. An ElementAttributes object can be associated with an element in 3
+ * ways:
* <ol>
- * <li>When the item is put into the cache, you can associate an element
- * attributes object.</li>
- * <li>If not attributes object is include when the element is put into the
- * cache, then the default attributes for the region will be used.</li>
- * <li>The element attributes can be reset. This effectively results in a
- * retrieval followed by a put. Hence, this is the same as 1.</li>
+ * <li>When the item is put into the cache, you can associate an element attributes object.</li>
+ * <li>If not attributes object is include when the element is put into the cache, then the default
+ * attributes for the region will be used.</li>
+ * <li>The element attributes can be reset. This effectively results in a retrieval followed by a
+ * put. Hence, this is the same as 1.</li>
* </ol>
- * @version $Id: ILateralCacheTCPListener.java,v 1.2 2002/01/18 22:08:26
*/
public class ElementAttributes
implements IElementAttributes, Serializable, Cloneable
{
+ /** Don't change. */
private static final long serialVersionUID = 7814990748035017441L;
- /**
- * Can this item be flushed to disk
- */
+ /** Can this item be flushed to disk */
public boolean IS_SPOOL = true;
- /**
- * Is this item laterally distributable
- */
+ /** Is this item laterally distributable */
public boolean IS_LATERAL = true;
- /**
- * Can this item be sent to the remote cache
- */
+ /** Can this item be sent to the remote cache */
public boolean IS_REMOTE = true;
/**
- * You can turn off expiration by setting this to true. This causes the
- * cache to bypass both max life and idle time expiration.
+ * You can turn off expiration by setting this to true. This causes the cache to bypass both max
+ * life and idle time expiration.
*/
public boolean IS_ETERNAL = true;
- /**
- * The object version. This is currently not used.
- */
- public long version = 0;
-
- /**
- * Max life seconds
- */
+ /** Max life seconds */
public long maxLifeSeconds = -1;
/**
- * The maximum time an entry can be idle. Setting this to -1 causes the idle
- * time check to be ignored.
+ * The maximum time an entry can be idle. Setting this to -1 causes the idle time check to be
+ * ignored.
*/
public long maxIdleTimeSeconds = -1;
- /**
- * The byte size of the field. Must be manually set.
- */
+ /** The byte size of the field. Must be manually set. */
public int size = 0;
- /**
- * The creation time. This is used to enforce the max life.
- */
+ /** The creation time. This is used to enforce the max life. */
public long createTime = 0;
- /**
- * The last access time. This is used to enforce the max idel time.
- */
+ /** The last access time. This is used to enforce the max idel time. */
public long lastAccessTime = 0;
/**
- * The list of Event handlers to use. This is transient, since the event
- * handlers cannot usually be serialized. This means that you cannot attach
- * a post serialization event to an item.
- * <p>
- * TODO we need to check that when an item is passed to a non-local cache
- * that if the local cache had a copy with event handlers, that those
- * handlers are used.
+ * The list of Event handlers to use. This is transient, since the event handlers cannot usually
+ * be serialized. This means that you cannot attach a post serialization event to an item.
+ * <p>
+ * TODO we need to check that when an item is passed to a non-local cache that if the local
+ * cache had a copy with event handlers, that those handlers are used.
*/
public transient ArrayList eventHandlers;
@@ -130,7 +108,7 @@
{
IS_ETERNAL = attr.IS_ETERNAL;
- // waterfal onto disk, for pure disk set memory to 0
+ // waterfall onto disk, for pure disk set memory to 0
IS_SPOOL = attr.IS_SPOOL;
// lateral
@@ -140,7 +118,7 @@
IS_REMOTE = attr.IS_REMOTE;
maxLifeSeconds = attr.maxLifeSeconds;
- // timetolive
+ // time-to-live
maxIdleTimeSeconds = attr.maxIdleTimeSeconds;
size = attr.size;
}
@@ -204,63 +182,70 @@
return null;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#setVersion(long)
- */
- public void setVersion( long version )
- {
- this.version = version;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#setMaxLifeSeconds(long)
+ /**
+ * Sets the maxLife attribute of the IAttributes object.
+ * <p>
+ * @param mls The new MaxLifeSeconds value
*/
public void setMaxLifeSeconds( long mls )
{
this.maxLifeSeconds = mls;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getMaxLifeSeconds()
+ /**
+ * Sets the maxLife attribute of the IAttributes object. How many seconds it can live after
+ * creation.
+ * <p>
+ * If this is exceeded the element will not be returned, instead it will be removed. It will be
+ * removed on retrieval, or removed actively if the memory shrinker is turned on.
+ * @return The MaxLifeSeconds value
*/
public long getMaxLifeSeconds()
{
return this.maxLifeSeconds;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#setIdleTime(long)
+ /**
+ * Sets the idleTime attribute of the IAttributes object. This is the maximum time the item can
+ * be idle in the cache, that is not accessed.
+ * <p>
+ * If this is exceeded the element will not be returned, instead it will be removed. It will be
+ * removed on retrieval, or removed actively if the memory shrinker is turned on.
+ * @param idle The new idleTime value
*/
public void setIdleTime( long idle )
{
this.maxIdleTimeSeconds = idle;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#setSize(int)
+ /**
+ * 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
*/
public void setSize( int size )
{
this.size = size;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getSize()
+ /**
+ * Gets the size attribute of the IAttributes object
+ * <p>
+ * @return The size value
*/
public int getSize()
{
return size;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getCreateTime()
+ /**
+ * Gets the createTime attribute of the IAttributes object.
+ * <p>
+ * This should be the current time in milliseconds returned by the sysutem call when the element
+ * is put in the cache.
+ * <p>
+ * Putting an item in the cache overrides any existing items.
+ * @return The createTime value
*/
public long getCreateTime()
{
@@ -275,27 +260,21 @@
createTime = System.currentTimeMillis();
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getVersion()
- */
- public long getVersion()
- {
- return version;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getIdleTime()
+ /**
+ * Gets the idleTime attribute of the IAttributes object.
+ * <p>
+ * @return The idleTime value
*/
public long getIdleTime()
{
return this.maxIdleTimeSeconds;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getTimeToLiveSeconds()
+ /**
+ * Gets the time left to live of the IAttributes object.
+ * <p>
+ * This is the (max life + create time) - current time.
+ * @return The TimeToLiveSeconds value
*/
public long getTimeToLiveSeconds()
{
@@ -303,54 +282,62 @@
return ( ( this.getCreateTime() + ( this.getMaxLifeSeconds() * 1000 ) ) - now ) / 1000;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getLastAccessTime()
+ /**
+ * Gets the LastAccess attribute of the IAttributes object.
+ * <p>
+ * @return The LastAccess value.
*/
public long getLastAccessTime()
{
return this.lastAccessTime;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#setLastAccessTimeNow()
+ /**
+ * Sets the LastAccessTime as now of the IElementAttributes object
*/
public void setLastAccessTimeNow()
{
this.lastAccessTime = System.currentTimeMillis();
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getIsSpool()
+ /**
+ * Can this item be spooled to disk
+ * <p>
+ * By default this is true.
+ * @return The spoolable value
*/
public boolean getIsSpool()
{
return this.IS_SPOOL;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#setIsSpool(boolean)
+ /**
+ * Sets the isSpool attribute of the IElementAttributes object
+ * <p>
+ * By default this is true.
+ * @param val The new isSpool value
*/
public void setIsSpool( boolean val )
{
this.IS_SPOOL = val;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#getIsLateral()
+ /**
+ * Is this item laterally distributable. Can it be sent to auxiliaries of type lateral.
+ * <p>
+ * By default this is true.
+ * @return The isLateral value
*/
public boolean getIsLateral()
{
return this.IS_LATERAL;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.IElementAttributes#setIsLateral(boolean)
+ /**
+ * Sets the isLateral attribute of the IElementAttributes object
+ * <p>
+ * By default this is true.
+ * @param val The new isLateral value
*/
public void setIsLateral( boolean val )
{
@@ -368,8 +355,7 @@
/**
* Sets the isRemote attribute of the ElementAttributes object
- * @param val
- * The new isRemote value
+ * @param val The new isRemote value
*/
public void setIsRemote( boolean val )
{
@@ -377,8 +363,7 @@
}
/**
- * You can turn off expiration by setting this to true. The max life value
- * will be ignored.
+ * You can turn off expiration by setting this to true. The max life value will be ignored.
* <p>
* @return true if the item cannot expire.
*/
@@ -388,13 +373,11 @@
}
/**
- * Sets the isEternal attribute of the ElementAttributes object. True means
- * that the item should never expire. If can still be removed if it is the
- * least recently used, and you are using the LRUMemory cache. it just will
- * not be filtered for expiration by the cache hub.
+ * Sets the isEternal attribute of the ElementAttributes object. True means that the item should
+ * never expire. If can still be removed if it is the least recently used, and you are using the
+ * LRUMemory cache. it just will not be filtered for expiration by the cache hub.
* <p>
- * @param val
- * The new isEternal value
+ * @param val The new isEternal value
*/
public void setIsEternal( boolean val )
{
@@ -402,15 +385,13 @@
}
/**
- * Adds a ElementEventHandler. Handler's can be registered for multiple
- * events. A registered handler will be called at every recognized event.
+ * Adds a ElementEventHandler. Handler's can be registered for multiple events. A registered
+ * handler will be called at every recognized event.
* <p>
- * The alternative would be to register handlers for each event. Or maybe
- * The handler interface should have a method to return whether it cares
- * about certain events.
+ * The alternative would be to register handlers for each event. Or maybe The handler interface
+ * should have a method to return whether it cares about certain events.
* <p>
- * @param eventHandler
- * The ElementEventHandler to be added to the list.
+ * @param eventHandler The ElementEventHandler to be added to the list.
*/
public void addElementEventHandler( IElementEventHandler eventHandler )
{
@@ -425,11 +406,10 @@
/**
* Sets the eventHandlers of the IElementAttributes object.
* <p>
- * This add the references to the local list. Subsequent changes in the
- * caller's list will not be reflected.
+ * This add the references to the local list. Subsequent changes in the caller's list will not
+ * be reflected.
* <p>
- * @param eventHandlers
- * List of IElementEventHandler objects
+ * @param eventHandlers List of IElementEventHandler objects
*/
public void addElementEventHandlers( ArrayList eventHandlers )
{
@@ -445,8 +425,7 @@
}
/**
- * Gets the elementEventHandlers. Returns null if none exist. Makes checking
- * easy.
+ * Gets the elementEventHandlers. Returns null if none exist. Makes checking easy.
* <p>
* @return The elementEventHandlers List of IElementEventHandler objects
*/
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java?rev=693210&r1=693209&r2=693210&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java Mon Sep 8 12:26:37 2008
@@ -441,9 +441,6 @@
/**
* An event that puts an item to a ICacheListener
- * <p>
- * @author asmuts
- * @created January 15, 2002
*/
private class PutEvent
extends AbstractCacheEvent
@@ -472,6 +469,7 @@
listener.handlePut( ice );
}
+ /** @return debugging info */
public String toString()
{
return new StringBuffer( "PutEvent for key: " ).append( ice.getKey() ).append( " value: " )
@@ -482,9 +480,6 @@
/**
* An event that knows how to call remove on an ICacheListener
- * <p>
- * @author asmuts
- * @created January 15, 2002
*/
private class RemoveEvent
extends AbstractCacheEvent
@@ -503,7 +498,7 @@
}
/**
- * Calls remove on the listner.
+ * Calls remove on the listener.
* <p>
* @exception IOException
*/
@@ -513,10 +508,7 @@
listener.handleRemove( cacheName, key );
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ /** @return debugging info */
public String toString()
{
return new StringBuffer( "RemoveEvent for " ).append( key ).toString();
@@ -526,9 +518,6 @@
/**
* An event that knows how to call remove all on an ICacheListener
- * <p>
- * @author asmuts
- * @created January 15, 2002
*/
private class RemoveAllEvent
extends AbstractCacheEvent
@@ -544,10 +533,7 @@
listener.handleRemoveAll( cacheName );
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ /** @return debugging info */
public String toString()
{
return "RemoveAllEvent";
@@ -557,9 +543,6 @@
/**
* The Event put into the queue for dispose requests.
- * <p>
- * @author asmuts
- * @created January 15, 2002
*/
private class DisposeEvent
extends AbstractCacheEvent
@@ -575,6 +558,7 @@
listener.handleDispose( cacheName );
}
+ /** @return debugging info */
public String toString()
{
return "DisposeEvent";
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org