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 2012/11/07 11:29:17 UTC
svn commit: r1406523 [1/2] - in /commons/proper/jcs/trunk/src:
java/org/apache/jcs/access/ java/org/apache/jcs/auxiliary/
java/org/apache/jcs/auxiliary/disk/ java/org/apache/jcs/auxiliary/disk/block/
java/org/apache/jcs/auxiliary/disk/file/ java/org/ap...
Author: tv
Date: Wed Nov 7 10:29:14 2012
New Revision: 1406523
URL: http://svn.apache.org/viewvc?rev=1406523&view=rev
Log:
Comment on @SuppressWarnings
Some cleanup
Removed:
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/behavior/
Modified:
commons/proper/jcs/trunk/src/java/org/apache/jcs/access/PartitionedCacheAccess.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
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/BlockDiskCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptor.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/FileDiskCacheManager.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/indexed/IndexedDiskCacheManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.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/LateralCacheAbstractManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.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/AbstractRemoteAuxiliaryCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.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/RemoteCacheManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.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/CacheEventQueue.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.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/CompositeCacheConfigurator.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/CompressingSerializer.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java
commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java
commons/proper/jcs/trunk/src/test-conf/log4j.properties
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/MockLateralCache.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.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/utils/threadpool/ThreadPoolManagerUnitTest.java
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/access/PartitionedCacheAccess.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/access/PartitionedCacheAccess.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/access/PartitionedCacheAccess.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/access/PartitionedCacheAccess.java Wed Nov 7 10:29:14 2012
@@ -234,7 +234,7 @@ public class PartitionedCacheAccess<K ex
return Collections.emptyMap();
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
Set<K>[] dividedNames = new Set[this.getNumberOfPartitions()];
for (K key : names)
@@ -592,7 +592,7 @@ public class PartitionedCacheAccess<K ex
{
ensureProperties();
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
ICacheAccess<K, V>[] tempPartitions = new ICacheAccess[this.getNumberOfPartitions()];
for ( int i = 0; i < this.getNumberOfPartitions(); i++ )
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheManager.java Wed Nov 7 10:29:14 2012
@@ -21,16 +21,10 @@ package org.apache.jcs.auxiliary;
import java.io.Serializable;
-import org.apache.jcs.engine.behavior.ICacheType;
-
/**
* AuxiliaryCacheManager
- *
- * FIXME: Should not need to extend ICacheType
- *
*/
public interface AuxiliaryCacheManager
- extends ICacheType
{
/**
* Return the appropriate auxiliary cache for this region.
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java Wed Nov 7 10:29:14 2012
@@ -61,7 +61,7 @@ import org.apache.jcs.engine.stats.behav
*/
public abstract class AbstractDiskCache<K extends Serializable, V extends Serializable>
extends AbstractAuxiliaryCacheEventLogging<K, V>
- implements AuxiliaryCache<K, V>, Serializable
+ implements AuxiliaryCache<K, V>
{
/** Don't change. */
private static final long serialVersionUID = 6541664080877628324L;
@@ -582,9 +582,9 @@ public abstract class AbstractDiskCache<
* @see org.apache.jcs.engine.behavior.ICacheType#getCacheType
* @return Always returns DISK_CACHE since subclasses should all be of that type.
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
- return DISK_CACHE;
+ return CacheType.DISK_CACHE;
}
/**
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -263,7 +263,7 @@ public class BlockDisk
* @throws IOException
* @throws ClassNotFoundException
*/
- protected Serializable read( int[] blockNumbers )
+ protected <T extends Serializable> T read( int[] blockNumbers )
throws IOException, ClassNotFoundException
{
byte[] data = null;
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java Wed Nov 7 10:29:14 2012
@@ -208,7 +208,6 @@ public class BlockDiskCache<K extends Se
* (non-Javadoc)
* @see org.apache.jcs.auxiliary.disk.AbstractDiskCache#getGroupKeys(java.lang.String)
*/
- @SuppressWarnings("unchecked")
@Override
public Set<K> getGroupKeys( String groupName )
{
@@ -223,7 +222,9 @@ public class BlockDiskCache<K extends Se
{
if ( key instanceof GroupAttrName && ( (GroupAttrName<?>) key ).groupId.equals( groupId ) )
{
- keys.add( ( (GroupAttrName<K>) key ).attrName );
+ @SuppressWarnings("unchecked") // Type checked with instanceof
+ K newKey = ((GroupAttrName<K>) key ).attrName;
+ keys.add( newKey );
}
}
}
@@ -296,7 +297,6 @@ public class BlockDiskCache<K extends Se
* @return ICacheElement
* @see org.apache.jcs.auxiliary.disk.AbstractDiskCache#doGet(java.io.Serializable)
*/
- @SuppressWarnings("unchecked")
@Override
protected ICacheElement<K, V> processGet( K key )
{
@@ -322,7 +322,7 @@ public class BlockDiskCache<K extends Se
int[] ded = this.keyStore.get( key );
if ( ded != null )
{
- object = (ICacheElement<K, V>) this.dataFile.read( ded );
+ object = this.dataFile.read( ded );
}
}
catch ( IOException ioe )
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManager.java Wed Nov 7 10:29:14 2012
@@ -123,7 +123,7 @@ public class BlockDiskCacheManager
// Try to load the cache from the set that have already been
// created. This only looks at the name attribute.
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all caches
BlockDiskCache<K, V> blockDiskCache = (BlockDiskCache<K, V>) caches.get( cacheName );
cache = blockDiskCache;
@@ -140,14 +140,4 @@ public class BlockDiskCacheManager
return cache;
}
-
- /**
- * Gets the cacheType attribute of the DiskCacheManager object
- * <p>
- * @return The cacheType value
- */
- public int getCacheType()
- {
- return DISK_CACHE;
- }
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptor.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptor.java Wed Nov 7 10:29:14 2012
@@ -107,7 +107,7 @@ public class BlockDiskElementDescriptor<
* (non-Javadoc)
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need cast to K
public void readExternal( ObjectInput input )
throws IOException, ClassNotFoundException
{
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -267,7 +267,7 @@ public class BlockDiskKeyStore<K extends
{
while ( true )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast from Object
BlockDiskElementDescriptor<K> descriptor = (BlockDiskElementDescriptor<K>) ois.readObject();
if ( descriptor != null )
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/file/FileDiskCacheManager.java Wed Nov 7 10:29:14 2012
@@ -78,7 +78,7 @@ public class FileDiskCacheManager
// Try to load the cache from the set that have already been
// created. This only looks at the name attribute.
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all caches
FileDiskCache<K, V> fileDiskCache = (FileDiskCache<K, V>) caches.get( cacheName );
cache = fileDiskCache;
@@ -95,14 +95,4 @@ public class FileDiskCacheManager
return cache;
}
-
- /**
- * Gets the cacheType attribute of the DiskCacheManager object
- * <p>
- * @return The cacheType value
- */
- public int getCacheType()
- {
- return DISK_CACHE;
- }
}
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -77,7 +77,7 @@ class IndexedDisk
* @throws IOException
* @throws ClassNotFoundException
*/
- protected Serializable readObject( IndexedDiskElementDescriptor ded )
+ protected <T extends Serializable> T readObject( IndexedDiskElementDescriptor ded )
throws IOException, ClassNotFoundException
{
String message = null;
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -329,9 +329,8 @@ public class IndexedDiskCache<K extends
// create a key map to use.
initializeKeyMap();
- @SuppressWarnings("unchecked")
HashMap<K, IndexedDiskElementDescriptor> keys =
- (HashMap<K, IndexedDiskElementDescriptor>) keyFile.readObject( new IndexedDiskElementDescriptor( 0, (int) keyFile.length()
+ keyFile.readObject( new IndexedDiskElementDescriptor( 0, (int) keyFile.length()
- IndexedDisk.HEADER_SIZE_BYTES ) );
if ( keys != null )
@@ -719,8 +718,7 @@ public class IndexedDiskCache<K extends
}
try
{
- @SuppressWarnings("unchecked")
- ICacheElement<K, V> readObject = (ICacheElement<K, V>) dataFile.readObject( ded );
+ ICacheElement<K, V> readObject = dataFile.readObject( ded );
object = readObject;
// TODO consider checking key equality and throwing if there is a failure
}
@@ -757,7 +755,7 @@ public class IndexedDiskCache<K extends
{
if ( k instanceof GroupAttrName && ( (GroupAttrName<?>) k ).groupId.equals( groupId ) )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Type checked with instanceof
GroupAttrName<K> groupAttrName = (GroupAttrName<K>) k;
keys.add( groupAttrName.attrName );
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManager.java Wed Nov 7 10:29:14 2012
@@ -123,7 +123,7 @@ public class IndexedDiskCacheManager
// Try to load the cache from the set that have already been
// created. This only looks at the name attribute.
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all caches
IndexedDiskCache<K, V> indexedDiskCache = (IndexedDiskCache<K, V>) caches.get( cacheName );
cache = indexedDiskCache;
@@ -140,14 +140,4 @@ public class IndexedDiskCacheManager
return cache;
}
-
- /**
- * Gets the cacheType attribute of the DiskCacheManager object
- * <p>
- * @return The cacheType value
- */
- public int getCacheType()
- {
- return DISK_CACHE;
- }
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java Wed Nov 7 10:29:14 2012
@@ -198,7 +198,7 @@ public class JDBCDiskCache<K extends Ser
}
catch ( SQLException e )
{
- log.error( "Problem getting conenction.", e );
+ log.error( "Problem getting connection.", e );
return;
}
@@ -249,7 +249,7 @@ public class JDBCDiskCache<K extends Ser
try
{
- element = serialize( ce );
+ element = getElementSerializer().serialize( ce );
}
catch ( IOException e )
{
@@ -439,7 +439,7 @@ public class JDBCDiskCache<K extends Ser
}
catch ( SQLException e )
{
- log.error( "Problem getting conenction.", e );
+ log.error( "Problem getting connection.", e );
return exists;
}
@@ -983,7 +983,7 @@ public class JDBCDiskCache<K extends Ser
}
catch ( SQLException e1 )
{
- log.error( "Problem getting conenction.", e1 );
+ log.error( "Problem getting connection.", e1 );
return size;
}
try
@@ -1038,19 +1038,6 @@ public class JDBCDiskCache<K extends Ser
}
/**
- * Returns the serialized form of the given object in a byte array.
- * <p>
- * @param obj
- * @return byte[]
- * @throws IOException
- */
- protected byte[] serialize( ICacheElement<K, V> obj )
- throws IOException
- {
- return getElementSerializer().serialize( obj );
- }
-
- /**
* @param groupName
* @return Set
*/
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java Wed Nov 7 10:29:14 2012
@@ -21,7 +21,6 @@ package org.apache.jcs.auxiliary.disk.jd
import java.io.IOException;
import java.io.Serializable;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.Executors;
@@ -95,7 +94,7 @@ public abstract class JDBCDiskCacheManag
synchronized ( caches )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all caches
JDBCDiskCache<K, V> jdbcDiskCache = (JDBCDiskCache<K, V>) caches.get( cattr.getCacheName() );
diskCache = jdbcDiskCache;
@@ -179,16 +178,6 @@ public abstract class JDBCDiskCacheManag
}
}
- /**
- * Gets the cacheType attribute of the HSQLCacheManager object
- * <p>
- * @return The cacheType value
- */
- public int getCacheType()
- {
- return DISK_CACHE;
- }
-
/** Disposes of all regions. */
public void release()
{
@@ -199,11 +188,8 @@ public abstract class JDBCDiskCacheManag
}
synchronized ( caches )
{
- Enumeration<JDBCDiskCache<?, ?>> allCaches = caches.elements();
-
- while ( allCaches.hasMoreElements() )
+ for (JDBCDiskCache<?, ?> raf : caches.values())
{
- JDBCDiskCache<?, ?> raf = allCaches.nextElement();
if ( raf != null )
{
try
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -35,7 +35,6 @@ import org.apache.jcs.engine.CacheConsta
import org.apache.jcs.engine.ZombieCacheServiceNonLocal;
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
-import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.behavior.IZombie;
import org.apache.jcs.engine.stats.Stats;
import org.apache.jcs.engine.stats.behavior.IStats;
@@ -326,9 +325,9 @@ public class LateralCache<K extends Seri
* <p>
* @return The cacheType value
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
- return ICacheType.LATERAL_CACHE;
+ return CacheType.LATERAL_CACHE;
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java Wed Nov 7 10:29:14 2012
@@ -112,16 +112,6 @@ public abstract class LateralCacheAbstra
public abstract <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( String cacheName );
/**
- * Gets the cacheType attribute of the LateralCacheManager object
- *
- * @return The cache type value
- */
- public int getCacheType()
- {
- return LATERAL_CACHE;
- }
-
- /**
* Gets the stats attribute of the LateralCacheManager object
*
* @return String
@@ -138,7 +128,7 @@ public abstract class LateralCacheAbstra
* @param lateralService
* @param lateralWatch
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need downcast to satisfy common interface
public void fixCaches( ICacheServiceNonLocal<Serializable, Serializable> lateralService, ILateralCacheObserver lateralWatch )
{
log.debug( "Fixing lateral caches:" );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java Wed Nov 7 10:29:14 2012
@@ -305,14 +305,14 @@ public class LateralCacheNoWait<K extend
* <p>
* @return The cacheType value
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
return cache.getCacheType();
}
/**
* Returns the asyn cache status. An error status indicates either the lateral connection is not
- * available, or the asyn queue has been unexpectedly destroyed. No lateral invokation.
+ * available, or the asyn queue has been unexpectedly destroyed. No lateral invocation.
* <p>
* @return The status value
*/
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java Wed Nov 7 10:29:14 2012
@@ -36,7 +36,6 @@ import org.apache.jcs.auxiliary.Auxiliar
import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.stats.StatElement;
import org.apache.jcs.engine.stats.Stats;
import org.apache.jcs.engine.stats.behavior.IStatElement;
@@ -124,7 +123,7 @@ public class LateralCacheNoWaitFacade<K
return false;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
LateralCacheNoWait<K, V>[] newArray = new LateralCacheNoWait[noWaits.length + 1];
System.arraycopy( noWaits, 0, newArray, 0, noWaits.length );
@@ -166,7 +165,7 @@ public class LateralCacheNoWaitFacade<K
return false;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
LateralCacheNoWait<K, V>[] newArray = new LateralCacheNoWait[noWaits.length - 1];
System.arraycopy( noWaits, 0, newArray, 0, position );
@@ -380,9 +379,9 @@ public class LateralCacheNoWaitFacade<K
* <p>
* @return The cacheType value
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
- return ICacheType.LATERAL_CACHE;
+ return CacheType.LATERAL_CACHE;
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java Wed Nov 7 10:29:14 2012
@@ -85,7 +85,7 @@ public class LateralCacheRestore
/**
* Fixes up all the caches managed by the associated cache manager.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // TODO: Strange cast. Need to revisit
public void fix()
{
if ( !canFix )
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java Wed Nov 7 10:29:14 2012
@@ -121,7 +121,7 @@ public class LateralTCPCacheFactory
createListener( (ILateralCacheAttributes) iaca, cacheMgr );
// create the no wait facade.
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
LateralCacheNoWait<K, V>[] lcnwArray = noWaits.toArray( new LateralCacheNoWait[0] );
LateralCacheNoWaitFacade<K, V> lcnwf = new LateralCacheNoWaitFacade<K, V>(lcnwArray, (ILateralCacheAttributes) iaca );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java Wed Nov 7 10:29:14 2012
@@ -232,12 +232,14 @@ public class LateralTCPCacheManager
LateralCacheNoWait<K, V> lateralNoWait = null;
synchronized ( caches )
{
+ // Need to cast because of common map for all caches
lateralNoWait = (LateralCacheNoWait<K, V>) caches.get( cacheName );
if ( lateralNoWait == null )
{
LateralCacheAttributes attr = (LateralCacheAttributes) lateralCacheAttributes.copy();
attr.setCacheName( cacheName );
+ // Need to cast to specific type
LateralCache<K, V> cache = new LateralCache<K, V>( attr,
(ICacheServiceNonLocal<K, V>)this.lateralService, monitor );
cache.setCacheEventLogger( cacheEventLogger );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java Wed Nov 7 10:29:14 2012
@@ -111,7 +111,7 @@ public class LateralTCPDiscoveryListener
*/
public <K extends Serializable, V extends Serializable> boolean containsNoWait( String cacheName, LateralCacheNoWait<K, V> noWait )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all facades
LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() );
if ( facade == null )
{
@@ -135,7 +135,7 @@ public class LateralTCPDiscoveryListener
*/
protected <K extends Serializable, V extends Serializable> boolean addNoWait( LateralCacheNoWait<K, V> noWait )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all facades
LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() );
if ( log.isDebugEnabled() )
{
@@ -175,7 +175,7 @@ public class LateralTCPDiscoveryListener
*/
protected <K extends Serializable, V extends Serializable> boolean removeNoWait( LateralCacheNoWait<K, V> noWait )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all facades
LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() );
if ( log.isDebugEnabled() )
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Wed Nov 7 10:29:14 2012
@@ -109,7 +109,7 @@ public class LateralTCPListener<K extend
public synchronized static <K extends Serializable, V extends Serializable> LateralTCPListener<K, V>
getInstance( ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all instances
LateralTCPListener<K, V> ins = (LateralTCPListener<K, V>) instances.get( String.valueOf( ilca.getTcpListenerPort() ) );
if ( ins == null )
@@ -504,7 +504,7 @@ public class LateralTCPListener<K extend
/**
* Main processing method for the LateralTCPReceiverConnection object
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Nee to cast from Object
public void run()
{
ObjectInputStream ois;
@@ -566,7 +566,7 @@ public class LateralTCPListener<K extend
{
ois.close();
}
- catch ( Exception e )
+ catch ( IOException e )
{
log.error( "Could not close object input stream.", e );
}
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -248,7 +248,7 @@ public class LateralTCPService<K extends
LateralElementDescriptor<K, V> led = new LateralElementDescriptor<K, V>( ce );
// led.requesterId = requesterId; // later
led.command = LateralElementDescriptor.GET;
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast from Object
ICacheElement<K, V> response = (ICacheElement<K, V>)sender.sendAndReceive( led );
if ( response != null )
{
@@ -288,7 +288,7 @@ public class LateralTCPService<K extends
* data in cache matching the pattern.
* @throws IOException
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast from Object
public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
throws IOException
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java Wed Nov 7 10:29:14 2012
@@ -626,7 +626,7 @@ public abstract class AbstractRemoteAuxi
*/
public void fixCache( ICacheServiceNonLocal<?, ?> restoredRemote )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Don't know how to do this properly
ICacheServiceNonLocal<K, V> remote = (ICacheServiceNonLocal<K, V>)restoredRemote;
if ( getRemoteCacheService() != null && getRemoteCacheService() instanceof ZombieCacheServiceNonLocal )
{
@@ -660,9 +660,9 @@ public abstract class AbstractRemoteAuxi
* Gets the cacheType attribute of the RemoteCache object
* @return The cacheType value
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
- return REMOTE_CACHE;
+ return CacheType.REMOTE_CACHE;
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java Wed Nov 7 10:29:14 2012
@@ -37,7 +37,6 @@ import org.apache.jcs.auxiliary.Auxiliar
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
@@ -316,9 +315,9 @@ public abstract class AbstractRemoteCach
* <p>
* @return The cacheType value
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
- return ICacheType.REMOTE_CACHE;
+ return CacheType.REMOTE_CACHE;
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java Wed Nov 7 10:29:14 2012
@@ -140,7 +140,7 @@ public class RemoteCache<K extends Seria
RemoteCacheMonitor.getInstance().notifyError();
// initiate failover if local
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all facades
RemoteCacheNoWaitFacade<K, V> rcnwf = (RemoteCacheNoWaitFacade<K, V>)RemoteCacheFactory.getFacades()
.get( getRemoteCacheAttributes().getCacheName() );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java Wed Nov 7 10:29:14 2012
@@ -171,7 +171,7 @@ public class RemoteCacheFactory
}
// end if CLUSTER
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
RemoteCacheNoWait<K, V>[] rcnwArray = noWaits.toArray( new RemoteCacheNoWait[0] );
RemoteCacheNoWaitFacade<K, V> rcnwf =
new RemoteCacheNoWaitFacade<K, V>(rcnwArray, rca, cacheMgr, cacheEventLogger, elementSerializer );
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -144,7 +144,7 @@ public class RemoteCacheFailoverRunner<K
* continue until the primary is re-connected. If no failovers are defined,
* this will exit automatically.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
private void connectAndRestore()
{
do
@@ -339,7 +339,7 @@ public class RemoteCacheFailoverRunner<K
*
* @return boolean value indicating whether the restoration was successful
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
private boolean restorePrimary()
{
// try to move back to the primary
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java Wed Nov 7 10:29:14 2012
@@ -395,7 +395,7 @@ public class RemoteCacheManager
synchronized ( caches )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all caches
RemoteCacheNoWait<K, V> remoteCacheNoWait2 = (RemoteCacheNoWait<K, V>) caches.get( cattr.getCacheName() );
remoteCacheNoWait = remoteCacheNoWait2;
if ( remoteCacheNoWait == null )
@@ -419,7 +419,7 @@ public class RemoteCacheManager
+ listener, e );
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast for specialized type
IRemoteCacheClient<K, V> remoteCacheClient = new RemoteCache<K, V>( cattr, (ICacheServiceNonLocal<K, V>) remoteService, listener );
remoteCacheClient.setCacheEventLogger( cacheEventLogger );
remoteCacheClient.setElementSerializer( elementSerializer );
@@ -526,21 +526,12 @@ public class RemoteCacheManager
this.remoteWatch.setCacheWatch( remoteWatch );
for (RemoteCacheNoWait<? extends Serializable, ? extends Serializable> c : caches.values())
{
- c.fixCache( this.remoteService );
+ c.fixCache( remoteService );
}
}
}
/**
- * Gets the cacheType attribute of the RemoteCacheManager object
- * @return The cacheType value
- */
- public int getCacheType()
- {
- return REMOTE_CACHE;
- }
-
- /**
* Location of the RMI registry.
*/
private final static class Location
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java Wed Nov 7 10:29:14 2012
@@ -41,7 +41,6 @@ import org.apache.jcs.engine.CacheEventQ
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.ICacheEventQueue;
import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
-import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.stats.StatElement;
import org.apache.jcs.engine.stats.Stats;
import org.apache.jcs.engine.stats.behavior.IStatElement;
@@ -360,9 +359,9 @@ public class RemoteCacheNoWait<K extends
* <p>
* @return The cacheType value
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
- return ICacheType.REMOTE_CACHE;
+ return CacheType.REMOTE_CACHE;
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java Wed Nov 7 10:29:14 2012
@@ -88,7 +88,7 @@ public class RemoteHttpCacheFactory
log.info( "noWait is null" );
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
RemoteCacheNoWait<K, V>[] rcnwArray = noWaits.toArray( new RemoteCacheNoWait[0] );
RemoteCacheNoWaitFacade<K, V> rcnwf =
new RemoteCacheNoWaitFacade<K, V>(rcnwArray, rca, cacheMgr, cacheEventLogger, elementSerializer );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java Wed Nov 7 10:29:14 2012
@@ -176,7 +176,7 @@ public class RemoteHttpCacheManager
synchronized ( caches )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all caches
RemoteCacheNoWait<K, V> remoteCacheNoWait2 = (RemoteCacheNoWait<K, V>) caches.get( cattr.getCacheName() + cattr.getUrl() );
remoteCacheNoWait = remoteCacheNoWait2;
if ( remoteCacheNoWait == null )
@@ -244,15 +244,6 @@ public class RemoteHttpCacheManager
}
/**
- * Gets the cacheType attribute of the RemoteCacheManager object
- * @return The cacheType value
- */
- public int getCacheType()
- {
- return REMOTE_CACHE;
- }
-
- /**
* Shutdown callback from composite cache manager.
* <p>
* @see org.apache.jcs.engine.behavior.IShutdownObserver#shutdown()
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServlet.java Wed Nov 7 10:29:14 2012
@@ -152,14 +152,14 @@ public class RemoteHttpCacheServlet
* @throws IOException
* @throws ClassNotFoundException
*/
- @SuppressWarnings("unchecked")
protected RemoteCacheRequest<Serializable, Serializable> readRequestFromStream( InputStream inputStream )
throws IOException, ClassNotFoundException
{
- RemoteCacheRequest<Serializable, Serializable> remoteRequest;
ObjectInputStream ois = new ObjectInputStream( inputStream );
- remoteRequest = (RemoteCacheRequest<Serializable, Serializable>) ois.readObject();
+ @SuppressWarnings("unchecked") // Need to cast from Object
+ RemoteCacheRequest<Serializable, Serializable> remoteRequest
+ = (RemoteCacheRequest<Serializable, Serializable>) ois.readObject();
ois.close();
return remoteRequest;
}
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -1223,7 +1223,7 @@ public class RemoteCacheServer<K extends
* @param requesterId
* @return The eventQList value
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
private ICacheEventQueue<K, V>[] getEventQList( CacheListeners<K, V> cacheListeners, long requesterId )
{
ICacheEventQueue<K, V>[] list = null;
@@ -1302,7 +1302,7 @@ public class RemoteCacheServer<K extends
* remote calls involved.
* @throws IOException
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast to specific return type from getClusterListeners()
public <KK extends Serializable, VV extends Serializable> void addCacheListener( String cacheName, ICacheListener<KK, VV> listener )
throws IOException
{
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -73,10 +73,11 @@ public class RemoteCacheServerFactory
* This will allow you to get stats from the server, etc. Perhaps we should provide methods on
* the factory to do this instead.
* <p>
- * A remote cache is either a local cache or a cluster cache. <p.
+ * A remote cache is either a local cache or a cluster cache.
+ * </p>
* @return Returns the remoteCacheServer.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need cast to specific RemoteCacheServer
public static <K extends Serializable, V extends Serializable> RemoteCacheServer<K, V> getRemoteCacheServer()
{
return (RemoteCacheServer<K, V>)remoteCacheServer;
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -325,7 +325,7 @@ public class CacheEventQueue<K extends S
Node node = head.next;
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generics for public fields
AbstractCacheEvent value = (AbstractCacheEvent) node.event;
if ( log.isDebugEnabled() )
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java Wed Nov 7 10:29:14 2012
@@ -211,13 +211,13 @@ public class ZombieCacheServiceNonLocal<
if ( event instanceof PutEvent )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Type checked by instanceof
PutEvent<K, V> putEvent = (PutEvent<K, V>) event;
service.update( putEvent.element, event.requesterId );
}
else if ( event instanceof RemoveEvent )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Type checked by instanceof
RemoveEvent<K, V> removeEvent = (RemoveEvent<K, V>) event;
service.remove( event.cacheName, removeEvent.key, event.requesterId );
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java Wed Nov 7 10:29:14 2012
@@ -19,32 +19,32 @@ package org.apache.jcs.engine.behavior;
* under the License.
*/
-import java.io.Serializable;
/**
* Interface implemented by a specific cache.
*
*/
public interface ICacheType
- extends Serializable
{
- /** Composite/ memory cache type, cetral hub. */
- public final static int CACHE_HUB = 1;
-
- /** Disk cache type. */
- public final static int DISK_CACHE = 2;
-
- /** Lateral cache type. */
- public final static int LATERAL_CACHE = 3;
-
- /** Remote cache type. */
- public final static int REMOTE_CACHE = 4;
+ public enum CacheType {
+ /** Composite/ memory cache type, central hub. */
+ CACHE_HUB,
+
+ /** Disk cache type. */
+ DISK_CACHE,
+
+ /** Lateral cache type. */
+ LATERAL_CACHE,
+
+ /** Remote cache type. */
+ REMOTE_CACHE
+ }
/**
* Returns the cache type.
* <p>
* @return The cacheType value
*/
- public int getCacheType();
+ public CacheType getCacheType();
}
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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -36,7 +36,6 @@ import org.apache.jcs.auxiliary.Auxiliar
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.behavior.ICache;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.control.event.ElementEvent;
@@ -276,7 +275,7 @@ public class CompositeCache<K extends Se
}
// SEND TO REMOTE STORE
- if ( aux.getCacheType() == ICache.REMOTE_CACHE )
+ if ( aux.getCacheType() == CacheType.REMOTE_CACHE )
{
if ( log.isDebugEnabled() )
{
@@ -303,7 +302,7 @@ public class CompositeCache<K extends Se
}
// SEND LATERALLY
}
- else if ( aux.getCacheType() == ICache.LATERAL_CACHE )
+ else if ( aux.getCacheType() == CacheType.LATERAL_CACHE )
{
// lateral can't do the checking since it is dependent on the
// cache region restrictions
@@ -324,7 +323,7 @@ public class CompositeCache<K extends Se
}
}
// update disk if the usage pattern permits
- else if ( aux.getCacheType() == ICache.DISK_CACHE )
+ else if ( aux.getCacheType() == CacheType.DISK_CACHE )
{
if ( log.isDebugEnabled() )
{
@@ -370,7 +369,7 @@ public class CompositeCache<K extends Se
{
ICache<K, V> aux = auxCaches[i];
- if ( aux != null && aux.getCacheType() == ICache.DISK_CACHE )
+ if ( aux != null && aux.getCacheType() == CacheType.DISK_CACHE )
{
diskAvailable = true;
@@ -511,9 +510,9 @@ public class CompositeCache<K extends Se
if ( aux != null )
{
- long cacheType = aux.getCacheType();
+ CacheType cacheType = aux.getCacheType();
- if ( !localOnly || cacheType == AuxiliaryCache.DISK_CACHE )
+ if ( !localOnly || cacheType == CacheType.DISK_CACHE )
{
if ( log.isDebugEnabled() )
{
@@ -744,9 +743,9 @@ public class CompositeCache<K extends Se
Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
new HashMap<K, ICacheElement<K, V>>();
- long cacheType = aux.getCacheType();
+ CacheType cacheType = aux.getCacheType();
- if ( !localOnly || cacheType == AuxiliaryCache.DISK_CACHE )
+ if ( !localOnly || cacheType == CacheType.DISK_CACHE )
{
if ( log.isDebugEnabled() )
{
@@ -898,9 +897,9 @@ public class CompositeCache<K extends Se
Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
new HashMap<K, ICacheElement<K, V>>();
- long cacheType = aux.getCacheType();
+ CacheType cacheType = aux.getCacheType();
- if ( !localOnly || cacheType == AuxiliaryCache.DISK_CACHE )
+ if ( !localOnly || cacheType == CacheType.DISK_CACHE )
{
if ( log.isDebugEnabled() )
{
@@ -1184,11 +1183,11 @@ public class CompositeCache<K extends Se
continue;
}
- int cacheType = aux.getCacheType();
+ CacheType cacheType = aux.getCacheType();
// for now let laterals call remote remove but not vice versa
- if ( localOnly && ( cacheType == REMOTE_CACHE || cacheType == LATERAL_CACHE ) )
+ if ( localOnly && ( cacheType == CacheType.REMOTE_CACHE || cacheType == CacheType.LATERAL_CACHE ) )
{
continue;
}
@@ -1202,7 +1201,7 @@ public class CompositeCache<K extends Se
boolean b = aux.remove( key );
// Don't take the remote removal into account.
- if ( !removed && cacheType != REMOTE_CACHE )
+ if ( !removed && cacheType != CacheType.REMOTE_CACHE )
{
removed = b;
}
@@ -1267,7 +1266,7 @@ public class CompositeCache<K extends Se
{
ICache<K, V> aux = auxCaches[i];
- if ( aux != null && ( aux.getCacheType() == ICache.DISK_CACHE || !localOnly ) )
+ if ( aux != null && ( aux.getCacheType() == CacheType.DISK_CACHE || !localOnly ) )
{
try
{
@@ -1336,7 +1335,7 @@ public class CompositeCache<K extends Se
// - The auxiliary is remote and the invocation was remote
if ( aux == null || aux.getStatus() != CacheConstants.STATUS_ALIVE
- || ( fromRemote && aux.getCacheType() == REMOTE_CACHE ) )
+ || ( fromRemote && aux.getCacheType() == CacheType.REMOTE_CACHE ) )
{
if ( log.isInfoEnabled() )
{
@@ -1359,7 +1358,7 @@ public class CompositeCache<K extends Se
// the disk cache
// is in a situation to not get items on a put.
- if ( aux.getCacheType() == ICacheType.DISK_CACHE )
+ if ( aux.getCacheType() == CacheType.DISK_CACHE )
{
int numToFree = memCache.getSize();
memCache.freeElements( numToFree );
@@ -1458,9 +1457,9 @@ public class CompositeCache<K extends Se
* <p>
* @return The cacheType value
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
- return CACHE_HUB;
+ return CacheType.CACHE_HUB;
}
/**
@@ -1601,9 +1600,9 @@ public class CompositeCache<K extends Se
}
/**
- * Create the MemoryCache based on the config parameters. TODO: consider making this an
- * auxiliary, despite its close tie to the CacheHub. TODO: might want to create a memory cache
- * config file separate from that of the hub -- ICompositeCacheAttributes
+ * Create the MemoryCache based on the config parameters.
+ * TODO: consider making this an auxiliary, despite its close tie to the CacheHub.
+ * TODO: might want to create a memory cache config file separate from that of the hub -- ICompositeCacheAttributes
* <p>
* @param cattr
*/
@@ -1614,7 +1613,7 @@ public class CompositeCache<K extends Se
try
{
Class<?> c = Class.forName( cattr.getMemoryCacheName() );
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need cast
IMemoryCache<K, V> newInstance = (IMemoryCache<K, V>) c.newInstance();
memCache = newInstance;
memCache.initialize( this );
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java Wed Nov 7 10:29:14 2012
@@ -377,7 +377,7 @@ public class CompositeCacheConfigurator
}
// Associate the auxiliaries with the cache
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
AuxiliaryCache<K, V>[] auxArray = auxList.toArray( new AuxiliaryCache[0] );
cache.setAuxCaches( auxArray );
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java Wed Nov 7 10:29:14 2012
@@ -40,7 +40,7 @@ import org.apache.jcs.engine.CacheConsta
import org.apache.jcs.engine.CompositeCacheAttributes;
import org.apache.jcs.engine.ElementAttributes;
import org.apache.jcs.engine.behavior.ICache;
-import org.apache.jcs.engine.behavior.ICacheType;
+import org.apache.jcs.engine.behavior.ICacheType.CacheType;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.jcs.engine.behavior.IElementAttributes;
@@ -511,7 +511,7 @@ public class CompositeCacheManager
* @param attr
* @return CompositeCache
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast because of common map for all caches
public <K extends Serializable, V extends Serializable> CompositeCache<K, V> getCache( ICompositeCacheAttributes cattr, IElementAttributes attr )
{
CompositeCache<K, V> cache;
@@ -655,9 +655,9 @@ public class CompositeCacheManager
/**
* @return ICacheType.CACHE_HUB
*/
- public int getCacheType()
+ public CacheType getCacheType()
{
- return ICacheType.CACHE_HUB;
+ return CacheType.CACHE_HUB;
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java Wed Nov 7 10:29:14 2012
@@ -419,7 +419,7 @@ public abstract class AbstractDoubleLink
/**
* Dump the cache entries from first to list for debugging.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generics for public fields
public void dumpCacheEntries()
{
log.debug( "dumpingCacheEntries" );
@@ -443,7 +443,7 @@ public abstract class AbstractDoubleLink
* Checks to see if all the items that should be in the cache are. Checks consistency between
* List and map.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generics for public fields
protected void verifyCache()
{
if ( !log.isDebugEnabled() )
@@ -526,7 +526,7 @@ public abstract class AbstractDoubleLink
* <p>
* @param key
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generics for public fields
private void verifyCache( K key )
{
if ( !log.isDebugEnabled() )
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java Wed Nov 7 10:29:14 2012
@@ -255,7 +255,7 @@ public class JCSWorker<K extends Seriali
// If the cache dosn't have it, do the work.
if ( result == null )
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // Need to cast from Object
V doWork = (V)aHelper.doWork();
result = doWork;
if ( logger.isDebugEnabled() )
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java Wed Nov 7 10:29:14 2012
@@ -326,7 +326,7 @@ public class OptionConverter
try
{
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // CCE catched
T t = (T) o;
return 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=1406523&r1=1406522&r2=1406523&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 Wed Nov 7 10:29:14 2012
@@ -63,7 +63,7 @@ public class PropertySetter
protected PropertyDescriptor[] props;
/**
- * Create a new PropertySetter for the specified Object. This is done in prepartion for invoking
+ * Create a new PropertySetter for the specified Object. This is done in preparation for invoking
* {@link #setProperty}one or more times.
* @param obj the object for which to set properties
*/
@@ -73,7 +73,7 @@ public class PropertySetter
}
/**
- * Uses JavaBeans {@link Introspector}to computer setters of object to be configured.
+ * Uses JavaBeans {@link Introspector}to compute setters of object to be configured.
*/
protected void introspect()
{
@@ -116,7 +116,7 @@ public class PropertySetter
{
String key = (String) e.nextElement();
- // handle only properties that start with the desired frefix.
+ // handle only properties that start with the desired prefix.
if ( key.startsWith( prefix ) )
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/CompressingSerializer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/CompressingSerializer.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/CompressingSerializer.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/CompressingSerializer.java Wed Nov 7 10:29:14 2012
@@ -112,20 +112,9 @@ public class CompressingSerializer
try
{
- try
- {
- @SuppressWarnings("unchecked")
- T readObject = (T) ois.readObject();
- return readObject;
- }
- catch ( IOException e )
- {
- throw e;
- }
- catch ( ClassNotFoundException e )
- {
- throw e;
- }
+ @SuppressWarnings("unchecked") // Need to cast from Object
+ T readObject = (T) ois.readObject();
+ return readObject;
}
finally
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java Wed Nov 7 10:29:14 2012
@@ -77,20 +77,9 @@ public class StandardSerializer
ObjectInputStream ois = new ObjectInputStream( bis );
try
{
- try
- {
- @SuppressWarnings("unchecked")
- T readObject = (T) ois.readObject();
- return readObject;
- }
- catch ( IOException e )
- {
- throw e;
- }
- catch ( ClassNotFoundException e )
- {
- throw e;
- }
+ @SuppressWarnings("unchecked") // Need to cast from Object
+ T readObject = (T) ois.readObject();
+ return readObject;
}
finally
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java Wed Nov 7 10:29:14 2012
@@ -26,7 +26,7 @@ import org.apache.commons.logging.LogFac
* This is a generic thread safe double linked list. It's very simple and all the operations are so
* quick that course grained synchronization is more than acceptable.
*/
-@SuppressWarnings({ "unchecked", "rawtypes" })
+@SuppressWarnings({ "unchecked", "rawtypes" }) // Don't know how to resolve this with generics
public class DoubleLinkedList<T extends DoubleLinkedListNode>
{
/** record size to avoid having to iterate */
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java Wed Nov 7 10:29:14 2012
@@ -400,7 +400,7 @@ public class LRUMap<K, V>
/**
* Dump the cache entries from first to list for debugging.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generics for public fields
public void dumpCacheEntries()
{
log.debug( "dumpingCacheEntries" );
@@ -433,7 +433,7 @@ public class LRUMap<K, V>
* Checks to see if all the items that should be in the cache are. Checks consistency between
* List and map.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generics for public fields
protected void verifyCache()
{
if ( !log.isDebugEnabled() )
@@ -525,7 +525,7 @@ public class LRUMap<K, V>
* <p>
* @param key
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generics for public fields
protected void verifyCache( Object key )
{
if ( !log.isDebugEnabled() )
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java Wed Nov 7 10:29:14 2012
@@ -58,7 +58,7 @@ public class SortedPreferentialArray<T e
public SortedPreferentialArray( int maxSize )
{
this.maxSize = maxSize;
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked") // No generic arrays in java
T[] ts = (T[]) new Comparable<?>[maxSize];
array = ts;
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java?rev=1406523&r1=1406522&r2=1406523&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java Wed Nov 7 10:29:14 2012
@@ -19,7 +19,6 @@ package org.apache.jcs.utils.threadpool;
* under the License.
*/
-import org.apache.jcs.utils.threadpool.behavior.IPoolConfiguration;
/**
* This object holds configuration data for a thread pool.
@@ -27,7 +26,7 @@ import org.apache.jcs.utils.threadpool.b
* @author Aaron Smuts
*/
public class PoolConfiguration
- implements Cloneable, IPoolConfiguration
+ implements Cloneable
{
/** Should we bound the queue */
private boolean useBoundary = true;
@@ -47,8 +46,25 @@ public class PoolConfiguration
/** How long idle threads above the minimum should be kept alive. */
private int keepAliveTime = 1000 * 60 * 5;
+ public enum WhenBlockedPolicy {
+ /** abort when queue is full and max threads is reached. */
+ ABORT,
+
+ /** block when queue is full and max threads is reached. */
+ BLOCK,
+
+ /** run in current thread when queue is full and max threads is reached. */
+ RUN,
+
+ /** wait when queue is full and max threads is reached. */
+ WAIT,
+
+ /** discard oldest when queue is full and max threads is reached. */
+ DISCARDOLDEST
+ }
+
/** should be ABORT, BLOCK, RUN, WAIT, DISCARDOLDEST, */
- private String whenBlockedPolicy = POLICY_RUN;
+ private WhenBlockedPolicy whenBlockedPolicy = WhenBlockedPolicy.RUN;
/** The number of threads to create on startup */
private int startUpSize = 4;
@@ -89,7 +105,7 @@ public class PoolConfiguration
* @param startUpSize
*/
public PoolConfiguration( boolean useBoundary, int boundarySize, int maximumPoolSize, int minimumPoolSize,
- int keepAliveTime, String whenBlockedPolicy, int startUpSize )
+ int keepAliveTime, WhenBlockedPolicy whenBlockedPolicy, int startUpSize )
{
setUseBoundary( useBoundary );
setBoundarySize( boundarySize );
@@ -171,45 +187,36 @@ public class PoolConfiguration
{
if ( whenBlockedPolicy != null )
{
- whenBlockedPolicy = whenBlockedPolicy.trim();
+ WhenBlockedPolicy policy = WhenBlockedPolicy.valueOf(whenBlockedPolicy.trim().toUpperCase());
+ setWhenBlockedPolicy(policy);
+ }
+ else
+ {
+ // the value is null, default to RUN
+ this.whenBlockedPolicy = WhenBlockedPolicy.RUN;
+ }
+ }
- if ( whenBlockedPolicy.equalsIgnoreCase( POLICY_ABORT ) )
- {
- this.whenBlockedPolicy = POLICY_ABORT;
- }
- else if ( whenBlockedPolicy.equalsIgnoreCase( POLICY_RUN ) )
- {
- this.whenBlockedPolicy = POLICY_RUN;
- }
- else if ( whenBlockedPolicy.equalsIgnoreCase( POLICY_BLOCK ) )
- {
- this.whenBlockedPolicy = POLICY_BLOCK;
- }
- else if ( whenBlockedPolicy.equalsIgnoreCase( POLICY_DISCARDOLDEST ) )
- {
- this.whenBlockedPolicy = POLICY_DISCARDOLDEST;
- }
- else if ( whenBlockedPolicy.equalsIgnoreCase( POLICY_WAIT ) )
- {
- this.whenBlockedPolicy = POLICY_WAIT;
- }
- else
- {
- // the value is invalid, default to RUN
- this.whenBlockedPolicy = POLICY_RUN;
- }
+ /**
+ * @param whenBlockedPolicy The whenBlockedPolicy to set.
+ */
+ public void setWhenBlockedPolicy( WhenBlockedPolicy whenBlockedPolicy )
+ {
+ if ( whenBlockedPolicy != null )
+ {
+ this.whenBlockedPolicy = whenBlockedPolicy;
}
else
{
// the value is null, default to RUN
- this.whenBlockedPolicy = POLICY_RUN;
+ this.whenBlockedPolicy = WhenBlockedPolicy.RUN;
}
}
/**
* @return Returns the whenBlockedPolicy.
*/
- public String getWhenBlockedPolicy()
+ public WhenBlockedPolicy getWhenBlockedPolicy()
{
return whenBlockedPolicy;
}