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 2005/01/07 23:27:54 UTC
cvs commit: jakarta-turbine-jcs/src/test-conf log4j.properties
asmuts 2005/01/07 14:27:54
Modified: src/java/org/apache/jcs/engine/behavior
ICacheEventQueue.java
src/java/org/apache/jcs/auxiliary/disk/indexed
IndexedDiskCache.java
IndexedDiskCacheAttributes.java
src/java/org/apache/jcs/auxiliary/javagroups
JavaGroupsCacheAttributes.java
src/java/org/apache/jcs/auxiliary/disk/jisp JISPCache.java
JISPCacheAttributes.java
src/java/org/apache/jcs/auxiliary/lateral LateralCache.java
LateralCacheAttributes.java LateralCacheNoWait.java
src/test-conf log4j.properties
Added: src/java/org/apache/jcs/utils/threadpool/behavior
IPoolConfiguration.java
Log:
Added the ability to set auxiliaries to use a thread pools in the event queue. By default none are used and no
threadpool configuration is necessary. Everything is as is unless you configure it otherwise.
No version update. I need to make sure the indexed disk cache can function
with more than one thread pulling out of the queue.
Revision Changes Path
1.7 +19 -0 jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java
Index: ICacheEventQueue.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ICacheEventQueue.java 6 Jan 2005 01:18:27 -0000 1.6
+++ ICacheEventQueue.java 7 Jan 2005 22:27:54 -0000 1.7
@@ -31,6 +31,25 @@
public interface ICacheEventQueue
{
+
+ /**
+ * Does not use a thread pool.
+ */
+ public static final int SINGLE_QUEUE_TYPE = 0;
+
+ /**
+ * Uses a thread pool
+ */
+ public static final int POOLED_QUEUE_TYPE = 1;
+
+
+ /**
+ * Returnt he type of event queue we are using, either single or pooled.
+ *
+ * @return
+ */
+ public abstract int getQueueType();
+
/**
* Adds a feature to the PutEvent attribute of the ICacheEventQueue object
*
1.17 +3 -2 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
Index: IndexedDiskCache.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- IndexedDiskCache.java 6 Jan 2005 01:19:20 -0000 1.16
+++ IndexedDiskCache.java 7 Jan 2005 22:27:54 -0000 1.17
@@ -32,6 +32,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.disk.AbstractDiskCache;
import org.apache.jcs.auxiliary.disk.LRUMapJCS;
import org.apache.jcs.engine.CacheConstants;
@@ -104,7 +105,7 @@
*/
public IndexedDiskCache(IndexedDiskCacheAttributes cattr)
{
- super(cattr.getCacheName());
+ super((AuxiliaryCacheAttributes)cattr);
String cacheName = cattr.getCacheName();
String rootDirName = cattr.getDiskPath();
1.11 +4 -48 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheAttributes.java
Index: IndexedDiskCacheAttributes.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheAttributes.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- IndexedDiskCacheAttributes.java 16 Nov 2004 08:12:13 -0000 1.10
+++ IndexedDiskCacheAttributes.java 7 Jan 2005 22:27:54 -0000 1.11
@@ -18,18 +18,17 @@
*/
+import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
/**
* Configuration class for the Indexed Disk Cache
*
*/
-public class IndexedDiskCacheAttributes implements AuxiliaryCacheAttributes
+public class IndexedDiskCacheAttributes extends AbstractAuxiliaryCacheAttributes
+ implements AuxiliaryCacheAttributes
{
- private String cacheName;
- private String name;
-
private String diskPath;
// default to 5000
@@ -67,50 +66,7 @@
return this.diskPath;
}
-
- /**
- * Sets the cacheName attribute of the DiskCacheAttributes object
- *
- * @param s The new cacheName value
- */
- public void setCacheName( String s )
- {
- this.cacheName = s;
- }
-
-
- /**
- * Gets the cacheName attribute of the DiskCacheAttributes object
- *
- * @return The cacheName value
- */
- public String getCacheName()
- {
- return this.cacheName;
- }
-
-
- /**
- * Gets the name attribute of the DiskCacheAttributes object
- *
- * @return The name value
- */
- public String getName()
- {
- return this.name;
- }
-
-
- /**
- * Sets the name attribute of the DiskCacheAttributes object
- *
- * @param name The new name value
- */
- public void setName( String name )
- {
- this.name = name;
- }
-
+
/**
* Gets the maxKeySize attribute of the DiskCacheAttributes object
*
1.1 jakarta-turbine-jcs/src/java/org/apache/jcs/utils/threadpool/behavior/IPoolConfiguration.java
Index: IPoolConfiguration.java
===================================================================
package org.apache.jcs.utils.threadpool.behavior;
/**
* @author aaronsm
*
*/
public interface IPoolConfiguration
{
public static final String POLICY_ABORT = "ABORT";
public static final String POLICY_BLOCK = "BLOCK";
public static final String POLICY_RUN = "RUN";
public static final String POLICY_WAIT = "WAIT";
public static final String POLICY_DISCARDOLDEST = "DISCARDOLDEST";
/**
* @param useBoundary The useBoundary to set.
*/
public abstract void setUseBoundary( boolean useBoundary );
/**
* @return Returns the useBoundary.
*/
public abstract boolean isUseBoundary();
/**
* @param boundarySize
* The boundarySize to set.
*/
public abstract void setBoundarySize( int boundarySize );
/**
* @return Returns the boundarySize.
*/
public abstract int getBoundarySize();
/**
* @param maximumPoolSize
* The maximumPoolSize to set.
*/
public abstract void setMaximumPoolSize( int maximumPoolSize );
/**
* @return Returns the maximumPoolSize.
*/
public abstract int getMaximumPoolSize();
/**
* @param minimumPoolSize
* The minimumPoolSize to set.
*/
public abstract void setMinimumPoolSize( int minimumPoolSize );
/**
* @return Returns the minimumPoolSize.
*/
public abstract int getMinimumPoolSize();
/**
* @param keepAliveTime
* The keepAliveTime to set.
*/
public abstract void setKeepAliveTime( int keepAliveTime );
/**
* @return Returns the keepAliveTime.
*/
public abstract int getKeepAliveTime();
/**
* should be ABORT, BLOCK, RUN, WAIT, DISCARDOLDEST.
*
* If an incorrect value is returned, run will be used.
*
* @param whenBlockedPolicy The whenBlockedPolicy to set.
*/
public abstract void setWhenBlockedPolicy( String whenBlockedPolicy );
/**
* @return Returns the whenBlockedPolicy.
*/
public abstract String getWhenBlockedPolicy();
/**
* @param startUpSize
* The startUpSize to set.
*/
public abstract void setStartUpSize( int startUpSize );
/**
* @return Returns the startUpSize.
*/
public abstract int getStartUpSize();
}
1.2 +5 -39 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCacheAttributes.java
Index: JavaGroupsCacheAttributes.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCacheAttributes.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaGroupsCacheAttributes.java 14 May 2004 04:59:40 -0000 1.1
+++ JavaGroupsCacheAttributes.java 7 Jan 2005 22:27:54 -0000 1.2
@@ -18,6 +18,7 @@
*/
+import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
/**
@@ -44,11 +45,9 @@
*
* @version $Id$
*/
-public class JavaGroupsCacheAttributes implements AuxiliaryCacheAttributes
+public class JavaGroupsCacheAttributes extends AbstractAuxiliaryCacheAttributes
+ implements AuxiliaryCacheAttributes
{
- private String cacheName;
- private String name;
-
private String channelFactoryClassName = "org.jgroups.JChannelFactory";
private String channelProperties = null;
private boolean getFromPeers = false;
@@ -83,40 +82,7 @@
this.getFromPeers = getFromPeers;
}
- // ----------------------------------------------- AuxiliaryCacheAttributes
-
- /**
- * Accessor for cacheName property.
- */
- public String getCacheName()
- {
- return this.cacheName;
- }
-
- /**
- * Mutator for cacheName property.
- */
- public void setCacheName( String s )
- {
- this.cacheName = s;
- }
-
- /**
- * Accessor for name property.
- */
- public String getName()
- {
- return this.name;
- }
-
- /**
- * Mutator for name property.
- */
- public void setName( String name )
- {
- this.name = name;
- }
-
+
/**
* Return a copy of this JavaGroupsCacheAttributes, cast to an
* AuxiliaryCacheAttributes
1.10 +2 -1 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/jisp/JISPCache.java
Index: JISPCache.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/jisp/JISPCache.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JISPCache.java 12 Jun 2004 02:34:12 -0000 1.9
+++ JISPCache.java 7 Jan 2005 22:27:54 -0000 1.10
@@ -27,6 +27,7 @@
import com.coyotegulch.jisp.KeyObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.disk.AbstractDiskCache;
import org.apache.jcs.engine.CacheElement;
import org.apache.jcs.engine.behavior.ICacheElement;
@@ -66,7 +67,7 @@
*/
public JISPCache( JISPCacheAttributes cattr )
{
- super( cattr.getCacheName() );
+ super( (AuxiliaryCacheAttributes)cattr);
numInstances++;
1.6 +4 -44 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/jisp/JISPCacheAttributes.java
Index: JISPCacheAttributes.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/jisp/JISPCacheAttributes.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JISPCacheAttributes.java 12 Jun 2004 02:34:12 -0000 1.5
+++ JISPCacheAttributes.java 7 Jan 2005 22:27:54 -0000 1.6
@@ -18,18 +18,17 @@
*/
+import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
/**
* Description of the Class
*
*/
-public class JISPCacheAttributes implements AuxiliaryCacheAttributes
+public class JISPCacheAttributes extends AbstractAuxiliaryCacheAttributes
+ implements AuxiliaryCacheAttributes
{
- private String cacheName;
- private String name;
-
private String diskPath;
private boolean clearOnStart;
@@ -83,46 +82,7 @@
return clearOnStart;
}
- /**
- * Sets the cacheName attribute of the JISPCacheAttributes object
- *
- * @param s The new cacheName value
- */
- public void setCacheName( String s )
- {
- this.cacheName = s;
- }
-
- /**
- * Gets the cacheName attribute of the JISPCacheAttributes object
- *
- * @return The cacheName value
- */
- public String getCacheName()
- {
- return this.cacheName;
- }
-
- /**
- * Gets the name attribute of the JISPCacheAttributes object
- *
- * @return The name value
- */
- public String getName()
- {
- return this.name;
- }
-
- /**
- * Sets the name attribute of the JISPCacheAttributes object
- *
- * @param name The new name value
- */
- public void setName( String name )
- {
- this.name = name;
- }
-
+
/** Description of the Method */
public AuxiliaryCacheAttributes copy()
{
1.11 +18 -9 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
Index: LateralCache.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- LateralCache.java 16 Jul 2004 01:27:42 -0000 1.10
+++ LateralCache.java 7 Jan 2005 22:27:54 -0000 1.11
@@ -24,6 +24,7 @@
import java.util.HashMap;
import java.util.Set;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
@@ -56,7 +57,7 @@
// not synchronized to maximize concurrency.
// generalize this, use another interface
- ILateralCacheAttributes cattr;
+ public ILateralCacheAttributes cattr;
final String cacheName;
@@ -87,14 +88,14 @@
this.cacheName = cattr.getCacheName();
//this.servers = servers;
- this.cattr = cattr;
+ this.cattr = cattr ;
}
/** Description of the Method */
public String toString()
{
- return "LateralCache: " + cattr.getCacheName();
+ return "LateralCache: " + this.cattr.getCacheName();
}
/** Description of the Method */
@@ -129,7 +130,7 @@
{
ICacheElement obj = null;
- if ( cattr.getPutOnlyMode() )
+ if ( this.cattr.getPutOnlyMode() )
{
return null;
}
@@ -140,7 +141,7 @@
catch ( Exception e )
{
log.error( e );
- handleException( e, "Failed to get " + key + " from " + cattr.getCacheName() );
+ handleException( e, "Failed to get " + key + " from " + this.cattr.getCacheName() );
}
return obj;
}
@@ -168,7 +169,7 @@
}
catch ( Exception ex )
{
- handleException( ex, "Failed to remove " + key + " from " + cattr.getCacheName() );
+ handleException( ex, "Failed to remove " + key + " from " + this.cattr.getCacheName() );
}
return false;
}
@@ -189,7 +190,7 @@
}
catch ( Exception ex )
{
- handleException( ex, "Failed to remove all from " + cattr.getCacheName() );
+ handleException( ex, "Failed to remove all from " + this.cattr.getCacheName() );
}
}
@@ -205,13 +206,13 @@
// asmuts -- Added functionality to help with warnings. I'm not getting any.
try
{
- lateral.dispose( cattr.getCacheName() );
+ lateral.dispose( this.cattr.getCacheName() );
// Should remove connection
}
catch ( Exception ex )
{
log.error( "Couldn't dispose", ex );
- handleException( ex, "Failed to dispose " + cattr.getCacheName() );
+ handleException( ex, "Failed to dispose " + this.cattr.getCacheName() );
}
//*/
}
@@ -296,5 +297,13 @@
public String getStats()
{
return "";
+ }
+
+ /**
+ * @return Returns the AuxiliaryCacheAttributes.
+ */
+ public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+ {
+ return cattr;
}
}
1.9 +5 -49 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
Index: LateralCacheAttributes.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- LateralCacheAttributes.java 16 Jul 2004 01:27:42 -0000 1.8
+++ LateralCacheAttributes.java 7 Jan 2005 22:27:54 -0000 1.9
@@ -19,6 +19,8 @@
import java.io.Serializable;
+
+import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
@@ -26,7 +28,8 @@
* Description of the Class
*
*/
-public class LateralCacheAttributes implements Serializable, ILateralCacheAttributes
+public class LateralCacheAttributes extends AbstractAuxiliaryCacheAttributes
+ implements Serializable, ILateralCacheAttributes
{
String transmissionTypeName = "UDP";
int transmissionType = UDP;
@@ -52,10 +55,6 @@
// javagroups
private String jgChannelProperties = null;
- // general
- private String cacheName;
- private String name;
-
// disables gets from laterals
boolean putOnlyMode = true;
@@ -336,50 +335,7 @@
return this.transmissionTypeName;
}
-
- /**
- * Sets the cacheName attribute of the LateralCacheAttributes object
- *
- * @param s The new cacheName value
- */
- public void setCacheName( String s )
- {
- this.cacheName = s;
- }
-
-
- /**
- * Gets the cacheName attribute of the LateralCacheAttributes object
- *
- * @return The cacheName value
- */
- public String getCacheName()
- {
- return this.cacheName;
- }
-
-
- /**
- * Gets the name attribute of the LateralCacheAttributes object
- *
- * @return The name value
- */
- public String getName()
- {
- return this.name;
- }
-
-
- /**
- * Sets the name attribute of the LateralCacheAttributes object
- *
- * @param name The new name value
- */
- public void setName( String name )
- {
- this.name = name;
- }
-
+
/**
* Sets the outgoingOnlyMode attribute of the ILateralCacheAttributes. When
* this is true the lateral cache will only issue put and remove order and
1.10 +12 -5 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
Index: LateralCacheNoWait.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- LateralCacheNoWait.java 6 Jan 2005 01:27:44 -0000 1.9
+++ LateralCacheNoWait.java 7 Jan 2005 22:27:54 -0000 1.10
@@ -30,7 +30,7 @@
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
import org.apache.jcs.engine.CacheAdaptor;
import org.apache.jcs.engine.CacheConstants;
-import org.apache.jcs.engine.CacheEventQueue;
+import org.apache.jcs.engine.CacheEventQueueFactory;
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.ICacheEventQueue;
import org.apache.jcs.engine.stats.StatElement;
@@ -63,9 +63,13 @@
public LateralCacheNoWait( LateralCache cache )
{
this.cache = cache;
- this.q = new CacheEventQueue( new CacheAdaptor( cache ),
+
+ CacheEventQueueFactory fact = new CacheEventQueueFactory();
+ this.q = fact.createCacheEventQueue( new CacheAdaptor( cache ),
LateralCacheInfo.listenerId,
- cache.getCacheName() );
+ cache.getCacheName(),
+ cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(),
+ cache.getAuxiliaryCacheAttributes().getEventQueueTypeFactoryCode() );
// need each no wait to handle each of its real updates and removes, since there may
// be more than one per cache? alternativve is to have the cache
@@ -233,9 +237,12 @@
{
q.destroy();
}
- this.q = new CacheEventQueue( new CacheAdaptor( cache ),
+ CacheEventQueueFactory fact = new CacheEventQueueFactory();
+ this.q = fact.createCacheEventQueue( new CacheAdaptor( cache ),
LateralCacheInfo.listenerId,
- cache.getCacheName() );
+ cache.getCacheName(),
+ cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(),
+ cache.getAuxiliaryCacheAttributes().getEventQueueTypeFactoryCode() );
}
/** Description of the Method */
1.7 +6 -3 jakarta-turbine-jcs/src/test-conf/log4j.properties
Index: log4j.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-jcs/src/test-conf/log4j.properties,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- log4j.properties 6 Jan 2005 04:44:28 -0000 1.6
+++ log4j.properties 7 Jan 2005 22:27:54 -0000 1.7
@@ -1,8 +1,11 @@
log4j.rootCategory=INFO, stdout, logfile
-log4j.category.org.apache.jcs.=INFO, stdout, logfile
-log4j.category.org.apache.jcs.auxiliary.remote=INFO, stdout, logfile
-log4j.category.org.apache.jcs.utils.threadpool=INFO, stdout, logfile
+log4j.category.org.apache.jcs=INFO
+log4j.category.org.apache.jcs.config=DEBUG
+log4j.category.org.apache.jcs.engine.CacheEventQueueFactory=DEBUG
+log4j.category.org.apache.jcs.auxiliary.disk=INFO
+log4j.category.org.apache.jcs.auxiliary.remote=INFO
+log4j.category.org.apache.jcs.utils.threadpool=DEBUG
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-dev-help@jakarta.apache.org