You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2011/08/14 20:13:17 UTC
svn commit: r1157592 [1/2] - in /commons/proper/jcs/trunk/src:
java/org/apache/jcs/auxiliary/disk/block/
java/org/apache/jcs/auxiliary/disk/file/
java/org/apache/jcs/auxiliary/disk/indexed/
java/org/apache/jcs/auxiliary/disk/jdbc/mysql/ java/org/apache...
Author: tv
Date: Sun Aug 14 18:13:15 2011
New Revision: 1157592
URL: http://svn.apache.org/viewvc?rev=1157592&view=rev
Log:
Fix problems reported by FindBugs
- Inconsistent synchronization
- Exception is caught
- Use xxx.valueOf instead of new xxx
etc.
Modified:
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactory.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/ElementEventQueue.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventQueue.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoulbeLinkedListMemoryCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/shrinking/ShrinkerThread.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/date/DateFormatter.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/props/AbstractPropertyContainer.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSLightLoadUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSRemovalSimpleConcurrentTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/RemovalTestUtil.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/ZeroSizeCacheUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/access/CacheAccessUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/admin/CountingStreamUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/access/JCSWorkerUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/SingleLinkedListUnitTest.java
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDisk.java Sun Aug 14 18:13:15 2011
@@ -58,7 +58,7 @@ public class BlockDisk
private int numberOfBlocks = 0;
/** Empty blocks that can be reused. */
- private SingleLinkedList emptyBlocks = new SingleLinkedList();
+ private final SingleLinkedList emptyBlocks = new SingleLinkedList();
/** The serializer. Uses a standard serializer by default. */
protected IElementSerializer elementSerializer = new StandardSerializer();
@@ -67,7 +67,7 @@ public class BlockDisk
private final String filepath;
/** The file handle. */
- private RandomAccessFile raf;
+ private final RandomAccessFile raf;
/** How many bytes have we put to disk */
private long putBytes = 0;
@@ -79,7 +79,7 @@ public class BlockDisk
* Constructor for the Disk object
* <p>
* @param file
- * @param elementSerializer
+ * @param elementSerializer
* @exception FileNotFoundException
*/
public BlockDisk( File file, IElementSerializer elementSerializer )
@@ -90,7 +90,7 @@ public class BlockDisk
{
log.info( "Used default block size [" + DEFAULT_BLOCK_SIZE_BYTES + "]" );
}
- this.elementSerializer = elementSerializer;
+ this.elementSerializer = elementSerializer;
}
/**
@@ -112,13 +112,13 @@ public class BlockDisk
}
this.blockSizeBytes = blockSizeBytes;
}
-
+
/**
* Creates the file and set the block size in bytes.
* <p>
* @param file
* @param blockSizeBytes
- * @param elementSerializer
+ * @param elementSerializer
* @throws FileNotFoundException
*/
public BlockDisk( File file, int blockSizeBytes, IElementSerializer elementSerializer )
@@ -133,7 +133,7 @@ public class BlockDisk
}
this.blockSizeBytes = blockSizeBytes;
- this.elementSerializer = elementSerializer;
+ this.elementSerializer = elementSerializer;
}
/**
@@ -163,7 +163,7 @@ public class BlockDisk
{
log.debug( "write, total pre-chunking data.length = " + data.length );
}
-
+
this.addToPutBytes( data.length );
this.incrementPutCount();
@@ -173,7 +173,7 @@ public class BlockDisk
{
log.debug( "numBlocksNeeded = " + numBlocksNeeded );
}
-
+
int[] blocks = new int[numBlocksNeeded];
// get them from the empty list or take the next one
@@ -298,7 +298,7 @@ public class BlockDisk
{
log.debug( "read, total post combination data.length = " + data.length );
}
-
+
return (Serializable) elementSerializer.deSerialize( data );
}
@@ -362,7 +362,7 @@ public class BlockDisk
{
for ( short i = 0; i < blocksToFree.length; i++ )
{
- emptyBlocks.addLast( new Integer( blocksToFree[i] ) );
+ emptyBlocks.addLast( Integer.valueOf( blocksToFree[i] ) );
}
}
}
@@ -478,7 +478,7 @@ public class BlockDisk
/**
* @return Returns the average size of the an element inserted.
*/
- protected long getAveragePutSizeBytes()
+ protected synchronized long getAveragePutSizeBytes()
{
if ( this.putCount == 0 )
{
@@ -500,6 +500,7 @@ public class BlockDisk
* <p>
* @return String with details.
*/
+ @Override
public String toString()
{
StringBuffer buf = new StringBuffer();
@@ -521,7 +522,7 @@ public class BlockDisk
}
return buf.toString();
}
-
+
/**
* This is used for debugging.
* <p>
@@ -530,5 +531,5 @@ public class BlockDisk
protected String getFilePath()
{
return filepath;
- }
+ }
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java Sun Aug 14 18:13:15 2011
@@ -25,6 +25,7 @@ import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
@@ -191,7 +192,7 @@ public class BlockDiskKeyStore
+ numKeys + " keys. Key file length [" + keyFile.length() + "]" );
}
}
- catch ( Exception e )
+ catch ( IOException e )
{
log.error( logCacheName + "Problem storing keys.", e );
}
@@ -374,7 +375,7 @@ public class BlockDiskKeyStore
}
/**
- * Class for recylcing and lru. This implments the LRU overflow callback, so we can mark the
+ * Class for recycling and lru. This implements the LRU overflow callback, so we can mark the
* blocks as free.
*/
public class LRUMap
@@ -418,7 +419,7 @@ public class BlockDiskKeyStore
if ( log.isDebugEnabled() )
{
log.debug( logCacheName + "Removing key: [" + key + "] from key store." );
- log.debug( logCacheName + "Key store size: [" + this.size() + "]." );
+ log.debug( logCacheName + "Key store size: [" + super.size() + "]." );
}
}
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCache.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCache.java Sun Aug 14 18:13:15 2011
@@ -449,6 +449,7 @@ public class FileDiskCache
{
boolean success = file.delete();
+ // TODO: The following should be identical to success == false, but it isn't
if ( file.exists() )
{
int maxRetries = diskFileCacheAttributes.getMaxRetriesOnDelete();
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactory.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactory.java Sun Aug 14 18:13:15 2011
@@ -21,7 +21,7 @@ public class FileDiskCacheFactory
/** The manager used by this factory instance */
private FileDiskCacheManager diskFileCacheManager;
-
+
/**
* Creates a manager if we don't have one, and then uses the manager to create the cache. The
* same factory will be called multiple times by the composite cache to create a cache for each
@@ -37,6 +37,10 @@ public class FileDiskCacheFactory
ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
{
FileDiskCacheAttributes idfca = (FileDiskCacheAttributes) attr;
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Creating DiskFileCache for attributes = " + idfca );
+ }
synchronized( this )
{
if ( diskFileCacheManager == null )
@@ -47,12 +51,8 @@ public class FileDiskCacheFactory
}
diskFileCacheManager = new FileDiskCacheManager( idfca, cacheEventLogger, elementSerializer );
}
+ return diskFileCacheManager.getCache( idfca );
}
- if ( log.isDebugEnabled() )
- {
- log.debug( "Creating DiskFileCache for attributes = " + idfca );
- }
- return diskFileCacheManager.getCache( idfca );
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java Sun Aug 14 18:13:15 2011
@@ -46,7 +46,7 @@ class IndexedDisk
private final String filepath;
/** The data file. */
- private RandomAccessFile raf;
+ private final RandomAccessFile raf;
/** read buffer */
private final byte[] buffer = new byte[16384]; // 16K
@@ -55,7 +55,7 @@ class IndexedDisk
* Constructor for the Disk object
* <p>
* @param file
- * @param elementSerializer
+ * @param elementSerializer
* @exception FileNotFoundException
*/
public IndexedDisk( File file, IElementSerializer elementSerializer )
@@ -181,7 +181,11 @@ class IndexedDisk
if ( log.isTraceEnabled() )
{
log.trace( "write> pos=" + pos );
- log.trace( raf + " -- data.length = " + data.length );
+
+ synchronized (this)
+ {
+ log.trace( raf + " -- data.length = " + data.length );
+ }
}
if ( data.length != ded.len )
@@ -253,28 +257,8 @@ class IndexedDisk
{
log.debug( "Resetting Indexed File [" + filepath + "]" );
}
- raf.close();
- File f = new File( filepath );
- int i = 0;
- for ( ; i < 10 && !f.delete(); i++ )
- {
- try
- {
- Thread.sleep( 1000 );
- }
- catch ( InterruptedException ex )
- {
- // swallow
- }
- log.warn( "Failed to delete " + f.getName() + " " + i );
- }
- if ( i == 10 )
- {
- IllegalStateException ex = new IllegalStateException( "Failed to delete " + f.getName() );
- log.error( ex );
- throw ex;
- }
- raf = new RandomAccessFile( filepath, "rw" );
+ raf.setLength(0);
+ raf.seek(0);
}
/**
@@ -283,7 +267,7 @@ class IndexedDisk
* @param length the new length of the file
* @throws IOException
*/
- protected void truncate( long length )
+ protected synchronized void truncate( long length )
throws IOException
{
if ( log.isInfoEnabled() )
@@ -292,7 +276,7 @@ class IndexedDisk
}
raf.setLength( length );
}
-
+
/**
* This is used for debugging.
* <p>
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Sun Aug 14 18:13:15 2011
@@ -1665,8 +1665,11 @@ public class IndexedDiskCache
* <p>
*/
protected static final class PositionComparator
- implements Comparator<IndexedDiskElementDescriptor>
+ implements Comparator<IndexedDiskElementDescriptor>, Serializable
{
+ /** serialVersionUID */
+ private static final long serialVersionUID = -8387365338590814113L;
+
/**
* Compares two descriptors based on position.
* <p>
@@ -1698,6 +1701,7 @@ public class IndexedDiskCache
*/
public class LRUMap
extends LRUMapJCS<Serializable, IndexedDiskElementDescriptor>
+ // implements Serializable
{
/** Don't change */
private static final long serialVersionUID = 4955079991472142198L;
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java Sun Aug 14 18:13:15 2011
@@ -253,7 +253,7 @@ public class MySQLDiskCacheManager
* <p>
* @author Aaron Smuts
*/
- private class OptimizerTask
+ private static class OptimizerTask
extends TimerTask
{
/** Handles optimization */
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java Sun Aug 14 18:13:15 2011
@@ -169,7 +169,7 @@ public class LateralCache
{
elements = lateralCacheService.getMatching( cacheName, pattern );
}
- catch ( Exception e )
+ catch ( IOException e )
{
log.error( e );
handleException( e, "Failed to getMatching [" + pattern + "] from " + lateralCacheAttribures.getCacheName() + "@" + lateralCacheAttribures );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java Sun Aug 14 18:13:15 2011
@@ -123,22 +123,19 @@ public class LateralCacheMonitor
}
}
- if ( alright )
+ synchronized ( this )
{
- synchronized ( this )
+ if ( alright )
{
- if ( alright )
+ // Failure driven mode.
+ try
{
- // Failure driven mode.
- try
- {
- wait();
- // wake up only if there is an error.
- }
- catch ( InterruptedException ignore )
- {
- //no op, this is expected
- }
+ wait();
+ // wake up only if there is an error.
+ }
+ catch ( InterruptedException ignore )
+ {
+ //no op, this is expected
}
}
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java Sun Aug 14 18:13:15 2011
@@ -76,7 +76,7 @@ public class LateralTCPSender
private final static int RESET_FREQUENCY = 70;
/** Use to synchronize multiple threads that may be trying to get. */
- private Object getLock = new int[0];
+ private final Object getLock = new int[0];
/**
* Constructor for the LateralTCPSender object.
@@ -305,10 +305,7 @@ public class LateralTCPSender
catch ( IOException ioe )
{
String message = "Could not open ObjectInputStream to " + socket;
- if ( socket != null )
- {
- message += " SoTimeout [" + socket.getSoTimeout() + "] Connected [" + socket.isConnected() + "]";
- }
+ message += " SoTimeout [" + socket.getSoTimeout() + "] Connected [" + socket.isConnected() + "]";
log.error( message, ioe );
throw ioe;
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java Sun Aug 14 18:13:15 2011
@@ -416,12 +416,19 @@ public class LateralTCPService
{
System.out.println( "enter mesage:" );
message = br.readLine();
+
+ if (message == null)
+ {
+ notDone = false;
+ continue;
+ }
+
CacheElement ce = new CacheElement( "test", "test", message );
LateralElementDescriptor led = new LateralElementDescriptor( ce );
sender.send( led );
}
}
- catch ( Exception e )
+ catch ( IOException e )
{
System.out.println( e.toString() );
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java Sun Aug 14 18:13:15 2011
@@ -39,7 +39,7 @@ import org.apache.jcs.utils.serializatio
/** Shared listener base. */
public abstract class AbsractRemoteCacheListener
- implements IRemoteCacheListener
+ implements IRemoteCacheListener, Serializable
{
/** Don't change */
private static final long serialVersionUID = 32442324243243L;
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java Sun Aug 14 18:13:15 2011
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.remote;
* under the License.
*/
+import java.io.IOException;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.engine.CacheConstants;
@@ -425,7 +427,7 @@ public class RemoteCacheFailoverRunner
}
}
}
- catch ( Exception e )
+ catch ( IOException e )
{
// TODO, should try again, or somehow stop the listener
log.error(
@@ -473,7 +475,7 @@ public class RemoteCacheFailoverRunner
}
}
}
- catch ( Exception ex )
+ catch ( NumberFormatException ex )
{
log.error( ex );
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java Sun Aug 14 18:13:15 2011
@@ -744,7 +744,7 @@ class RemoteCacheServer
*/
private boolean isRequestFromCluster( long requesterId )
{
- Integer remoteTypeL = idTypeMap.get( new Long( requesterId ) );
+ Integer remoteTypeL = idTypeMap.get( Long.valueOf( requesterId ) );
boolean fromCluster = false;
if ( remoteTypeL != null && remoteTypeL.intValue() == IRemoteCacheAttributes.CLUSTER )
@@ -1354,10 +1354,10 @@ class RemoteCacheServer
}
// relate the type to an id
- this.idTypeMap.put( new Long( id ), new Integer( remoteType ) );
+ this.idTypeMap.put( Long.valueOf( id ), Integer.valueOf( remoteType ) );
if ( listenerAddress != null )
{
- this.idIPMap.put( new Long( id ), listenerAddress );
+ this.idIPMap.put( Long.valueOf( id ), listenerAddress );
}
}
catch ( IOException ioe )
@@ -1449,7 +1449,7 @@ class RemoteCacheServer
}
Map<Long, ICacheEventQueue> eventQMap = cacheDesc.eventQMap;
cleanupEventQMap( eventQMap );
- ICacheEventQueue q = eventQMap.remove( new Long( listenerId ) );
+ ICacheEventQueue q = eventQMap.remove( Long.valueOf( listenerId ) );
if ( q != null )
{
@@ -1470,8 +1470,8 @@ class RemoteCacheServer
}
// cleanup
- idTypeMap.remove( new Long( listenerId ) );
- idIPMap.remove( new Long( listenerId ) );
+ idTypeMap.remove( Long.valueOf( listenerId ) );
+ idIPMap.remove( Long.valueOf( listenerId ) );
if ( log.isInfoEnabled() )
{
@@ -1663,7 +1663,7 @@ class RemoteCacheServer
*/
protected String getExtraInfoForRequesterId( long requesterId )
{
- String ipAddress = idIPMap.get( new Long( requesterId ) );
+ String ipAddress = idIPMap.get( Long.valueOf( requesterId ) );
return ipAddress;
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java Sun Aug 14 18:13:15 2011
@@ -383,10 +383,6 @@ public class RemoteCacheServerFactory
static void shutdownImpl( String host, int port )
throws IOException
{
- if ( remoteCacheServer == null )
- {
- return;
- }
synchronized ( RemoteCacheServer.class )
{
if ( remoteCacheServer == null )
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheElementSerialized.java Sun Aug 14 18:13:15 2011
@@ -20,6 +20,7 @@ package org.apache.jcs.engine;
*/
import java.io.Serializable;
+import java.util.Arrays;
import org.apache.jcs.engine.behavior.ICacheElementSerialized;
import org.apache.jcs.engine.behavior.IElementAttributes;
@@ -113,13 +114,14 @@ public class CacheElementSerialized
* <p>
* @return debugging string.
*/
+ @Override
public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append( "\n CacheElementSerialized: " );
buf.append( "\n CacheName = [" + getCacheName() + "]" );
buf.append( "\n Key = [" + getKey() + "]" );
- buf.append( "\n SerializedValue = " + getSerializedValue() );
+ buf.append( "\n SerializedValue = " + Arrays.toString(getSerializedValue()) );
buf.append( "\n ElementAttributes = " + getElementAttributes() );
return buf.toString();
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueue.java Sun Aug 14 18:13:15 2011
@@ -123,13 +123,16 @@ public class CacheEventQueue
}
/**
- * Kill the processor thread and indicate that the queue is detroyed and no longer alive, but it
+ * Kill the processor thread and indicate that the queue is destroyed and no longer alive, but it
* can still be working.
*/
- public synchronized void stopProcessing()
+ public void stopProcessing()
{
- destroyed = true;
- processorThread = null;
+ synchronized (queueLock)
+ {
+ destroyed = true;
+ processorThread = null;
+ }
}
/**
@@ -137,39 +140,39 @@ public class CacheEventQueue
* <p>
* Calling destroy interrupts the processor thread.
*/
- public synchronized void destroy()
+ public void destroy()
{
- if ( !destroyed )
+ synchronized (queueLock)
{
- destroyed = true;
-
- if ( log.isInfoEnabled() )
+ if ( !destroyed )
{
- log.info( "Destroying queue, stats = " + getStatistics() );
- }
+ destroyed = true;
- // Synchronize on queue so the thread will not wait forever,
- // and then interrupt the QueueProcessor
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Destroying queue, stats = " + getStatistics() );
+ }
- if ( processorThread != null )
- {
- synchronized ( queueLock )
+ // Synchronize on queue so the thread will not wait forever,
+ // and then interrupt the QueueProcessor
+
+ if ( processorThread != null )
{
processorThread.interrupt();
+ processorThread = null;
}
- }
- processorThread = null;
- if ( log.isInfoEnabled() )
- {
- log.info( "Cache event queue destroyed: " + this );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Cache event queue destroyed: " + this );
+ }
}
- }
- else
- {
- if ( log.isInfoEnabled() )
+ else
{
- log.info( "Destroy was called after queue was destroyed. Doing nothing. Stats = " + getStatistics() );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Destroy was called after queue was destroyed. Doing nothing. Stats = " + getStatistics() );
+ }
}
}
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java Sun Aug 14 18:13:15 2011
@@ -21,6 +21,7 @@ package org.apache.jcs.engine;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
@@ -174,7 +175,11 @@ public class ElementAttributes
attr.createTime = System.currentTimeMillis();
return attr;
}
- catch ( Exception e )
+ catch ( IOException e )
+ {
+ // swallow
+ }
+ catch (ClassNotFoundException e)
{
// swallow
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java Sun Aug 14 18:13:15 2011
@@ -1394,10 +1394,6 @@ public class CompositeCache
*/
public void save()
{
- if ( !alive )
- {
- return;
- }
synchronized ( this )
{
if ( !alive )
@@ -1466,7 +1462,7 @@ public class CompositeCache
* <p>
* @return The status value
*/
- public int getStatus()
+ public synchronized int getStatus()
{
return alive ? CacheConstants.STATUS_ALIVE : CacheConstants.STATUS_DISPOSED;
}
@@ -1761,7 +1757,7 @@ public class CompositeCache
/**
* @param updateCount The updateCount to set.
*/
- public void setUpdateCount( int updateCount )
+ public synchronized void setUpdateCount( int updateCount )
{
this.updateCount = updateCount;
}
@@ -1769,7 +1765,7 @@ public class CompositeCache
/**
* @return Returns the updateCount.
*/
- public int getUpdateCount()
+ public synchronized int getUpdateCount()
{
return updateCount;
}
@@ -1777,7 +1773,7 @@ public class CompositeCache
/**
* @param removeCount The removeCount to set.
*/
- public void setRemoveCount( int removeCount )
+ public synchronized void setRemoveCount( int removeCount )
{
this.removeCount = removeCount;
}
@@ -1785,7 +1781,7 @@ public class CompositeCache
/**
* @return Returns the removeCount.
*/
- public int getRemoveCount()
+ public synchronized int getRemoveCount()
{
return removeCount;
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/ElementEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/ElementEventQueue.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/ElementEventQueue.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/ElementEventQueue.java Sun Aug 14 18:13:15 2011
@@ -87,36 +87,38 @@ public class ElementEventQueue
/**
* Event Q is empty.
*/
- public synchronized void destroy()
+ public void destroy()
{
- if ( !destroyed )
+ synchronized ( queueLock )
{
- destroyed = true;
-
- // synchronize on queue so the thread will not wait forever,
- // and then interrupt the QueueProcessor
- synchronized ( queueLock )
+ if ( !destroyed )
{
- processorThread.interrupt();
- }
+ destroyed = true;
- processorThread = null;
+ // synchronize on queue so the thread will not wait forever,
+ // and then interrupt the QueueProcessor
+ processorThread.interrupt();
+ processorThread = null;
- if ( log.isInfoEnabled() )
- {
- log.info( "Element event queue destroyed: " + this );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Element event queue destroyed: " + this );
+ }
}
}
}
/**
- * Kill the processor thread and indicate that the queue is detroyed and no longer alive, but it
+ * Kill the processor thread and indicate that the queue is destroyed and no longer alive, but it
* can still be working.
*/
- public synchronized void stopProcessing()
+ public void stopProcessing()
{
- destroyed = true;
- processorThread = null;
+ synchronized ( queueLock )
+ {
+ destroyed = true;
+ processorThread = null;
+ }
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventQueue.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventQueue.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventQueue.java Sun Aug 14 18:13:15 2011
@@ -20,13 +20,14 @@ package org.apache.jcs.engine.control.ev
*/
import java.io.IOException;
+import java.io.Serializable;
/**
* Interface for an element event queue. An event queue is used to propagate
* ordered element events in one region.
*
*/
-public interface IElementEventQueue
+public interface IElementEventQueue extends Serializable
{
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java Sun Aug 14 18:13:15 2011
@@ -4,7 +4,7 @@ import java.io.Serializable;
import java.util.Set;
/** Key matchers need to implement this interface. */
-public interface IKeyMatcher
+public interface IKeyMatcher extends Serializable
{
/**
* Creates a pattern and find matches on the array.
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoulbeLinkedListMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoulbeLinkedListMemoryCache.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoulbeLinkedListMemoryCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoulbeLinkedListMemoryCache.java Sun Aug 14 18:13:15 2011
@@ -551,7 +551,7 @@ public abstract class AbstractDoulbeLink
/**
* iteration aid
*/
- public class IteratorWrapper
+ public static class IteratorWrapper
implements Iterator<Entry<Serializable, MemoryElementDescriptor>>
{
/** The internal iterator */
@@ -606,7 +606,7 @@ public abstract class AbstractDoulbeLink
/**
* @author Aaron Smuts
*/
- public class MapEntryWrapper<K>
+ public static class MapEntryWrapper<K>
implements Map.Entry<K, ICacheElement>
{
/** The internal entry */
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/shrinking/ShrinkerThread.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/shrinking/ShrinkerThread.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/shrinking/ShrinkerThread.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/shrinking/ShrinkerThread.java Sun Aug 14 18:13:15 2011
@@ -211,8 +211,6 @@ public class ShrinkerThread
}
}
}
-
- keys = null;
}
catch ( Throwable t )
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java Sun Aug 14 18:13:15 2011
@@ -144,8 +144,8 @@ public class PropertySetter
* specified in the call to this method.
* <p>
* If the setter expects a String no conversion is necessary. If it expects an int, then an
- * attempt is made to convert 'value' to an int using new Integer(value). If the setter expects
- * a boolean, the conversion is by new Boolean(value).
+ * attempt is made to convert 'value' to an int using Integer.valueOf(value). If the setter expects
+ * a boolean, the conversion is by Boolean.valueOf(value).
* @param name name of the property
* @param value String value of the property
*/
@@ -245,11 +245,11 @@ public class PropertySetter
}
else if ( Integer.TYPE.isAssignableFrom( type ) )
{
- return new Integer( v );
+ return Integer.valueOf( v );
}
else if ( Long.TYPE.isAssignableFrom( type ) )
{
- return new Long( v );
+ return Long.valueOf( v );
}
else if ( Boolean.TYPE.isAssignableFrom( type ) )
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/date/DateFormatter.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/date/DateFormatter.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/date/DateFormatter.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/date/DateFormatter.java Sun Aug 14 18:13:15 2011
@@ -1,6 +1,5 @@
package org.apache.jcs.utils.date;
-import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
@@ -24,10 +23,10 @@ public final class DateFormatter
private static final String dddHHmmssFormat = "DDDHHmmss";
/** dddHHmmFormatter */
- private static final DateFormat dddHHmmFormatter = new ThreadSafeSimpleDateFormat( dddHHmmFormat );
+ private static final ThreadSafeSimpleDateFormat dddHHmmFormatter = new ThreadSafeSimpleDateFormat( dddHHmmFormat );
/** dddHHmmssFormatter */
- private static final DateFormat dddHHmmssFormatter = new ThreadSafeSimpleDateFormat( dddHHmmssFormat );
+ private static final ThreadSafeSimpleDateFormat dddHHmmssFormatter = new ThreadSafeSimpleDateFormat( dddHHmmssFormat );
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/props/AbstractPropertyContainer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/props/AbstractPropertyContainer.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/props/AbstractPropertyContainer.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/props/AbstractPropertyContainer.java Sun Aug 14 18:13:15 2011
@@ -127,7 +127,7 @@ public abstract class AbstractPropertyCo
/**
* @return Returns the properties.
*/
- public Properties getProperties()
+ public synchronized Properties getProperties()
{
return properties;
}
@@ -143,7 +143,7 @@ public abstract class AbstractPropertyCo
/**
* @return Returns the propertiesHeading.
*/
- public String getPropertiesHeading()
+ public synchronized String getPropertiesHeading()
{
return propertiesHeading;
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java Sun Aug 14 18:13:15 2011
@@ -279,7 +279,7 @@ public class ThreadPoolManager
}
/**
- * This will be used if it is not null on initialzation. Setting this post initialization will
+ * This will be used if it is not null on initialization. Setting this post initialization will
* have no effect.
* <p>
* @param props The props to set.
@@ -298,7 +298,7 @@ public class ThreadPoolManager
}
/**
- * Intialize the ThreadPoolManager and create all the pools defined in the configuration.
+ * Initialize the ThreadPoolManager and create all the pools defined in the configuration.
*/
protected void configure()
{
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSLightLoadUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSLightLoadUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSLightLoadUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSLightLoadUnitTest.java Sun Aug 14 18:13:15 2011
@@ -36,6 +36,7 @@ public class JCSLightLoadUnitTest
* Test setup
* @throws Exception
*/
+ @Override
public void setUp()
throws Exception
{
@@ -90,10 +91,7 @@ public class JCSLightLoadUnitTest
for ( int i = items; i > 0; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( res == null )
- {
- assertNotNull( "[" + i + ":key] should not be null", res );
- }
+ assertNotNull( "[" + i + ":key] should not be null", res );
}
// test removal
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSRemovalSimpleConcurrentTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSRemovalSimpleConcurrentTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSRemovalSimpleConcurrentTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSRemovalSimpleConcurrentTest.java Sun Aug 14 18:13:15 2011
@@ -38,8 +38,9 @@ public class JCSRemovalSimpleConcurrentT
/**
* Test setup
* <p>
- * @throws Exception
+ * @throws Exception
*/
+ @Override
public void setUp()
throws Exception
{
@@ -80,10 +81,7 @@ public class JCSRemovalSimpleConcurrentT
for ( int i = count; i >= 0; i-- )
{
String res = (String) jcs.get( "key:" + i + ":anotherpart" );
- if ( res == null )
- {
- assertNotNull( "[key:" + i + ":anotherpart] should not be null, " + jcs.getStats(), res );
- }
+ assertNotNull( "[key:" + i + ":anotherpart] should not be null, " + jcs.getStats(), res );
}
System.out.println( "Confirmed that " + count + " items could be found" );
@@ -121,10 +119,7 @@ public class JCSRemovalSimpleConcurrentT
for ( int i = count; i >= 0; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( res == null )
- {
- assertNotNull( "[" + i + ":key] should not be null", res );
- }
+ assertNotNull( "[" + i + ":key] should not be null", res );
}
System.out.println( "Confirmed that " + count + " items could be found" );
@@ -162,10 +157,7 @@ public class JCSRemovalSimpleConcurrentT
for ( int i = count; i >= 0; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( res == null )
- {
- assertNotNull( "[" + i + ":key] should not be null", res );
- }
+ assertNotNull( "[" + i + ":key] should not be null", res );
}
System.out.println( "Confirmed that " + count + " items could be found" );
@@ -210,10 +202,7 @@ public class JCSRemovalSimpleConcurrentT
for ( int i = count; i >= 0; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( res == null )
- {
- assertNotNull( "[" + i + ":key] should not be null", res );
- }
+ assertNotNull( "[" + i + ":key] should not be null", res );
}
System.out.println( "Confirmed that " + count + " items could be found" );
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/RemovalTestUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/RemovalTestUtil.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/RemovalTestUtil.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/RemovalTestUtil.java Sun Aug 14 18:13:15 2011
@@ -63,10 +63,7 @@ public class RemovalTestUtil
for ( int i = end; i >= start; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( res == null )
- {
- assertNotNull( "[" + i + ":key] should not be null", res );
- }
+ assertNotNull( "[" + i + ":key] should not be null", res );
}
System.out.println( "Confirmed that " + ( end - start ) + " items could be found" );
@@ -104,12 +101,8 @@ public class RemovalTestUtil
for ( int i = end; i >= start; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( res == null )
- {
- assertNotNull( "[" + i + ":key] should not be null", res );
- }
+ assertNotNull( "[" + i + ":key] should not be null", res );
}
-
}
/**
@@ -132,13 +125,10 @@ public class RemovalTestUtil
for ( int i = end; i >= start; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( check && res == null )
+ if ( check )
{
assertNotNull( "[" + i + ":key] should not be null", res );
}
-
}
-
}
-
}
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/ZeroSizeCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/ZeroSizeCacheUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/ZeroSizeCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/ZeroSizeCacheUnitTest.java Sun Aug 14 18:13:15 2011
@@ -35,8 +35,9 @@ public class ZeroSizeCacheUnitTest
/**
* Test setup
* <p>
- * @throws Exception
+ * @throws Exception
*/
+ @Override
public void setUp()
throws Exception
{
@@ -64,10 +65,7 @@ public class ZeroSizeCacheUnitTest
for ( int i = items; i >= 0; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( res == null )
- {
- assertNull( "[" + i + ":key] should be null", res );
- }
+ assertNull( "[" + i + ":key] should be null", res );
}
// test removal, should be no exceptions
@@ -85,10 +83,7 @@ public class ZeroSizeCacheUnitTest
for ( int i = items; i >= 0; i-- )
{
String res = (String) jcs.get( i + ":key" );
- if ( res == null )
- {
- assertNull( "[" + i + ":key] should be null", res );
- }
+ assertNull( "[" + i + ":key] should be null", res );
}
System.out.println( jcs.getStats() );
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/access/CacheAccessUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/access/CacheAccessUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/access/CacheAccessUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/access/CacheAccessUnitTest.java Sun Aug 14 18:13:15 2011
@@ -274,14 +274,14 @@ public class CacheAccessUnitTest
// insert with prefix1
for ( int i = 0; i < numToInsertPrefix1; i++ )
{
- access.put( keyprefix1 + String.valueOf( i ), new Integer( i ) );
+ access.put( keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
}
int numToInsertPrefix2 = 50;
// insert with prefix1
for ( int i = 0; i < numToInsertPrefix2; i++ )
{
- access.put( keyprefix2 + String.valueOf( i ), new Integer( i ) );
+ access.put( keyprefix2 + String.valueOf( i ), Integer.valueOf( i ) );
}
Map result1 = access.getMatching( keyprefix1 + ".+" );
@@ -331,14 +331,14 @@ public class CacheAccessUnitTest
// insert with prefix1
for ( int i = 0; i < numToInsertPrefix1; i++ )
{
- access.put( keyprefix1 + String.valueOf( i ), new Integer( i ) );
+ access.put( keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
}
int numToInsertPrefix2 = 50;
// insert with prefix1
for ( int i = 0; i < numToInsertPrefix2; i++ )
{
- access.put( keyprefix2 + String.valueOf( i ), new Integer( i ) );
+ access.put( keyprefix2 + String.valueOf( i ), Integer.valueOf( i ) );
}
Map result1 = access.getMatchingCacheElements( keyprefix1 + "\\S+" );
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java Sun Aug 14 18:13:15 2011
@@ -20,6 +20,7 @@ package org.apache.jcs.access;
*/
import java.io.BufferedReader;
+import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.Map;
@@ -93,7 +94,7 @@ public class TestCacheAccess
message = br.readLine();
- if ( message.startsWith( "help" ) )
+ if ( message == null || message.startsWith( "help" ) )
{
help();
}
@@ -162,26 +163,26 @@ public class TestCacheAccess
else if ( message.startsWith( "putm" ) )
{
String numS = message.substring( message.indexOf( " " ) + 1, message.length() );
- int num = Integer.parseInt( numS.trim() );
if ( numS == null )
{
p( "usage: putm numbertoput" );
}
else
{
+ int num = Integer.parseInt( numS.trim() );
putMultiple( num );
}
}
else if ( message.startsWith( "pute" ) )
{
String numS = message.substring( message.indexOf( " " ) + 1, message.length() );
- int num = Integer.parseInt( numS.trim() );
if ( numS == null )
{
p( "usage: putme numbertoput" );
}
else
{
+ int num = Integer.parseInt( numS.trim() );
long n_start = System.currentTimeMillis();
for ( int n = 0; n < num; n++ )
{
@@ -198,16 +199,16 @@ public class TestCacheAccess
{
processPut( message );
}
- if ( message.startsWith( "removem" ) )
+ else if ( message.startsWith( "removem" ) )
{
String numS = message.substring( message.indexOf( " " ) + 1, message.length() );
- int num = Integer.parseInt( numS.trim() );
if ( numS == null )
{
p( "usage: removem numbertoremove" );
}
else
{
+ int num = Integer.parseInt( numS.trim() );
removeMultiple( num );
}
}
@@ -230,13 +231,13 @@ public class TestCacheAccess
else if ( message.startsWith( "cloneattr" ) )
{
String numS = message.substring( message.indexOf( " " ) + 1, message.length() );
- int num = Integer.parseInt( numS.trim() );
if ( numS == null )
{
p( "usage: put numbertoput" );
}
else
{
+ int num = Integer.parseInt( numS.trim() );
IElementAttributes attrp = new ElementAttributes();
long n_start = System.currentTimeMillis();
for ( int n = 0; n < num; n++ )
@@ -273,7 +274,12 @@ public class TestCacheAccess
}
}
}
- catch ( Exception e )
+ catch ( CacheException e )
+ {
+ p( e.toString() );
+ e.printStackTrace( System.out );
+ }
+ catch (IOException e)
{
p( e.toString() );
e.printStackTrace( System.out );
@@ -307,7 +313,7 @@ public class TestCacheAccess
}
else if ( tcnt == 3 )
{
- show = new Boolean( t ).booleanValue();
+ show = Boolean.valueOf( t ).booleanValue();
}
}
@@ -346,7 +352,7 @@ public class TestCacheAccess
}
else if ( tcnt == 4 )
{
- show = new Boolean( t ).booleanValue();
+ show = Boolean.valueOf( t ).booleanValue();
}
}
@@ -401,7 +407,7 @@ public class TestCacheAccess
}
else if ( tcnt == 4 )
{
- show = new Boolean( t ).booleanValue();
+ show = Boolean.valueOf( t ).booleanValue();
}
}
@@ -576,7 +582,7 @@ public class TestCacheAccess
}
else if ( tcnt == 4 )
{
- show = new Boolean( t ).booleanValue();
+ show = Boolean.valueOf( t ).booleanValue();
}
}
@@ -627,7 +633,7 @@ public class TestCacheAccess
}
else if ( tcnt == 3 )
{
- show = new Boolean( t ).booleanValue();
+ show = Boolean.valueOf( t ).booleanValue();
}
}
@@ -677,7 +683,7 @@ public class TestCacheAccess
}
else if ( tcnt == 3 )
{
- show = new Boolean( t ).booleanValue();
+ show = Boolean.valueOf( t ).booleanValue();
}
}
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/admin/CountingStreamUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/admin/CountingStreamUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/admin/CountingStreamUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/admin/CountingStreamUnitTest.java Sun Aug 14 18:13:15 2011
@@ -43,6 +43,7 @@ public class CountingStreamUnitTest
assertEquals( "Wrong number of bytes written.", 1, out.getCount() );
out.write( 1 );
assertEquals( "Wrong number of bytes written.", 2, out.getCount() );
+ out.close();
}
/**
@@ -56,10 +57,11 @@ public class CountingStreamUnitTest
byte[] array = new byte[]{1,2,3,4,5};
out.write( array );
assertEquals( "Wrong number of bytes written.", array.length, out.getCount() );
+ out.close();
}
/**
- * This should count the len -- the tird arg
+ * This should count the len -- the third arg
*
* @throws Exception
*/
@@ -70,5 +72,6 @@ public class CountingStreamUnitTest
int len = 3;
out.write( array, 0, len );
assertEquals( "Wrong number of bytes written.", len, out.getCount() );
+ out.close();
}
}
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java Sun Aug 14 18:13:15 2011
@@ -148,7 +148,7 @@ public class AbstractDiskCacheUnitTest
}
/** Concrete, testable instance. */
- class AbstractDiskCacheTestInstance
+ protected static class AbstractDiskCacheTestInstance
extends AbstractDiskCache
{
/** Internal map */
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java Sun Aug 14 18:13:15 2011
@@ -98,7 +98,7 @@ public class BlockDiskCacheSteadyLoadTes
int bytes = ( kiloBytes ) * 1024;
totalSize += bytes;
totalPut++;
- DiskTestObject object = new DiskTestObject( new Integer( i ), new byte[bytes] );
+ DiskTestObject object = new DiskTestObject( Integer.valueOf( i ), new byte[bytes] );
jcs.put( String.valueOf( totalPut ), object );
}
@@ -122,7 +122,7 @@ public class BlockDiskCacheSteadyLoadTes
Thread.sleep( pauseBetweenRuns );
- if ( runCount % 1 == 0 )
+ if ( runCount % 100 == 0 )
{
System.out.println( LOG_DIVIDER );
System.out.println( "Elapsed " + timer.getElapsedTimeString() );
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java Sun Aug 14 18:13:15 2011
@@ -53,7 +53,7 @@ public class BlockDiskElementDescriptorU
for ( int i = 0; i < numElements; i++ )
{
BlockDiskElementDescriptor descriptor = new BlockDiskElementDescriptor();
- descriptor.setKey( new Integer( i ) );
+ descriptor.setKey( Integer.valueOf( i ) );
descriptor.setBlocks( new int[] { 1, 2 } );
elements[i] = descriptor;
}
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java Sun Aug 14 18:13:15 2011
@@ -106,7 +106,7 @@ public class DiskTestObjectUtil
{
// 24 KB
int size = bytes * 1024;
- DiskTestObject tile = new DiskTestObject( new Integer( i ), new byte[size] );
+ DiskTestObject tile = new DiskTestObject( Integer.valueOf( i ), new byte[size] );
ICacheElement element = new CacheElement( cacheName, tile.id, tile );
elements[i] = element;
@@ -130,7 +130,7 @@ public class DiskTestObjectUtil
int bytes = random.nextInt( 20 );
// 4-24 KB
int size = ( bytes + 4 ) * 1024;
- DiskTestObject tile = new DiskTestObject( new Integer( i ), new byte[size] );
+ DiskTestObject tile = new DiskTestObject( Integer.valueOf( i ), new byte[size] );
ICacheElement element = new CacheElement( cacheName, tile.id, tile );
elements[i] = element;
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java Sun Aug 14 18:13:15 2011
@@ -84,14 +84,14 @@ public class IndexedDiskCacheDefragPerfo
{
int bytes = random.nextInt( 20 );
// 4-24 KB
- tile = new Tile( new Integer( i ), new byte[( bytes + 4 ) * 1024] );
+ tile = new Tile( Integer.valueOf( i ), new byte[( bytes + 4 ) * 1024] );
// images
jcs.put( tile.id, tile );
if ( ( i != 0 ) && ( 0 == ( i % 100 ) ) )
{
- jcs.get( new Integer( random.nextInt( i ) ) );
+ jcs.get( Integer.valueOf( random.nextInt( i ) ) );
}
if ( 0 == ( i % LOG_INCREMENT ) )
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java Sun Aug 14 18:13:15 2011
@@ -70,7 +70,7 @@ public class IndexedDiskCacheOptimizatio
// DO WORK
for ( int i = 0; i < removeCount; i++ )
{
- disk.processRemove( new Integer( i ) );
+ disk.processRemove( Integer.valueOf( i ) );
}
SleepUtil.sleepAtLeast( 1000 );
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java Sun Aug 14 18:13:15 2011
@@ -98,7 +98,7 @@ public class IndexedDiskCacheSteadyLoadT
int bytes = ( kiloBytes ) * 1024;
totalSize += bytes;
totalPut++;
- DiskTestObject object = new DiskTestObject( new Integer( i ), new byte[bytes] );
+ DiskTestObject object = new DiskTestObject( Integer.valueOf( i ), new byte[bytes] );
jcs.put( String.valueOf( totalPut ), object );
}
@@ -112,7 +112,7 @@ public class IndexedDiskCacheSteadyLoadT
}
Thread.sleep( pauseBetweenRuns );
- if ( runCount % 1 == 0 )
+ if ( runCount % 100 == 0 )
{
System.out.println( LOG_DIVIDER );
System.out.println( "Elapsed " + timer.getElapsedTimeString() );
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java Sun Aug 14 18:13:15 2011
@@ -292,7 +292,7 @@ public class TestTCPLateralUnitTest
for ( int i = 0; i < numToInsertPrefix1; i++ )
{
// add the item to the listeners cache
- ICacheElement element = new CacheElement( "test", keyprefix1 + String.valueOf( i ), new Integer( i ) );
+ ICacheElement element = new CacheElement( "test", keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
cacheMgr.getCache().update( element );
}
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java Sun Aug 14 18:13:15 2011
@@ -118,7 +118,7 @@ public class MockRemoteCacheService
{
lastUpdate = item;
updateRequestList.add( item );
- updateRequestIdList.add( new Long( requesterId ) );
+ updateRequestIdList.add( Long.valueOf( requesterId ) );
}
/**
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java Sun Aug 14 18:13:15 2011
@@ -68,7 +68,7 @@ public class RemoteCacheUnitTest
.getDeSerializedCacheElement( (ICacheElementSerialized) service.lastUpdate, remoteCache
.getElementSerializer() );
assertEquals( "Wrong element updated.", element.getVal(), result.getVal() );
- assertEquals( "Wrong listener id.", new Long( listenerId ), service.updateRequestIdList.get( 0 ) );
+ assertEquals( "Wrong listener id.", Long.valueOf( listenerId ), service.updateRequestIdList.get( 0 ) );
}
/**
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java Sun Aug 14 18:13:15 2011
@@ -246,7 +246,7 @@ public class RemoteCacheServerUnitTest
for ( int i = 0; i < numToPut; i++ )
{
- ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), new Long( i ) );
+ ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Long.valueOf( i ) );
inputItems.add( element );
server.update( element, 9999 );
}
@@ -297,7 +297,7 @@ public class RemoteCacheServerUnitTest
for ( int i = 0; i < numToPut; i++ )
{
- ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), new Long( i ) );
+ ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Long.valueOf( i ) );
inputItems.add( element );
// update using the cluster listener id
server.update( element, clusterListener.getListenerId() );
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java Sun Aug 14 18:13:15 2011
@@ -45,13 +45,13 @@ public class EventQueueConcurrentLoadTes
private static CacheListenerImpl listen = null;
/** max failure setting */
- private int maxFailure = 3;
+ private final int maxFailure = 3;
/** time to wait before rtrying on failure. */
- private int waitBeforeRetry = 100;
+ private final int waitBeforeRetry = 100;
/** very small idle time */
- private int idleTime = 2;
+ private final int idleTime = 2;
/**
* Constructor for the TestDiskCache object.
@@ -82,6 +82,7 @@ public class EventQueueConcurrentLoadTes
suite.addTest( new EventQueueConcurrentLoadTest( "testRunPutTest1" )
{
+ @Override
public void runTest()
throws Exception
{
@@ -91,6 +92,7 @@ public class EventQueueConcurrentLoadTes
suite.addTest( new EventQueueConcurrentLoadTest( "testRunPutTest2" )
{
+ @Override
public void runTest()
throws Exception
{
@@ -100,6 +102,7 @@ public class EventQueueConcurrentLoadTes
suite.addTest( new EventQueueConcurrentLoadTest( "testRunRemoveTest1" )
{
+ @Override
public void runTest()
throws Exception
{
@@ -109,6 +112,7 @@ public class EventQueueConcurrentLoadTes
suite.addTest( new EventQueueConcurrentLoadTest( "testStopProcessing1" )
{
+ @Override
public void runTest()
throws Exception
{
@@ -118,6 +122,7 @@ public class EventQueueConcurrentLoadTes
suite.addTest( new EventQueueConcurrentLoadTest( "testRunPutTest4" )
{
+ @Override
public void runTest()
throws Exception
{
@@ -127,6 +132,7 @@ public class EventQueueConcurrentLoadTes
suite.addTest( new EventQueueConcurrentLoadTest( "testRunRemoveTest2" )
{
+ @Override
public void runTest()
throws Exception
{
@@ -136,6 +142,7 @@ public class EventQueueConcurrentLoadTes
suite.addTest( new EventQueueConcurrentLoadTest( "testStopProcessing2" )
{
+ @Override
public void runTest()
throws Exception
{
@@ -145,6 +152,7 @@ public class EventQueueConcurrentLoadTes
suite.addTest( new EventQueueConcurrentLoadTest( "testRunPutDelayTest" )
{
+ @Override
public void runTest()
throws Exception
{
@@ -158,6 +166,7 @@ public class EventQueueConcurrentLoadTes
/**
* Test setup. Create the static queue to be used by all tests
*/
+ @Override
public void setUp()
{
listen = new CacheListenerImpl();
@@ -285,7 +294,7 @@ public class EventQueueConcurrentLoadTes
/**
* This is a dummy cache listener to use when testing the event queue.
*/
- private class CacheListenerImpl
+ private static class CacheListenerImpl
implements ICacheListener
{
/**
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java Sun Aug 14 18:13:15 2011
@@ -118,7 +118,7 @@ public class MockCacheServiceNonLocal
{
lastUpdate = item;
updateRequestList.add( item );
- updateRequestIdList.add( new Long( requesterId ) );
+ updateRequestIdList.add( Long.valueOf( requesterId ) );
}
/**
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java Sun Aug 14 18:13:15 2011
@@ -291,7 +291,7 @@ public class CompositeCacheDiskUsageUnit
* <p>
* @author Aaron Smuts
*/
- public class MockAuxCache
+ public static class MockAuxCache
extends AbstractAuxiliaryCache
{
/** Don't change */
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java Sun Aug 14 18:13:15 2011
@@ -71,7 +71,7 @@ public class CompositeCacheUnitTest
int numToInsert = 10;
for ( int i = 0; i < numToInsert; i++ )
{
- ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), new Integer( i ) );
+ ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
cache.update( element, false );
}
@@ -110,7 +110,7 @@ public class CompositeCacheUnitTest
int numToInsert = 10;
for ( int i = 0; i < numToInsert; i++ )
{
- ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), new Integer( i ) );
+ ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
cache.update( element, false );
}
@@ -153,7 +153,7 @@ public class CompositeCacheUnitTest
// insert with prefix1
for ( int i = 0; i < numToInsertPrefix1; i++ )
{
- ICacheElement element = new CacheElement( cacheName, keyprefix1 + String.valueOf( i ), new Integer( i ) );
+ ICacheElement element = new CacheElement( cacheName, keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
cache.update( element, false );
}
@@ -161,7 +161,7 @@ public class CompositeCacheUnitTest
// insert with prefix1
for ( int i = 0; i < numToInsertPrefix2; i++ )
{
- ICacheElement element = new CacheElement( cacheName, keyprefix2 + String.valueOf( i ), new Integer( i ) );
+ ICacheElement element = new CacheElement( cacheName, keyprefix2 + String.valueOf( i ), Integer.valueOf( i ) );
cache.update( element, false );
}
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java?rev=1157592&r1=1157591&r2=1157592&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java Sun Aug 14 18:13:15 2011
@@ -39,6 +39,7 @@ public class SimpleEventHandlingUnitTest
/**
* Test setup with expected configuration parameters.
*/
+ @Override
public void setUp()
{
JCS.setConfigFilename( "/TestSimpleEventHandling.ccf" );
@@ -174,7 +175,7 @@ public class SimpleEventHandlingUnitTest
/**
* Simple event counter used to verify test results.
*/
- public class MyEventHandler
+ public static class MyEventHandler
implements IElementEventHandler
{
/** times spool called */