commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1369329 [1/3] - in /commons/proper/jcs/trunk/src/java/org/apache/jcs: access/ admin/ auxiliary/ auxiliary/disk/ auxiliary/disk/block/ auxiliary/disk/file/ auxiliary/disk/indexed/ auxiliary/disk/jdbc/ auxiliary/disk/jdbc/hsql/ auxilia
Date Sun, 05 Aug 2012 22:10:32 GMT
On 4 August 2012 15:19,  <tv@apache.org> wrote:
> Author: tv
> Date: Sat Aug  4 14:19:08 2012
> New Revision: 1369329
>
> URL: http://svn.apache.org/viewvc?rev=1369329&view=rev
> Log:
> - Fixed lots of warnings and FindBugs issues
> - Fixed typos in class names
> - Removed some obsolete classes
> - Introduced carefully crafted @SuppressWarnings annotations

Please add comments as to why it is safe to ignore the warnings.

> Added:
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java
>       - copied, changed from r1344803, commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoulbeLinkedListMemoryCache.java
> Removed:
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractDoulbeLinkedListMemoryCache.java
> Modified:
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/access/PartitionedCacheAccess.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.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/FileDiskCache.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/indexed/IndexedDiskElementDescriptor.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/disk/jdbc/hsql/HSQLDiskCacheFactory.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.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/disk/jdbc/mysql/MySQLTableOptimizer.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/LateralCacheMonitor.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/LateralCacheWatchRepairable.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.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/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/RemoteCacheMonitor.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/RemoteCacheNoWaitFacade.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheRestore.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheWatchRepairable.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheWatch.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheConstants.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCache.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.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/client/RemoteHttpCacheMonitor.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.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/CacheEventQueueFactory.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.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/event/ElementEventQueue.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/fifo/FIFOMemoryCache.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/memory/mru/MRUMemoryCache.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/discovery/UDPDiscoverySenderThread.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryService.java
>     commons/proper/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.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/ThreadPoolManager.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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -234,6 +234,7 @@ public class PartitionedCacheAccess<K ex
>              return Collections.emptyMap();
>          }
>
> +        @SuppressWarnings("unchecked")
>          Set<K>[] dividedNames = new Set[this.getNumberOfPartitions()];
>
>          for (K key : names)
> @@ -591,6 +592,7 @@ public class PartitionedCacheAccess<K ex
>      {
>          ensureProperties();
>
> +        @SuppressWarnings("unchecked")
>          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/admin/JCSAdminBean.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java Sat Aug  4 14:19:08 2012
> @@ -168,7 +168,7 @@ public class JCSAdminBean
>       *
>       * @return int The size of the region in bytes.
>       */
> -    public <K extends Serializable, V extends Serializable> int getByteCount(CompositeCache<K, V> cache) throws Exception
> +    public <K extends Serializable, V extends Serializable> int getByteCount(CompositeCache<K, V> cache)
>      {
>          if (cache == null)
>          {
> @@ -176,50 +176,42 @@ public class JCSAdminBean
>          }
>
>          long size = 0;
> -        try
> +        IMemoryCache<K, V> memCache = cache.getMemoryCache();
> +
> +        Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> iter = memCache.getIterator();
> +        while (iter.hasNext())
>          {
> -            IMemoryCache<K, V> memCache = cache.getMemoryCache();
> +            MemoryElementDescriptor<K, V> me = iter.next().getValue();
> +            ICacheElement<K, V> ice = me.ce;
>
> -            Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> iter = memCache.getIterator();
> -            while (iter.hasNext())
> +            if (ice instanceof CacheElementSerialized)
> +            {
> +                size = size + ((CacheElementSerialized<K, V>) ice).getSerializedValue().length;
> +            }
> +            else
>              {
> -                MemoryElementDescriptor<K, V> me = iter.next().getValue();
> -                ICacheElement<K, V> ice = me.ce;
> +                Serializable element = ice.getVal();
>
> -                if (ice instanceof CacheElementSerialized)
> +                //CountingOnlyOutputStream: Keeps track of the number of bytes written to it, but doesn't write them anywhere.
> +                CountingOnlyOutputStream counter = new CountingOnlyOutputStream();
> +                try
>                  {
> -                    size = size + ((CacheElementSerialized<K, V>) ice).getSerializedValue().length;
> +                    ObjectOutputStream out = new ObjectOutputStream(counter);
> +                    out.writeObject(element);
>                  }
> -                else
> +                catch (IOException e)
>                  {
> -                    Serializable element = ice.getVal();
> -
> -                    //CountingOnlyOutputStream: Keeps track of the number of bytes written to it, but doesn't write them anywhere.
> -                    CountingOnlyOutputStream counter = new CountingOnlyOutputStream();
> -                    try
> -                    {
> -                        ObjectOutputStream out = new ObjectOutputStream(counter);
> -                        out.writeObject(element);
> -                    }
> -                    catch (IOException e)
> -                    {
> -                        throw new RuntimeException("IOException while trying to measure the size of the cached element", e);
> -                    }
> -
> -                    // 4 bytes lost for the serialization header
> -                    size = size + counter.getCount() - 4;
> +                    throw new RuntimeException("IOException while trying to measure the size of the cached element", e);
>                  }
> -            }
>
> -            if (size > Integer.MAX_VALUE)
> -            {
> -                throw new IllegalStateException("The size of cache " + cache.getCacheName() + " (" + size + " bytes) is too large to be represented as an integer.");
> +                // 4 bytes lost for the serialization header
> +                size = size + counter.getCount() - 4;
>              }
>          }
> -        catch (Exception e)
> +
> +        if (size > Integer.MAX_VALUE)
>          {
> -            // throw new RuntimeException("Failed to calculate the size of cache region [" + cache.getCacheName() + "]:" + e, e);
> -            return 0;
> +            throw new IllegalStateException("The size of cache " + cache.getCacheName() + " (" + size + " bytes) is too large to be represented as an integer.");
>          }
>
>          return (int) size;
> @@ -339,7 +331,7 @@ public class JCSAdminBean
>              // Remove objects via the RemoteCacheServer API, so that removes will be broadcast to client machines...
>              try
>              {
> -                Object keyToRemove = null;
> +                Serializable keyToRemove = null;
>                  CompositeCache<? extends Serializable, ? extends Serializable> cache = CompositeCacheManager.getInstance().getCache(cacheName);
>
>                  // A String key was supplied, but to remove elements via the RemoteCacheServer API, we need the
> @@ -366,14 +358,10 @@ public class JCSAdminBean
>                  {
>                      throw new IllegalStateException("No match for this key could be found in the set of keys retrieved from the memory cache.");
>                  }
> -                if (!(keyToRemove instanceof Serializable))
> -                {
> -                    throw new IllegalStateException("Found key [" + keyToRemove + ", " + keyToRemove.getClass() + "] in cache matching key specified, however key found in cache is unexpectedly not serializable.");
> -                }
>                  // At this point, we have retrieved the matching K key.
>
>                  // Call remoteCacheServer.remove(String, Serializable)...
> -                RemoteCacheServer remoteCacheServer = RemoteCacheServerFactory.getRemoteCacheServer();
> +                RemoteCacheServer<Serializable, Serializable> remoteCacheServer = RemoteCacheServerFactory.getRemoteCacheServer();
>                  remoteCacheServer.remove(cacheName, key);
>              }
>              catch (Exception e)
>
> Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java Sat Aug  4 14:19:08 2012
> @@ -49,9 +49,7 @@ public class AuxiliaryCacheConfigurator
>
>          // auxFactory was not previously initialized.
>          String eventLoggerClassName = auxPrefix + CACHE_EVENT_LOGGER_PREFIX;
> -        cacheEventLogger = (ICacheEventLogger) OptionConverter
> -            .instantiateByKey( props, eventLoggerClassName,
> -                               org.apache.jcs.engine.logging.behavior.ICacheEventLogger.class, null );
> +        cacheEventLogger = OptionConverter.instantiateByKey( props, eventLoggerClassName, null );
>          if ( cacheEventLogger != null )
>          {
>              String cacheEventLoggerAttributePrefix = auxPrefix + CACHE_EVENT_LOGGER_PREFIX + ATTRIBUTE_PREFIX;
> @@ -82,14 +80,11 @@ public class AuxiliaryCacheConfigurator
>      public static IElementSerializer parseElementSerializer( Properties props, String auxPrefix )
>      {
>          // TODO take in the entire prop key
> -
>          IElementSerializer elementSerializer = null;
>
>          // auxFactory was not previously initialized.
>          String elementSerializerClassName = auxPrefix + SERIALIZER_PREFIX;
> -        elementSerializer = (IElementSerializer) OptionConverter
> -            .instantiateByKey( props, elementSerializerClassName,
> -                               org.apache.jcs.engine.behavior.IElementSerializer.class, null );
> +        elementSerializer = OptionConverter.instantiateByKey( props, elementSerializerClassName, null );
>          if ( elementSerializer != null )
>          {
>              String attributePrefix = auxPrefix + SERIALIZER_PREFIX + ATTRIBUTE_PREFIX;
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -146,21 +146,7 @@ public abstract class AbstractDiskCache<
>
>          try
>          {
> -            if ( purgatory != null )
> -            {
> -                synchronized ( purgatory )
> -                {
> -                    if ( diskCacheAttributes.getMaxPurgatorySize() >= 0 )
> -                    {
> -                        purgatory = new LRUMapJCS<K, PurgatoryElement<K, V>>( diskCacheAttributes.getMaxPurgatorySize() );
> -                    }
> -                    else
> -                    {
> -                        purgatory = new HashMap<K, PurgatoryElement<K, V>>();
> -                    }
> -                }
> -            }
> -            else
> +            synchronized (this)
>              {
>                  if ( diskCacheAttributes.getMaxPurgatorySize() >= 0 )
>                  {
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -54,7 +54,7 @@ public class BlockDisk
>      private static final int DEFAULT_BLOCK_SIZE_BYTES = 4 * 1024;
>
>      /** Size of the blocks */
> -    private int blockSizeBytes = DEFAULT_BLOCK_SIZE_BYTES;
> +    private int blockSizeBytes;
>
>      /**
>       * the total number of blocks that have been used. If there are no free, we will use this to
> @@ -65,8 +65,8 @@ public class BlockDisk
>      /** Empty blocks that can be reused. */
>      private final SingleLinkedList<Integer> emptyBlocks = new SingleLinkedList<Integer>();
>
> -    /** The serializer. Uses a standard serializer by default. */
> -    protected IElementSerializer elementSerializer = new StandardSerializer();
> +    /** The serializer. */
> +    protected IElementSerializer elementSerializer;
>
>      /** Location of the spot on disk */
>      private final String filepath;
> @@ -125,6 +125,7 @@ public class BlockDisk
>          {
>              log.info( "Constructing BlockDisk, blockSizeBytes [" + blockSizeBytes + "]" );
>          }
> +
>          this.blockSizeBytes = blockSizeBytes;
>          this.elementSerializer = elementSerializer;
>      }
> @@ -249,6 +250,7 @@ public class BlockDisk
>          buffer.put(data);
>          buffer.flip();
>          int written = fc.write(buffer, position);
> +        fc.force(true);
>
>          return written == data.length;
>      }
> @@ -312,12 +314,12 @@ public class BlockDisk
>          long fileLength = fc.size();
>
>          int position = calculateByteOffsetForBlock( block );
> -        if ( position > fileLength )
> -        {
> -            corrupted = true;
> -            message = "Record " + position + " starts past EOF.";
> -        }
> -        else
> +//        if ( position > fileLength )
> +//        {
> +//            corrupted = true;
> +//            message = "Record " + position + " starts past EOF.";
> +//        }
> +//        else
>          {
>              ByteBuffer datalength = ByteBuffer.allocate(HEADER_SIZE_BYTES);
>              fc.read(datalength, position);
> @@ -425,7 +427,7 @@ public class BlockDisk
>       * <p>
>       * @exception IOException
>       */
> -    protected void reset()
> +    protected synchronized void reset()
>          throws IOException
>      {
>          this.numberOfBlocks.set(0);
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -82,7 +82,7 @@ public class BlockDiskCache<K extends Se
>       * Use this lock to synchronize reads and writes to the underlying storage mechanism. We don't
>       * need a reentrant lock, since we only lock one level.
>       */
> -    private final ReentrantReadWriteLock storageLock = new ReentrantReadWriteLock(true);
> +    private final ReentrantReadWriteLock storageLock = new ReentrantReadWriteLock();
>
>      /**
>       * Constructs the BlockDisk after setting up the root directory.
> @@ -208,6 +208,7 @@ 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 )
>      {
> @@ -295,6 +296,7 @@ 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 )
>      {
> @@ -627,12 +629,12 @@ public class BlockDiskCache<K extends Se
>          {
>              storageLock.writeLock().lock();
>
> +            this.keyStore.reset();
> +
>              if ( dataFile != null )
>              {
>                  dataFile.reset();
>              }
> -
> -            this.keyStore.reset();
>          }
>          catch ( IOException e )
>          {
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -24,7 +24,6 @@ import java.util.Hashtable;
>
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> -import org.apache.jcs.auxiliary.AuxiliaryCache;
>  import org.apache.jcs.auxiliary.disk.AbstractDiskCacheManager;
>  import org.apache.jcs.engine.behavior.IElementSerializer;
>  import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
> @@ -45,7 +44,8 @@ public class BlockDiskCacheManager
>      private static BlockDiskCacheManager instance;
>
>      /** block disks for a region. */
> -    private final Hashtable<String, AuxiliaryCache<?, ?>> caches = new Hashtable<String, AuxiliaryCache<?, ?>>();
> +    private final Hashtable<String, BlockDiskCache<? extends Serializable, ? extends Serializable>> caches =
> +        new Hashtable<String, BlockDiskCache<? extends Serializable, ? extends Serializable>>();
>
>      /** Attributes. */
>      private final BlockDiskCacheAttributes defaultCacheAttributes;
> @@ -94,7 +94,7 @@ public class BlockDiskCacheManager
>       * @param cacheName Name that will be used when creating attributes.
>       * @return A cache.
>       */
> -    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( String cacheName )
> +    public <K extends Serializable, V extends Serializable> BlockDiskCache<K, V> getCache( String cacheName )
>      {
>          BlockDiskCacheAttributes cacheAttributes = (BlockDiskCacheAttributes) defaultCacheAttributes.copy();
>
> @@ -110,9 +110,9 @@ public class BlockDiskCacheManager
>       * @param cacheAttributes Attributes the cache should have.
>       * @return A cache, either from the existing set or newly created.
>       */
> -    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( BlockDiskCacheAttributes cacheAttributes )
> +    public <K extends Serializable, V extends Serializable> BlockDiskCache<K, V> getCache( BlockDiskCacheAttributes cacheAttributes )
>      {
> -        AuxiliaryCache<K, V> cache = null;
> +        BlockDiskCache<K, V> cache = null;
>
>          String cacheName = cacheAttributes.getCacheName();
>
> @@ -123,7 +123,9 @@ public class BlockDiskCacheManager
>              // Try to load the cache from the set that have already been
>              // created. This only looks at the name attribute.
>
> -            cache = (AuxiliaryCache<K, V>) caches.get( cacheName );
> +            @SuppressWarnings("unchecked")
> +            BlockDiskCache<K, V> blockDiskCache = (BlockDiskCache<K, V>) caches.get( cacheName );
> +            cache = blockDiskCache;
>
>              // If it was not found, create a new one using the supplied
>              // attributes
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -107,6 +107,7 @@ public class BlockDiskElementDescriptor<
>       * (non-Javadoc)
>       * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
>       */
> +    @SuppressWarnings("unchecked")
>      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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -76,7 +76,7 @@ public class BlockDiskKeyStore<K extends
>      /**
>       * The background key persister, one for all regions.
>       */
> -    private static ScheduledExecutorService persistenceDaemon;
> +    private static volatile ScheduledExecutorService persistenceDaemon;
>
>      /**
>       * Set the configuration options.
> @@ -135,7 +135,7 @@ public class BlockDiskKeyStore<K extends
>                                                  saveKeys();
>                                              }
>                                          },
> -                        0,
> +                        this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds(),
>                          this.blockDiskCacheAttributes.getKeyPersistenceIntervalSeconds(),
>                          TimeUnit.SECONDS);
>          }
> @@ -267,6 +267,7 @@ public class BlockDiskKeyStore<K extends
>                  {
>                      while ( true )
>                      {
> +                        @SuppressWarnings("unchecked")
>                          BlockDiskElementDescriptor<K> descriptor = (BlockDiskElementDescriptor<K>) ois.readObject();
>                          if ( descriptor != null )
>                          {
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -183,7 +183,7 @@ public class FileDiskCache<K extends Ser
>      protected synchronized void processDispose()
>          throws IOException
>      {
> -        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, (K)"none", ICacheEventLogger.DISPOSE_EVENT );
> +        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, "none", ICacheEventLogger.DISPOSE_EVENT );
>          try
>          {
>              if ( !alive )
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -5,7 +5,6 @@ import java.util.Hashtable;
>
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> -import org.apache.jcs.auxiliary.AuxiliaryCache;
>  import org.apache.jcs.auxiliary.disk.AbstractDiskCacheManager;
>  import org.apache.jcs.engine.behavior.IElementSerializer;
>  import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
> @@ -23,8 +22,8 @@ public class FileDiskCacheManager
>      private final static Log log = LogFactory.getLog( FileDiskCacheManager.class );
>
>      /** Each region has an entry here. */
> -    private final Hashtable<String, AuxiliaryCache<? extends Serializable, ? extends Serializable>> caches =
> -        new Hashtable<String, AuxiliaryCache<? extends Serializable, ? extends Serializable>>();
> +    private final Hashtable<String, FileDiskCache<? extends Serializable, ? extends Serializable>> caches =
> +        new Hashtable<String, FileDiskCache<? extends Serializable, ? extends Serializable>>();
>
>      /** User configurable attributes */
>      private final FileDiskCacheAttributes defaultCacheAttributes;
> @@ -79,7 +78,9 @@ public class FileDiskCacheManager
>              // Try to load the cache from the set that have already been
>              // created. This only looks at the name attribute.
>
> -            cache = (FileDiskCache<K, V>) caches.get( cacheName );
> +            @SuppressWarnings("unchecked")
> +            FileDiskCache<K, V> fileDiskCache = (FileDiskCache<K, V>) caches.get( cacheName );
> +            cache = fileDiskCache;
>
>              // If it was not found, create a new one using the supplied
>              // attributes
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -193,6 +193,7 @@ class IndexedDisk
>          buffer.put(data);
>          buffer.flip();
>          int written = fc.write(buffer, pos);
> +        fc.force(true);
>
>          return written == data.length;
>      }
> @@ -264,7 +265,7 @@ class IndexedDisk
>      {
>          if ( log.isInfoEnabled() )
>          {
> -            log.info( "Trucating file [" + filepath + "] to " + length );
> +            log.info( "Truncating file [" + filepath + "] to " + length );
>          }
>          fc.truncate( length );
>      }
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -34,6 +34,7 @@ import java.util.LinkedList;
>  import java.util.List;
>  import java.util.Map;
>  import java.util.Set;
> +import java.util.concurrent.atomic.AtomicInteger;
>  import java.util.concurrent.locks.ReentrantReadWriteLock;
>
>  import org.apache.commons.logging.Log;
> @@ -134,10 +135,10 @@ public class IndexedDiskCache<K extends
>      private long bytesFree = 0;
>
>      /** simple stat */
> -    private int hitCount = 0;
> +    private AtomicInteger hitCount = new AtomicInteger(0);
>
>      /**
> -     * Use this lock to synchronize reads and writes to the underlying storage mechansism.
> +     * Use this lock to synchronize reads and writes to the underlying storage mechanism.
>       */
>      protected ReentrantReadWriteLock storageLock = new ReentrantReadWriteLock();
>
> @@ -299,7 +300,10 @@ public class IndexedDiskCache<K extends
>              }
>              else
>              {
> -                startupSize = keyHash.size();
> +                synchronized (this)
> +                {
> +                    startupSize = keyHash.size();
> +                }
>              }
>          }
>      }
> @@ -325,6 +329,7 @@ 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()
>                  - IndexedDisk.HEADER_SIZE_BYTES ) );
> @@ -635,7 +640,7 @@ public class IndexedDiskCache<K extends
>
>              if ( object != null )
>              {
> -                incrementHitCount();
> +                hitCount.incrementAndGet();
>              }
>          }
>          catch ( IOException ioe )
> @@ -714,7 +719,9 @@ public class IndexedDiskCache<K extends
>              }
>              try
>              {
> -                object = (ICacheElement<K, V>) dataFile.readObject( ded );
> +                @SuppressWarnings("unchecked")
> +                ICacheElement<K, V> readObject = (ICacheElement<K, V>) dataFile.readObject( ded );
> +                object = readObject;
>                  // TODO consider checking key equality and throwing if there is a failure
>              }
>              catch ( IOException e )
> @@ -750,7 +757,9 @@ public class IndexedDiskCache<K extends
>              {
>                  if ( k instanceof GroupAttrName && ( (GroupAttrName<?>) k ).groupId.equals( groupId ) )
>                  {
> -                    keys.add( ( (GroupAttrName<K>) k ).attrName );
> +                    @SuppressWarnings("unchecked")
> +                    GroupAttrName<K> groupAttrName = (GroupAttrName<K>) k;
> +                    keys.add( groupAttrName.attrName );
>                  }
>              }
>          }
> @@ -996,7 +1005,7 @@ public class IndexedDiskCache<K extends
>      }
>
>      /**
> -     * If the maxKeySize is < 0, use 5000, no way to have an unlimted recycle bin right now, or one
> +     * If the maxKeySize is < 0, use 5000, no way to have an unlimited recycle bin right now, or one
>       * less than the mazKeySize.
>       */
>      private void initializeRecycleBin()
> @@ -1259,39 +1268,42 @@ public class IndexedDiskCache<K extends
>          long expectedNextPos = defragFile( defragList, 0 );
>
>          // ADD THE QUEUED ITEMS to the end and then truncate
> +        storageLock.writeLock().lock();
> +
>          try
>          {
> -            storageLock.writeLock().lock();
> -
> -            if ( !queuedPutList.isEmpty() )
> +            try
>              {
> -                // This is perhaps unnecessary, but the list might not be as sorted as we think.
> -                defragList = new IndexedDiskElementDescriptor[queuedPutList.size()];
> -                queuedPutList.toArray( defragList );
> -                Arrays.sort( defragList, new PositionComparator() );
> +                if ( !queuedPutList.isEmpty() )
> +                {
> +                    // This is perhaps unnecessary, but the list might not be as sorted as we think.
> +                    defragList = new IndexedDiskElementDescriptor[queuedPutList.size()];
> +                    queuedPutList.toArray( defragList );
> +                    Arrays.sort( defragList, new PositionComparator() );
>
> -                // pack them at the end
> -                expectedNextPos = defragFile( defragList, expectedNextPos );
> +                    // pack them at the end
> +                    expectedNextPos = defragFile( defragList, expectedNextPos );
> +                }
> +                // TRUNCATE THE FILE
> +                dataFile.truncate( expectedNextPos );
>              }
> -            // TRUNCATE THE FILE
> -            dataFile.truncate( expectedNextPos );
> -        }
> -        catch ( Exception e )
> -        {
> -            log.error( logCacheName + "Error optimizing queued puts.", e );
> -        }
> -        finally
> -        {
> +            catch ( Exception e )
> +            {
> +                log.error( logCacheName + "Error optimizing queued puts.", e );
> +            }
> +
>              // RESTORE NORMAL OPERATION
>              removeCount = 0;
> -            bytesFree = 0;
> +            resetBytesFree();
>              initializeRecycleBin();
>              queuedPutList.clear();
>              queueInput = false;
>              // turn recycle back on.
>              doRecycle = true;
>              isOptimizing = false;
> -
> +        }
> +        finally
> +        {
>              storageLock.writeLock().unlock();
>          }
>
> @@ -1427,6 +1439,14 @@ public class IndexedDiskCache<K extends
>      }
>
>      /**
> +     * Resets the number of bytes that are free.
> +     */
> +    private synchronized void resetBytesFree()
> +    {
> +        this.bytesFree = 0;
> +    }
> +
> +    /**
>       * To subtract you can pass in false for add..
>       * <p>
>       * @param ded
> @@ -1516,14 +1536,6 @@ public class IndexedDiskCache<K extends
>      }
>
>      /**
> -     * Increments the hit count in a thread safe manner.
> -     */
> -    private synchronized void incrementHitCount()
> -    {
> -        hitCount++;
> -    }
> -
> -    /**
>       * Gets basic stats for the disk cache.
>       * <p>
>       * @return String
> @@ -1588,7 +1600,7 @@ public class IndexedDiskCache<K extends
>
>          se = new StatElement();
>          se.setName( "Hit Count" );
> -        se.setData( "" + this.hitCount );
> +        se.setData( "" + this.hitCount.get() );
>          elems.add( se );
>
>          se = new StatElement();
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -24,7 +24,6 @@ import java.util.Hashtable;
>
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> -import org.apache.jcs.auxiliary.AuxiliaryCache;
>  import org.apache.jcs.auxiliary.disk.AbstractDiskCacheManager;
>  import org.apache.jcs.engine.behavior.IElementSerializer;
>  import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
> @@ -45,8 +44,8 @@ public class IndexedDiskCacheManager
>      private static IndexedDiskCacheManager instance;
>
>      /** Each region has an entry here. */
> -    private final Hashtable<String, AuxiliaryCache<? extends Serializable, ? extends Serializable>> caches =
> -        new Hashtable<String, AuxiliaryCache<? extends Serializable, ? extends Serializable>>();
> +    private final Hashtable<String, IndexedDiskCache<? extends Serializable, ? extends Serializable>> caches =
> +        new Hashtable<String, IndexedDiskCache<? extends Serializable, ? extends Serializable>>();
>
>      /** User configurable attributes */
>      private final IndexedDiskCacheAttributes defaultCacheAttributes;
> @@ -124,7 +123,9 @@ public class IndexedDiskCacheManager
>              // Try to load the cache from the set that have already been
>              // created. This only looks at the name attribute.
>
> -            cache = (IndexedDiskCache<K, V>) caches.get( cacheName );
> +            @SuppressWarnings("unchecked")
> +            IndexedDiskCache<K, V> indexedDiskCache = (IndexedDiskCache<K, V>) caches.get( cacheName );
> +            cache = indexedDiskCache;
>
>              // If it was not found, create a new one using the supplied
>              // attributes
>
> Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskElementDescriptor.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskElementDescriptor.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskElementDescriptor.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskElementDescriptor.java Sat Aug  4 14:19:08 2012
> @@ -64,6 +64,29 @@ public class IndexedDiskElementDescripto
>      }
>
>      /**
> +     * @see java.lang.Object#hashCode()
> +     */
> +    @Override
> +    public int hashCode()
> +    {
> +        return Long.valueOf(this.pos).hashCode() ^ Integer.valueOf(len).hashCode();
> +    }
> +
> +    /**
> +     * @see java.lang.Object#equals(java.lang.Object)
> +     */
> +    @Override
> +    public boolean equals(Object o)
> +    {
> +        if (o instanceof IndexedDiskElementDescriptor)
> +        {
> +            return compareTo((IndexedDiskElementDescriptor) o) == 0;
> +        }
> +
> +        return false;
> +    }
> +
> +    /**
>       * Compares based on length.
>       * <p>
>       * @param o Object
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -716,15 +716,15 @@ public class JDBCDiskCache<K extends Ser
>       */
>      public String constructLikeParameterFromPattern( String pattern )
>      {
> -        pattern = pattern.replaceAll( "\\.\\+", "%" );
> -        pattern = pattern.replaceAll( "\\.", "_" );
> +        String likePattern = pattern.replaceAll( "\\.\\+", "%" );
> +        likePattern = likePattern.replaceAll( "\\.", "_" );
>
>          if ( log.isDebugEnabled() )
>          {
> -            log.debug( "pattern = [" + pattern + "]" );
> +            log.debug( "pattern = [" + likePattern + "]" );
>          }
>
> -        return pattern;
> +        return likePattern;
>      }
>
>      /**
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -95,7 +95,9 @@ public abstract class JDBCDiskCacheManag
>
>          synchronized ( caches )
>          {
> -            diskCache = (JDBCDiskCache<K, V>) caches.get( cattr.getCacheName() );
> +            @SuppressWarnings("unchecked")
> +            JDBCDiskCache<K, V> jdbcDiskCache = (JDBCDiskCache<K, V>) caches.get( cattr.getCacheName() );
> +            diskCache = jdbcDiskCache;
>
>              if ( diskCache == null )
>              {
>
> Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/hsql/HSQLDiskCacheFactory.java Sat Aug  4 14:19:08 2012
> @@ -168,7 +168,7 @@ public class HSQLDiskCacheFactory
>       * @param cConn
>       * @param tableName
>       */
> -    private void setupTABLE( Connection cConn, String tableName )
> +    private void setupTABLE( Connection cConn, String tableName ) throws SQLException
>      {
>          boolean newT = true;
>
> @@ -187,15 +187,7 @@ public class HSQLDiskCacheFactory
>          createSql.append( "PRIMARY KEY (CACHE_KEY, REGION) " );
>          createSql.append( ");" );
>
> -        Statement sStatement = null;
> -        try
> -        {
> -            sStatement = cConn.createStatement();
> -        }
> -        catch ( SQLException e )
> -        {
> -            log.error( "problem creating a statement.", e );
> -        }
> +        Statement sStatement = cConn.createStatement();
>
>          try
>          {
> @@ -204,13 +196,14 @@ public class HSQLDiskCacheFactory
>          }
>          catch ( SQLException e )
>          {
> +            // FIXME: This is not reliable
>              if ( e.toString().indexOf( "already exists" ) != -1 )
>              {
>                  newT = false;
>              }
>              else
>              {
> -                log.error( "Problem creating table.", e );
> +                throw e;
>              }
>          }
>
>
> Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCache.java Sat Aug  4 14:19:08 2012
> @@ -116,15 +116,15 @@ public class MySQLDiskCache<K extends Se
>      @Override
>      public String constructLikeParameterFromPattern( String pattern )
>      {
> -        pattern = pattern.replaceAll( "\\.\\+", "%" );
> -        pattern = pattern.replaceAll( "\\.", "_" );
> +        String likePattern = pattern.replaceAll( "\\.\\+", "%" );
> +        likePattern = likePattern.replaceAll( "\\.", "_" );
>
>          if ( log.isDebugEnabled() )
>          {
> -            log.debug( "pattern = [" + pattern + "]" );
> +            log.debug( "pattern = [" + likePattern + "]" );
>          }
>
> -        return pattern;
> +        return likePattern;
>      }
>
>      /**
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -26,7 +26,6 @@ import java.util.TimerTask;
>
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> -import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCache;
>  import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
>  import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheManagerAbstractTemplate;
>  import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCachePoolAccess;
> @@ -129,11 +128,12 @@ public class MySQLDiskCacheManager
>       * @param cacheName
>       * @return The cache value
>       */
> -    public <K extends Serializable, V extends Serializable> JDBCDiskCache<K, V> getCache( String cacheName )
> +    @SuppressWarnings("unchecked")
> +    public <K extends Serializable, V extends Serializable> MySQLDiskCache<K, V> getCache( String cacheName )
>      {
>          MySQLDiskCacheAttributes cattr = (MySQLDiskCacheAttributes) defaultJDBCDiskCacheAttributes.copy();
>          cattr.setCacheName( cacheName );
> -        return getCache( cattr );
> +        return (MySQLDiskCache<K, V>) getCache( cattr );
>      }
>
>      /**
> @@ -239,7 +239,7 @@ public class MySQLDiskCacheManager
>          // get the runnable from the factory
>          TimerTask runnable = new OptimizerTask( optimizer );
>
> -        // have the daemon execut our runnable
> +        // have the daemon execute our runnable
>          // false to not execute immediately.
>          daemon.scheduleAtFixedRate( runnable, startTime, DAILY_INTERVAL );
>
>
> Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java Sat Aug  4 14:19:08 2012
> @@ -75,7 +75,7 @@ public class MySQLTableOptimizer
>       * if a deletion is in progress.
>       * <p>
>       * This restores when there is an optimization error. The error output looks like this:
> -     *
> +     *
>       * <pre>
>       *           mysql&gt; optimize table JCS_STORE_FLIGHT_OPTION_ITINERARY;
>       *               +---------------------------------------------+----------+----------+---------------------+
> @@ -86,9 +86,9 @@ public class MySQLTableOptimizer
>       *               +---------------------------------------------+----------+----------+---------------------+
>       *               2 rows in set (51.78 sec)
>       * </pre>
> -     *
> +     *
>       * A successful repair response looks like this:
> -     *
> +     *
>       * <pre>
>       *        mysql&gt; REPAIR TABLE JCS_STORE_FLIGHT_OPTION_ITINERARY;
>       *            +---------------------------------------------+--------+----------+----------------------------------------------+
> @@ -100,9 +100,9 @@ public class MySQLTableOptimizer
>       *            +---------------------------------------------+--------+----------+----------------------------------------------+
>       *            3 rows in set (3 min 5.94 sec)
>       * </pre>
> -     *
> +     *
>       * A successful optimization looks like this:
> -     *
> +     *
>       * <pre>
>       *       mysql&gt; optimize table JCS_STORE_DEFAULT;
>       *           +-----------------------------+----------+----------+----------+
> @@ -198,13 +198,16 @@ public class MySQLTableOptimizer
>                  }
>                  finally
>                  {
> -                    try
> +                    if (sStatement != null)
>                      {
> -                        sStatement.close();
> -                    }
> -                    catch ( SQLException e )
> -                    {
> -                        log.error( "Problem closing statement.", e );
> +                        try
> +                        {
> +                            sStatement.close();
> +                        }
> +                        catch ( SQLException e )
> +                        {
> +                            log.error( "Problem closing statement.", e );
> +                        }
>                      }
>                  }
>              }
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -31,9 +31,10 @@ import org.apache.commons.logging.LogFac
>  import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging;
>  import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
> -import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
>  import org.apache.jcs.engine.CacheConstants;
> +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;
> @@ -58,7 +59,7 @@ public class LateralCache<K extends Seri
>      final String cacheName;
>
>      /** either http, socket.udp, or socket.tcp can set in config */
> -    private ILateralCacheService<K, V> lateralCacheService;
> +    private ICacheServiceNonLocal<K, V> lateralCacheService;
>
>      /** Monitors the connection. */
>      private LateralCacheMonitor monitor;
> @@ -70,7 +71,7 @@ public class LateralCache<K extends Seri
>       * @param lateral
>       * @param monitor
>       */
> -    public LateralCache( ILateralCacheAttributes cattr, ILateralCacheService<K, V> lateral, LateralCacheMonitor monitor )
> +    public LateralCache( ILateralCacheAttributes cattr, ICacheServiceNonLocal<K, V> lateral, LateralCacheMonitor monitor )
>      {
>          this.cacheName = cattr.getCacheName();
>          this.lateralCacheAttribures = cattr;
> @@ -352,7 +353,7 @@ public class LateralCache<K extends Seri
>      {
>          log.error( "Disabling lateral cache due to error " + msg, ex );
>
> -        lateralCacheService = new ZombieLateralCacheService<K, V>( lateralCacheAttribures.getZombieQueueMaxSize() );
> +        lateralCacheService = new ZombieCacheServiceNonLocal<K, V>( lateralCacheAttribures.getZombieQueueMaxSize() );
>          // may want to flush if region specifies
>          // Notify the cache monitor about the error, and kick off the recovery
>          // process.
> @@ -371,11 +372,11 @@ public class LateralCache<K extends Seri
>       * <p>
>       * @param restoredLateral
>       */
> -    public void fixCache( ILateralCacheService<K, V> restoredLateral )
> +    public void fixCache( ICacheServiceNonLocal<K, V> restoredLateral )
>      {
> -        if ( this.lateralCacheService != null && this.lateralCacheService instanceof ZombieLateralCacheService )
> +        if ( this.lateralCacheService != null && this.lateralCacheService instanceof ZombieCacheServiceNonLocal )
>          {
> -            ZombieLateralCacheService<K, V> zombie = (ZombieLateralCacheService<K, V>) this.lateralCacheService;
> +            ZombieCacheServiceNonLocal<K, V> zombie = (ZombieCacheServiceNonLocal<K, V>) this.lateralCacheService;
>              this.lateralCacheService = restoredLateral;
>              try
>              {
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -31,7 +31,7 @@ import org.apache.jcs.auxiliary.lateral.
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
> -import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
> +import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
>  import org.apache.jcs.engine.behavior.IElementSerializer;
>  import org.apache.jcs.engine.behavior.IShutdownObserver;
>  import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
> @@ -138,7 +138,8 @@ public abstract class LateralCacheAbstra
>       * @param lateralService
>       * @param lateralWatch
>       */
> -    public void fixCaches( ILateralCacheService lateralService, ILateralCacheObserver lateralWatch )
> +    @SuppressWarnings("unchecked")
> +    public void fixCaches( ICacheServiceNonLocal<Serializable, Serializable> lateralService, ILateralCacheObserver lateralWatch )
>      {
>          log.debug( "Fixing lateral caches:" );
>
> @@ -149,7 +150,7 @@ public abstract class LateralCacheAbstra
>              //this.lateralWatch.setCacheWatch(lateralWatch);
>              for (LateralCacheNoWait<? extends Serializable, ? extends Serializable> cache : this.caches.values())
>              {
> -                cache.fixCache( lateralService );
> +                ((LateralCacheNoWait<Serializable, Serializable>)cache).fixCache( lateralService );
>              }
>          }
>      }
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -219,7 +219,7 @@ public class LateralCacheMonitor
>                          }
>                      }
>
> -                    for (LateralCacheNoWait c : mgr.getCaches().values())
> +                    for (LateralCacheNoWait<?, ?> c : mgr.getCaches().values())
>                      {
>                          if ( c.getStatus() == CacheConstants.STATUS_ERROR )
>                          {
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -34,12 +34,12 @@ import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
>  import org.apache.jcs.auxiliary.AbstractAuxiliaryCache;
>  import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
> -import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
>  import org.apache.jcs.engine.CacheAdaptor;
>  import org.apache.jcs.engine.CacheConstants;
>  import org.apache.jcs.engine.CacheEventQueueFactory;
>  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.stats.StatElement;
>  import org.apache.jcs.engine.stats.Stats;
>  import org.apache.jcs.engine.stats.behavior.IStatElement;
> @@ -337,7 +337,7 @@ public class LateralCacheNoWait<K extend
>       * <p>
>       * @param lateral
>       */
> -    public void fixCache( ILateralCacheService<K, V> lateral )
> +    public void fixCache( ICacheServiceNonLocal<K, V> lateral )
>      {
>          cache.fixCache( lateral );
>          resetEventQ();
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -124,6 +124,7 @@ public class LateralCacheNoWaitFacade<K
>              return false;
>          }
>
> +        @SuppressWarnings("unchecked")
>          LateralCacheNoWait<K, V>[] newArray = new LateralCacheNoWait[noWaits.length + 1];
>
>          System.arraycopy( noWaits, 0, newArray, 0, noWaits.length );
> @@ -165,6 +166,7 @@ public class LateralCacheNoWaitFacade<K
>              return false;
>          }
>
> +        @SuppressWarnings("unchecked")
>          LateralCacheNoWait<K, V>[] newArray = new LateralCacheNoWait[noWaits.length - 1];
>
>          System.arraycopy( noWaits, 0, newArray, 0, position );
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -19,12 +19,14 @@ package org.apache.jcs.auxiliary.lateral
>   * under the License.
>   */
>
> +import java.io.Serializable;
> +
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
> -import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
>  import org.apache.jcs.engine.behavior.ICacheRestore;
> +import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
>
>  /**
>   * Used to repair the lateral caches managed by the associated instance of LateralCacheManager.
> @@ -83,13 +85,14 @@ public class LateralCacheRestore
>      /**
>       * Fixes up all the caches managed by the associated cache manager.
>       */
> +    @SuppressWarnings("unchecked")
>      public void fix()
>      {
>          if ( !canFix )
>          {
>              return;
>          }
> -        lcm.fixCaches( (ILateralCacheService) lateralObj, (ILateralCacheObserver) lateralObj );
> +        lcm.fixCaches( (ICacheServiceNonLocal<Serializable, Serializable>) lateralObj, (ILateralCacheObserver) lateralObj );
>          String msg = "Lateral connection resumed.";
>          log.info( msg );
>      }
>
> Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheWatchRepairable.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheWatchRepairable.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheWatchRepairable.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheWatchRepairable.java Sat Aug  4 14:19:08 2012
> @@ -20,7 +20,6 @@ package org.apache.jcs.auxiliary.lateral
>   */
>
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
> -
>  import org.apache.jcs.engine.CacheWatchRepairable;
>
>  /**
>
> Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java Sat Aug  4 14:19:08 2012
> @@ -20,7 +20,6 @@ package org.apache.jcs.auxiliary.lateral
>   */
>
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
> -
>  import org.apache.jcs.engine.ZombieCacheWatch;
>
>  /**
>
> Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java
> URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java?rev=1369329&r1=1369328&r2=1369329&view=diff
> ==============================================================================
> --- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java (original)
> +++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java Sat Aug  4 14:19:08 2012
> @@ -25,6 +25,7 @@ import java.util.Map;
>
>  import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
>  import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
> +import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
>
>  /**
>   * This helps ensure some common behavior among LateraLCacheManagers for things
> @@ -41,7 +42,7 @@ public interface ILateralCacheManager
>       * <p>
>       * @return Map
>       */
> -    public abstract Map<String, ? extends ILateralCacheManager> getInstances();
> +    Map<String, ? extends ILateralCacheManager> getInstances();
>
>      /**
>       * This is a temporary solution that allows the monitor to get caches from an
> @@ -49,7 +50,7 @@ public interface ILateralCacheManager
>       * <p>
>       * @return Map
>       */
> -    public abstract Map<String, LateralCacheNoWait<? extends Serializable, ? extends Serializable>> getCaches();
> +    Map<String, LateralCacheNoWait<? extends Serializable, ? extends Serializable>> getCaches();
>
>      /**
>       * The restore calls this on the manger if a cache if found to be in error.
> @@ -58,8 +59,7 @@ public interface ILateralCacheManager
>       * @throws IOException
>       *             if the service cannot be fixed.
>       */
> -    public abstract Object fixService()
> -        throws IOException;
> +    Object fixService() throws IOException;
>
>      /**
>       * Sets the corrected service. The restore process will call this if it gets
> @@ -68,5 +68,5 @@ public interface ILateralCacheManager
>       * @param lateralService
>       * @param lateralWatch
>       */
> -    public void fixCaches( ILateralCacheService lateralService, ILateralCacheObserver lateralWatch );
> +    void fixCaches( ICacheServiceNonLocal<Serializable, Serializable> lateralService, ILateralCacheObserver lateralWatch );
>  }
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -121,8 +121,9 @@ public class LateralTCPCacheFactory
>          createListener( (ILateralCacheAttributes) iaca, cacheMgr );
>
>          // create the no wait facade.
> -        LateralCacheNoWaitFacade<K, V> lcnwf = new LateralCacheNoWaitFacade<K, V>( noWaits
> -            .toArray( new LateralCacheNoWait[0] ), (ILateralCacheAttributes) iaca );
> +        @SuppressWarnings("unchecked")
> +        LateralCacheNoWait<K, V>[] lcnwArray = noWaits.toArray( new LateralCacheNoWait[0] );
> +        LateralCacheNoWaitFacade<K, V> lcnwf = new LateralCacheNoWaitFacade<K, V>(lcnwArray, (ILateralCacheAttributes) iaca );
>
>          // create udp discovery if available.
>          createDiscoveryService( lac, lcnwf, cacheMgr, cacheEventLogger, elementSerializer );
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -27,19 +27,18 @@ import java.util.Map;
>
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> -import org.apache.jcs.auxiliary.AuxiliaryCache;
>  import org.apache.jcs.auxiliary.lateral.LateralCache;
>  import org.apache.jcs.auxiliary.lateral.LateralCacheAbstractManager;
>  import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
>  import org.apache.jcs.auxiliary.lateral.LateralCacheMonitor;
>  import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
>  import org.apache.jcs.auxiliary.lateral.LateralCacheWatchRepairable;
> -import org.apache.jcs.auxiliary.lateral.ZombieLateralCacheService;
>  import org.apache.jcs.auxiliary.lateral.ZombieLateralCacheWatch;
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
> -import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
>  import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
> +import org.apache.jcs.engine.ZombieCacheServiceNonLocal;
> +import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
>  import org.apache.jcs.engine.behavior.ICompositeCacheManager;
>  import org.apache.jcs.engine.behavior.IElementSerializer;
>  import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
> @@ -72,7 +71,7 @@ public class LateralTCPCacheManager
>          Collections.synchronizedMap( new HashMap<String, LateralTCPCacheManager>() );
>
>      /** ITCPLateralCacheAttributes */
> -    protected ITCPLateralCacheAttributes lateralCacheAttribures;
> +    protected ITCPLateralCacheAttributes lateralCacheAttributes;
>
>      /** number of clients, we can remove this. */
>      private int clients;
> @@ -80,7 +79,7 @@ public class LateralTCPCacheManager
>      /**
>       * Handle to the lateral cache service; or a zombie handle if failed to connect.
>       */
> -    private ILateralCacheService lateralService;
> +    private ICacheServiceNonLocal<? extends Serializable, ? extends Serializable> lateralService;
>
>      /**
>       * Wrapper of the lateral cache watch service; or wrapper of a zombie service if failed to
> @@ -141,13 +140,9 @@ public class LateralTCPCacheManager
>          if ( monitor == null )
>          {
>              monitor = new LateralCacheMonitor( instance );
> -            // Should never be null
> -            if ( monitor != null )
> -            {
> -                Thread t = new Thread( monitor );
> -                t.setDaemon( true );
> -                t.start();
> -            }
> +            Thread t = new Thread( monitor );
> +            t.setDaemon( true );
> +            t.start();
>          }
>      }
>
> @@ -162,14 +157,17 @@ public class LateralTCPCacheManager
>      private LateralTCPCacheManager( ITCPLateralCacheAttributes lcaA, ICompositeCacheManager cacheMgr,
>                                      ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
>      {
> -        this.lateralCacheAttribures = lcaA;
> +        this.lateralCacheAttributes = lcaA;
>          this.cacheMgr = cacheMgr;
>          this.cacheEventLogger = cacheEventLogger;
>          this.elementSerializer = elementSerializer;
>
> +        this.lateralWatch = new LateralCacheWatchRepairable();
> +        this.lateralWatch.setCacheWatch( new ZombieLateralCacheWatch() );
> +
>          if ( log.isDebugEnabled() )
>          {
> -            log.debug( "Creating lateral cache service, lca = " + this.lateralCacheAttribures );
> +            log.debug( "Creating lateral cache service, lca = " + this.lateralCacheAttributes );
>          }
>
>          // Create the service
> @@ -177,18 +175,10 @@ public class LateralTCPCacheManager
>          {
>              if ( log.isInfoEnabled() )
>              {
> -                log.info( "Creating TCP service, lca = " + this.lateralCacheAttribures );
> -            }
> -            this.lateralService = new LateralTCPService( this.lateralCacheAttribures );
> -
> -            if ( this.lateralService == null )
> -            {
> -                log.error( "No service created, must zombie" );
> -                throw new Exception( "No service created for lateral cache." );
> +                log.info( "Creating TCP service, lca = " + this.lateralCacheAttributes );
>              }
>
> -            this.lateralWatch = new LateralCacheWatchRepairable();
> -            this.lateralWatch.setCacheWatch( new ZombieLateralCacheWatch() );
> +            this.lateralService = new LateralTCPService<Serializable, Serializable>( this.lateralCacheAttributes );
>          }
>          catch ( Exception ex )
>          {
> @@ -197,9 +187,7 @@ public class LateralTCPCacheManager
>              // "zombie" services.
>              log.error( "Failure, lateral instance will use zombie service", ex );
>
> -            this.lateralService = new ZombieLateralCacheService( lateralCacheAttribures.getZombieQueueMaxSize() );
> -            this.lateralWatch = new LateralCacheWatchRepairable();
> -            this.lateralWatch.setCacheWatch( new ZombieLateralCacheWatch() );
> +            this.lateralService = new ZombieCacheServiceNonLocal<Serializable, Serializable>( lateralCacheAttributes.getZombieQueueMaxSize() );
>
>              // Notify the cache monitor about the error, and kick off
>              // the recovery process.
> @@ -237,8 +225,9 @@ public class LateralTCPCacheManager
>       * @return AuxiliaryCache
>       * @param cacheName
>       */
> +    @SuppressWarnings("unchecked")
>      @Override
> -    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( String cacheName )
> +    public <K extends Serializable, V extends Serializable> LateralCacheNoWait<K, V> getCache( String cacheName )
>      {
>          LateralCacheNoWait<K, V> lateralNoWait = null;
>          synchronized ( caches )
> @@ -246,10 +235,11 @@ public class LateralTCPCacheManager
>              lateralNoWait = (LateralCacheNoWait<K, V>) caches.get( cacheName );
>              if ( lateralNoWait == null )
>              {
> -                LateralCacheAttributes attr = (LateralCacheAttributes) lateralCacheAttribures.copy();
> +                LateralCacheAttributes attr = (LateralCacheAttributes) lateralCacheAttributes.copy();
>                  attr.setCacheName( cacheName );
>
> -                LateralCache<K, V> cache = new LateralCache<K, V>( attr, this.lateralService, monitor );
> +                LateralCache<K, V> cache = new LateralCache<K, V>( attr,
> +                        (ICacheServiceNonLocal<K, V>)this.lateralService, monitor );
>                  cache.setCacheEventLogger( cacheEventLogger );
>                  cache.setElementSerializer( elementSerializer );
>
> @@ -266,7 +256,7 @@ public class LateralTCPCacheManager
>
>                  if ( log.isInfoEnabled() )
>                  {
> -                    log.info( "Created LateralCacheNoWait for [" + lateralCacheAttribures + "] LateralCacheNoWait = [" + lateralNoWait
> +                    log.info( "Created LateralCacheNoWait for [" + lateralCacheAttributes + "] LateralCacheNoWait = [" + lateralNoWait
>                          + "]" );
>                  }
>
> @@ -286,11 +276,11 @@ public class LateralTCPCacheManager
>      private void addListenerIfNeeded( String cacheName )
>      {
>          // don't create a listener if we are not receiving.
> -        if ( lateralCacheAttribures.isReceive() )
> +        if ( lateralCacheAttributes.isReceive() )
>          {
>              try
>              {
> -                addLateralCacheListener( cacheName, LateralTCPListener.getInstance( lateralCacheAttribures, cacheMgr ) );
> +                addLateralCacheListener( cacheName, LateralTCPListener.getInstance( lateralCacheAttributes, cacheMgr ) );
>              }
>              catch ( IOException ioe )
>              {
> @@ -328,7 +318,7 @@ public class LateralTCPCacheManager
>          Object service = null;
>          try
>          {
> -            service = new LateralTCPService( lateralCacheAttribures );
> +            service = new LateralTCPService<Serializable, Serializable>( lateralCacheAttributes );
>          }
>          catch ( Exception ex )
>          {
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -111,6 +111,7 @@ public class LateralTCPDiscoveryListener
>       */
>      public <K extends Serializable, V extends Serializable> boolean containsNoWait( String cacheName, LateralCacheNoWait<K, V> noWait )
>      {
> +        @SuppressWarnings("unchecked")
>          LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() );
>          if ( facade == null )
>          {
> @@ -134,6 +135,7 @@ public class LateralTCPDiscoveryListener
>       */
>      protected <K extends Serializable, V extends Serializable> boolean addNoWait( LateralCacheNoWait<K, V> noWait )
>      {
> +        @SuppressWarnings("unchecked")
>          LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() );
>          if ( log.isDebugEnabled() )
>          {
> @@ -173,6 +175,7 @@ public class LateralTCPDiscoveryListener
>       */
>      protected <K extends Serializable, V extends Serializable> boolean removeNoWait( LateralCacheNoWait<K, V> noWait )
>      {
> +        @SuppressWarnings("unchecked")
>          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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -106,10 +106,11 @@ public class LateralTCPListener<K extend
>       * @param cacheMgr
>       * @return The instance value
>       */
> -    public synchronized static <K extends Serializable, V extends Serializable> ILateralCacheListener<K, V>
> +    public synchronized static <K extends Serializable, V extends Serializable> LateralTCPListener<K, V>
>          getInstance( ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr )
>      {
> -        ILateralCacheListener<K, V> ins = (ILateralCacheListener<K, V>) instances.get( String.valueOf( ilca.getTcpListenerPort() ) );
> +        @SuppressWarnings("unchecked")
> +        LateralTCPListener<K, V> ins = (LateralTCPListener<K, V>) instances.get( String.valueOf( ilca.getTcpListenerPort() ) );
>
>          if ( ins == null )
>          {
> @@ -503,6 +504,7 @@ public class LateralTCPListener<K extend
>          /**
>           * Main processing method for the LateralTCPReceiverConnection object
>           */
> +        @SuppressWarnings("unchecked")
>          public void run()
>          {
>              ObjectInputStream ois;
>
> 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=1369329&r1=1369328&r2=1369329&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 Sat Aug  4 14:19:08 2012
> @@ -33,17 +33,17 @@ import org.apache.commons.logging.LogFac
>  import org.apache.jcs.auxiliary.lateral.LateralCacheInfo;
>  import org.apache.jcs.auxiliary.lateral.LateralElementDescriptor;
>  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
> -import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
>  import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
>  import org.apache.jcs.engine.CacheElement;
>  import org.apache.jcs.engine.behavior.ICacheElement;
>  import org.apache.jcs.engine.behavior.ICacheListener;
> +import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
>
>  /**
>   * A lateral cache service implementation. Does not implement getGroupKey
>   */
>  public class LateralTCPService<K extends Serializable, V extends Serializable>
> -    implements ILateralCacheService<K, V>, ILateralCacheObserver
> +    implements ICacheServiceNonLocal<K, V>, ILateralCacheObserver
>  {
>      /** The logger. */
>      private final static Log log = LogFactory.getLog( LateralTCPService.class );
> @@ -104,7 +104,7 @@ public class LateralTCPService<K extends
>       * remove. Either way, we create a lateral element descriptor, which is essentially a JCS TCP
>       * packet. It describes what operation the receiver should take when it gets the packet.
>       * <p>
> -     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService#update(org.apache.jcs.engine.behavior.ICacheElement,
> +     * @see org.apache.jcs.auxiliary.lateral.behavior.ICacheServiceNonLocal#update(org.apache.jcs.engine.behavior.ICacheElement,
>       *      long)
>       */
>      public void update( ICacheElement<K, V> item, long requesterId )
> @@ -161,7 +161,7 @@ public class LateralTCPService<K extends
>      /**
>       * Wraps the key in a LateralElementDescriptor.
>       * <p>
> -     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService#remove(java.lang.String,
> +     * @see org.apache.jcs.auxiliary.lateral.behavior.ICacheServiceNonLocal#remove(java.lang.String,
>       *      java.io.Serializable, long)
>       */
>      public void remove( String cacheName, K key, long requesterId )
> @@ -248,10 +248,11 @@ public class LateralTCPService<K extends
>              LateralElementDescriptor<K, V> led = new LateralElementDescriptor<K, V>( ce );
>              // led.requesterId = requesterId; // later
>              led.command = LateralElementDescriptor.GET;
> -            Object response = sender.sendAndReceive( led );
> +            @SuppressWarnings("unchecked")
> +            ICacheElement<K, V> response = (ICacheElement<K, V>)sender.sendAndReceive( led );
>              if ( response != null )
>              {
> -                return (ICacheElement<K, V>) response;
> +                return response;
>              }
>              return null;
>          }
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message