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 2007/05/15 18:33:12 UTC
svn commit: r538248 - in /jakarta/jcs/trunk/src/java/org/apache/jcs: admin/
auxiliary/disk/ auxiliary/disk/jdbc/
Author: asmuts
Date: Tue May 15 09:33:10 2007
New Revision: 538248
URL: http://svn.apache.org/viewvc?view=rev&rev=538248
Log:
Fixed some formatting and javadoc warnings.
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheElementInfo.java
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheRegionInfo.java
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CountingOnlyOutputStream.java
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheAttributes.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/JDBCDiskCachePoolAccess.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/TableState.java
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheElementInfo.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheElementInfo.java?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheElementInfo.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheElementInfo.java Tue May 15 09:33:10 2007
@@ -24,14 +24,19 @@
*/
public class CacheElementInfo
{
+ /** element key */
String key = null;
+ /** is it eternal */
boolean eternal = false;
+ /** when it was created */
String createTime = null;
+ /** max life */
long maxLifeSeconds = -1;
+ /** when it will expire */
long expiresInSeconds = -1;
/**
@@ -76,9 +81,8 @@
return this.expiresInSeconds;
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
+ /**
+ * @return string info on the item
*/
public String toString()
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheRegionInfo.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheRegionInfo.java?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheRegionInfo.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CacheRegionInfo.java Tue May 15 09:33:10 2007
@@ -27,12 +27,14 @@
*/
public class CacheRegionInfo
{
+ /** The cache region we are getting info on. */
CompositeCache cache = null;
+ /** number of bytes counted so far, will be a total of all items. */
long byteCount = 0;
/**
- * @return
+ * @return the underlying region
*/
public CompositeCache getCache()
{
@@ -40,7 +42,7 @@
}
/**
- * @return
+ * @return total byte count
*/
public long getByteCount()
{
@@ -48,7 +50,7 @@
}
/**
- * @return
+ * @return a status string
*/
public String getStatus()
{
@@ -65,6 +67,7 @@
/**
* Return the stats for the region.
+ * <p>
* @return String
*/
public String getStats()
@@ -72,9 +75,8 @@
return this.cache.getStats();
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
+ /**
+ * @return string info on the region
*/
public String toString()
{
@@ -89,5 +91,4 @@
return buf.toString();
}
-
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CountingOnlyOutputStream.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CountingOnlyOutputStream.java?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CountingOnlyOutputStream.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/admin/CountingOnlyOutputStream.java Tue May 15 09:33:10 2007
@@ -23,26 +23,46 @@
import java.io.OutputStream;
/**
- * Keeps track of the number of bytes written to it, but doesn't write them
- * anywhere.
+ * Keeps track of the number of bytes written to it, but doesn't write them anywhere.
*/
public class CountingOnlyOutputStream
extends OutputStream
{
+ /** number of bytes passed through */
private int count;
+ /**
+ * count as we write.
+ * <p>
+ * @param b
+ * @throws IOException
+ */
public void write( byte[] b )
throws IOException
{
this.count += b.length;
}
+ /**
+ * count as we write.
+ * <p>
+ * @param b
+ * @param off
+ * @param len
+ * @throws IOException
+ */
public void write( byte[] b, int off, int len )
throws IOException
{
this.count += len;
}
+ /**
+ * count as we write.
+ * <p>
+ * @param b
+ * @throws IOException
+ */
public void write( int b )
throws IOException
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java Tue May 15 09:33:10 2007
@@ -38,20 +38,22 @@
import org.apache.jcs.engine.memory.behavior.IMemoryCache;
/**
- * A servlet which provides HTTP access to JCS. Allows a summary of regions to
- * be viewed, and removeAll to be run on individual regions or all regions. Also
- * provides the ability to remove items (any number of key arguments can be
- * provided with action 'remove'). Should be initialized with a properties file
- * that provides at least a classpath resource loader.
+ * A servlet which provides HTTP access to JCS. Allows a summary of regions to be viewed, and
+ * removeAll to be run on individual regions or all regions. Also provides the ability to remove
+ * items (any number of key arguments can be provided with action 'remove'). Should be initialized
+ * with a properties file that provides at least a classpath resource loader.
*/
public class JCSAdminBean
{
+ /** The logger. */
private static final Log log = LogFactory.getLog( JCSAdminBean.class );
+ /** The cache maanger. */
private CompositeCacheManager cacheHub = CompositeCacheManager.getInstance();
/**
- * Builds up info about each element in a region. int
+ * Builds up info about each element in a region.
+ * <p>
* @param cacheName
* @return List of CacheElementInfo objects
* @throws Exception
@@ -109,9 +111,10 @@
}
/**
- * Builds up data on every region. int
- * @TODO we need a most light weight method that does not count bytes. The
- * byte counting can really swamp a server.
+ * Builds up data on every region.
+ * <p>
+ * @TODO we need a most light weight method that does not count bytes. The byte counting can
+ * really swamp a server.
* @return list of CacheRegionInfo objects
* @throws Exception
*/
@@ -143,11 +146,11 @@
}
/**
- * Tries to estimate how much data is in a region. This is expensive. If
- * there are any non serializable objects in the region, the count will stop
- * when it encouters the first one. int
+ * Tries to estimate how much data is in a region. This is expensive. If there are any non
+ * serializable objects in the region, the count will stop when it encouters the first one.
+ * <p>
* @param cache
- * @return
+ * @return int
* @throws Exception
*/
public int getByteCount( CompositeCache cache )
@@ -182,7 +185,8 @@
}
/**
- * Clears all regions in the cache. int
+ * Clears all regions in the cache.
+ * <p>
* @throws IOException
*/
public void clearAllRegions()
@@ -197,7 +201,8 @@
}
/**
- * Clears a particular cache region. int
+ * Clears a particular cache region.
+ * <p>
* @param cacheName
* @throws IOException
*/
@@ -208,7 +213,8 @@
}
/**
- * Removes a particular item from a particular region. int
+ * Removes a particular item from a particular region.
+ * <p>
* @param cacheName
* @param key
* @throws IOException
@@ -218,5 +224,4 @@
{
cacheHub.getCache( cacheName ).remove( key );
}
-
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java Tue May 15 09:33:10 2007
@@ -45,59 +45,71 @@
private static final int DEFAULT_shutdownSpoolTimeLimit = 60;
/**
- * This default determines how long the shutdown will wait for the key spool
- * and data defrag to finish.
+ * This default determines how long the shutdown will wait for the key spool and data defrag to
+ * finish.
*/
protected int shutdownSpoolTimeLimit = DEFAULT_shutdownSpoolTimeLimit;
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes#setDiskPath(java.lang.String)
+ /**
+ * Sets the diskPath attribute of the IJISPCacheAttributes object
+ * <p>
+ * @param path The new diskPath value
*/
public void setDiskPath( String path )
{
this.diskPath = path.trim();
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes#getDiskPath()
+ /**
+ * Gets the diskPath attribute of the attributes object
+ * <p>
+ * @return The diskPath value
*/
public String getDiskPath()
{
return this.diskPath;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes#getMaxPurgatorySize()
+ /**
+ * Gets the maxKeySize attribute of the DiskCacheAttributes object
+ * <p>
+ * @return The maxPurgatorySize value
*/
public int getMaxPurgatorySize()
{
return maxPurgatorySize;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes#setMaxPurgatorySize(int)
+ /**
+ * Sets the maxPurgatorySize attribute of the DiskCacheAttributes object
+ * <p>
+ * @param maxPurgatorySize The new maxPurgatorySize value
*/
public void setMaxPurgatorySize( int maxPurgatorySize )
{
this.maxPurgatorySize = maxPurgatorySize;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes#getShutdownSpoolTimeLimit()
+ /**
+ * Get the amount of time in seconds we will wait for elements to move to disk during shutdown
+ * for a particular region.
+ * <p>
+ * @return the time in seconds.
*/
public int getShutdownSpoolTimeLimit()
{
return this.shutdownSpoolTimeLimit;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes#setShutdownSpoolTimeLimit(int)
+ /**
+ * Sets the amount of time in seconds we will wait for elements to move to disk during shutdown
+ * for a particular region.
+ * <p>
+ * This is how long we give the event queue to empty.
+ * <p>
+ * The default is 60 seconds.
+ * <p>
+ * @param shutdownSpoolTimeLimit the time in seconds
*/
public void setShutdownSpoolTimeLimit( int shutdownSpoolTimeLimit )
{
@@ -105,7 +117,8 @@
}
/**
- * Description of the Method
+ * Simple clone.
+ * <p>
* @return AuxiliaryCacheAttributes
*/
public AuxiliaryCacheAttributes copy()
@@ -122,8 +135,7 @@
}
/**
- * @param allowRemoveAll
- * The allowRemoveAll to set.
+ * @param allowRemoveAll The allowRemoveAll to set.
*/
public void setAllowRemoveAll( boolean allowRemoveAll )
{
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?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- 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 Tue May 15 09:33:10 2007
@@ -32,14 +32,15 @@
import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
/**
- * This class serves as an abstract template for JDBCDiskCache Manager. The
- * MySQL JDBC Disk Cache needs many of the same features as the generic maanger.
+ * This class serves as an abstract template for JDBCDiskCache Manager. The MySQL JDBC Disk Cache
+ * needs many of the same features as the generic maanger.
* <p>
* @author Aaron Smuts
*/
public abstract class JDBCDiskCacheManagerAbstractTemplate
implements AuxiliaryCacheManager
{
+ /** The logger. */
private static final Log log = LogFactory.getLog( JDBCDiskCacheManagerAbstractTemplate.class );
/**
@@ -53,9 +54,8 @@
protected static Hashtable caches = new Hashtable();
/**
- * A map of TableState objects to table names. Each cache has a table state
- * object, which is used to determin if any long processes such as deletes
- * or optimizations are running.
+ * A map of TableState objects to table names. Each cache has a table state object, which is
+ * used to determin if any long processes such as deletes or optimizations are running.
*/
protected static Hashtable tableStates = new Hashtable();
@@ -65,9 +65,8 @@
private ClockDaemon shrinkerDaemon;
/**
- * A map of table name to shrinker threads. This allows each table to have a
- * different setting. It assumes that there is only one jdbc disk cache
- * auxiliary defined per table.
+ * A map of table name to shrinker threads. This allows each table to have a different setting.
+ * It assumes that there is only one jdbc disk cache auxiliary defined per table.
*/
private Map shrinkerThreadMap = new Hashtable();
@@ -81,9 +80,8 @@
protected abstract AuxiliaryCache createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState );
/**
- * Creates a JDBCDiskCache for the region if one doesn't exist, else it
- * returns the precreated instance. It also adds the region to the shrinker
- * thread if needed.
+ * Creates a JDBCDiskCache for the region if one doesn't exist, else it returns the precreated
+ * instance. It also adds the region to the shrinker thread if needed.
* <p>
* @param cattr
* @return The cache value
@@ -100,7 +98,7 @@
if ( diskCache == null )
{
- TableState tableState = (TableState)tableStates.get( cattr.getTableName() );
+ TableState tableState = (TableState) tableStates.get( cattr.getTableName() );
if ( tableState == null )
{
@@ -125,8 +123,7 @@
}
/**
- * If UseDiskShrinker is true then we will create a shrinker daemon if
- * necessary.
+ * If UseDiskShrinker is true then we will create a shrinker daemon if necessary.
* <p>
* @param cattr
* @param raf
@@ -213,9 +210,11 @@
class MyThreadFactory
implements ThreadFactory
{
- /*
- * (non-Javadoc)
- * @see EDU.oswego.cs.dl.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
+ /**
+ * Set the priority to min and daemon to true.
+ * <p>
+ * @param runner
+ * @return the daemon thread.
*/
public Thread newThread( Runnable runner )
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccess.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccess.java?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccess.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccess.java Tue May 15 09:33:10 2007
@@ -33,21 +33,23 @@
import org.apache.commons.pool.impl.GenericObjectPool;
/**
- * This class provides access to the connection pool. It ensures that the
- * various resources that need to access the tables will be able to use the same
- * pool.
+ * This class provides access to the connection pool. It ensures that the various resources that
+ * need to access the tables will be able to use the same pool.
* <p>
* @author Aaron Smuts
*/
public class JDBCDiskCachePoolAccess
{
+ /** The logger. */
private final static Log log = LogFactory.getLog( JDBCDiskCachePoolAccess.class );
/** The defualt Pool Name to which the connetion pool will be keyed. */
public static final String DEFAULT_POOL_NAME = "jcs";
+ /** The name of the pool. */
private String poolName = DEFAULT_POOL_NAME;
+ /** default jdbc driver. */
private static final String DRIVER_NAME = "jdbc:apache:commons:dbcp:";
// WE SHOULD HAVE A DIFFERENT POOL FOR EACH DB NO REGION
@@ -57,8 +59,8 @@
/**
* Configures the pool name to use for the pool access.
* <p>
- * This pool name should be unique to the database. It is used as part of
- * the URL each time we lookup a conection from the driver manager.
+ * This pool name should be unique to the database. It is used as part of the URL each time we
+ * lookup a conection from the driver manager.
* <p>
* @param poolName
* @param driverName
@@ -79,7 +81,6 @@
}
}
-
/**
* Gets a connection from the pool.
* <p>
@@ -106,7 +107,7 @@
/**
* How many are idle in the pool.
* <p>
- * @return
+ * @return number idle
*/
public int getNumIdleInPool()
{
@@ -132,7 +133,7 @@
/**
* How many are active in the pool.
* <p>
- * @return
+ * @return number active
*/
public int getNumActiveInPool()
{
@@ -174,8 +175,7 @@
}
/**
- * @param poolName
- * The poolName to set.
+ * @param poolName The poolName to set.
*/
public void setPoolName( String poolName )
{
@@ -194,8 +194,7 @@
* @param connectURI
* @param userName
* @param password
- * @param maxActive
- * max connetions
+ * @param maxActive max connetions
* @throws Exception
*/
public void setupDriver( String connectURI, String userName, String password, int maxActive )
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?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- 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 Tue May 15 09:33:10 2007
@@ -27,26 +27,30 @@
import org.apache.commons.logging.LogFactory;
/**
- * Calls delete expired on the disk caches. The shrinker is run by a clock
- * daemon. The shrinker calls delete on each region. It pauses between calls.
+ * Calls delete expired on the disk caches. The shrinker is run by a clock daemon. The shrinker
+ * calls delete on each region. It pauses between calls.
* <p>
* @author Aaron Smuts
*/
public class ShrinkerThread
implements Runnable
{
+ /** The logger. */
private final static Log log = LogFactory.getLog( ShrinkerThread.class );
/** A set of JDBCDiskCache objects to call deleteExpired on. */
private Set shrinkSet = Collections.synchronizedSet( new HashSet() );
/**
- * How long should we wait between calls to deleteExpired when we are
- * iterating through the list of regions. Delete can lock the table. We want
- * to give clients a chance to get some work done.
+ * Default time period to use.
*/
private static final long DEFAULT_PAUSE_BETWEEN_REGION_CALLS_MILLIS = 5000;
+ /**
+ * How long should we wait between calls to deleteExpired when we are iterating through the list
+ * of regions. Delete can lock the table. We want to give clients a chance to get some work
+ * done.
+ */
private long pauseBetweenRegionCallsMillis = DEFAULT_PAUSE_BETWEEN_REGION_CALLS_MILLIS;
/**
@@ -129,11 +133,10 @@
}
/**
- * How long should we wait between calls to deleteExpired when we are
- * iterating through the list of regions.
+ * How long should we wait between calls to deleteExpired when we are iterating through the list
+ * of regions.
* <p>
- * @param pauseBetweenRegionCallsMillis
- * The pauseBetweenRegionCallsMillis to set.
+ * @param pauseBetweenRegionCallsMillis The pauseBetweenRegionCallsMillis to set.
*/
public void setPauseBetweenRegionCallsMillis( long pauseBetweenRegionCallsMillis )
{
@@ -141,8 +144,8 @@
}
/**
- * How long should we wait between calls to deleteExpired when we are
- * iterating through the list of regions.
+ * How long should we wait between calls to deleteExpired when we are iterating through the list
+ * of regions.
* <p>
* @return Returns the pauseBetweenRegionCallsMillis.
*/
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java?view=diff&rev=538248&r1=538247&r2=538248
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java Tue May 15 09:33:10 2007
@@ -32,8 +32,10 @@
public class TableState
implements Serializable
{
+ /** Don't change. */
private static final long serialVersionUID = -6625081552084964885L;
+ /** Name of the table whose state this reflects. */
private String tableName;
/**
@@ -48,8 +50,7 @@
/** A table locking optimization is running. */
public static final int OPTIMIZATION_RUNNING = 2;
- // we might want to add error
-
+ /** we might want to add error */
private int state = FREE;
/**
@@ -109,5 +110,4 @@
str.append( "\n State = " + getState() );
return str.toString();
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org