Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D888710544 for ; Sat, 29 Mar 2014 21:42:57 +0000 (UTC) Received: (qmail 561 invoked by uid 500); 29 Mar 2014 21:41:56 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 284 invoked by uid 500); 29 Mar 2014 21:41:48 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 99402 invoked by uid 99); 29 Mar 2014 21:36:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Mar 2014 21:36:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Mar 2014 21:36:49 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6A80223888E2; Sat, 29 Mar 2014 21:36:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1583059 - in /commons/proper/jcs/trunk/src/java/org/apache/commons/jcs: auxiliary/disk/ auxiliary/disk/behavior/ auxiliary/disk/block/ auxiliary/disk/file/ auxiliary/disk/indexed/ auxiliary/lateral/ auxiliary/lateral/socket/tcp/ auxiliary/... Date: Sat, 29 Mar 2014 21:36:25 -0000 To: commits@commons.apache.org From: tv@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140329213626.6A80223888E2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tv Date: Sat Mar 29 21:36:24 2014 New Revision: 1583059 URL: http://svn.apache.org/r1583059 Log: Clean up some Findbugs complaints Removed: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheInfo.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerInfo.java Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/behavior/IDiskCacheAttributes.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskKeyStore.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/file/FileDiskCache.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/CacheInfo.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ElementAttributes.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/StatElement.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/behavior/IStatElement.java Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheAttributes.java Sat Mar 29 21:36:24 2014 @@ -19,9 +19,13 @@ package org.apache.commons.jcs.auxiliary * under the License. */ +import java.io.File; + import org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCacheAttributes; import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes; import org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * This has common attributes that any conceivable disk cache would need. @@ -33,14 +37,17 @@ public abstract class AbstractDiskCacheA /** Don't change. */ private static final long serialVersionUID = 8306631920391711229L; + /** The logger */ + private final static Log log = LogFactory.getLog( AbstractDiskCacheAttributes.class ); + /** path to disk */ - protected String diskPath; + protected File diskPath; /** if this is false, we will not execute remove all */ private boolean allowRemoveAll = true; /** default to 5000 */ - protected int maxPurgatorySize = MAX_PURGATORY_SIZE_DEFUALT; + protected int maxPurgatorySize = MAX_PURGATORY_SIZE_DEFAULT; /** Default amount of time to allow for key persistence on shutdown */ private static final int DEFAULT_shutdownSpoolTimeLimit = 60; @@ -58,7 +65,13 @@ public abstract class AbstractDiskCacheA */ public void setDiskPath( String path ) { - this.diskPath = path.trim(); + this.diskPath = new File( path ); + boolean result = this.diskPath.mkdirs(); + + if (!result) + { + log.error("Failed to create directory " + path); + } } /** @@ -66,7 +79,7 @@ public abstract class AbstractDiskCacheA *

* @return The diskPath value */ - public String getDiskPath() + public File getDiskPath() { return this.diskPath; } Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/behavior/IDiskCacheAttributes.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/behavior/IDiskCacheAttributes.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/behavior/IDiskCacheAttributes.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/behavior/IDiskCacheAttributes.java Sat Mar 29 21:36:24 2014 @@ -19,6 +19,8 @@ package org.apache.commons.jcs.auxiliary * under the License. */ +import java.io.File; + import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes; /** @@ -32,7 +34,7 @@ public interface IDiskCacheAttributes * items to be spooled are temporarily stored. It basically provides access * to items on the to-be-spooled queue. */ - int MAX_PURGATORY_SIZE_DEFUALT = 5000; + int MAX_PURGATORY_SIZE_DEFAULT = 5000; /** * Sets the diskPath attribute of the IJISPCacheAttributes object @@ -47,7 +49,7 @@ public interface IDiskCacheAttributes *

* @return The diskPath value */ - String getDiskPath(); + File getDiskPath(); /** * Gets the maxKeySize attribute of the DiskCacheAttributes object Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java Sat Mar 29 21:36:24 2014 @@ -118,13 +118,11 @@ public class BlockDiskCache instances = + protected static final Map instances = new ConcurrentHashMap(); /** ITCPLateralCacheAttributes */ Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Sat Mar 29 21:36:24 2014 @@ -35,10 +35,10 @@ import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import org.apache.commons.jcs.access.exception.CacheException; -import org.apache.commons.jcs.auxiliary.lateral.LateralCacheInfo; import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor; import org.apache.commons.jcs.auxiliary.lateral.behavior.ILateralCacheListener; import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes; +import org.apache.commons.jcs.engine.CacheInfo; import org.apache.commons.jcs.engine.behavior.ICacheElement; import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager; import org.apache.commons.jcs.engine.behavior.IShutdownObserver; @@ -53,11 +53,8 @@ import org.apache.commons.logging.LogFac * passed to a pooled executor which then calls the appropriate handle method. */ public class LateralTCPListener - implements ILateralCacheListener, Serializable, IShutdownObserver + implements ILateralCacheListener, IShutdownObserver { - /** Don't change. */ - private static final long serialVersionUID = -9107062664967131738L; - /** The logger */ protected final static Log log = LogFactory.getLog( LateralTCPListener.class ); @@ -96,7 +93,7 @@ public class LateralTCPListener ic = rcm.getCache( rca ); - if ( ic != null ) - { - noWaits.add( ic ); - } - else - { - log.info( "noWait is null" ); - } + noWaits.add( ic ); } // GET HANDLE BUT DONT REGISTER A LISTENER FOR FAILOVERS @@ -126,14 +114,7 @@ public class RemoteCacheFactory if ( ( !primayDefined && fCnt == 1 ) || noWaits.size() <= 0 ) { ICache ic = rcm.getCache( rca ); - if ( ic != null ) - { - noWaits.add( ic ); - } - else - { - log.info( "noWait is null" ); - } + noWaits.add( ic ); } } // end while @@ -159,14 +140,7 @@ public class RemoteCacheFactory elementSerializer ); rca.setRemoteType( RemoteType.CLUSTER ); ICache ic = rcm.getCache( rca ); - if ( ic != null ) - { - noWaits.add( ic ); - } - else - { - log.info( "noWait is null" ); - } + noWaits.add( ic ); } } Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java Sat Mar 29 21:36:24 2014 @@ -214,49 +214,42 @@ public class RemoteCacheFailoverRunner ic = rcm.getCache( rca.getCacheName() ); - if ( ic != null ) + if ( ic.getStatus() == CacheStatus.ALIVE ) { - if ( ic.getStatus() == CacheStatus.ALIVE ) - { - // may need to do this more gracefully - log.debug( "resetting no wait" ); - facade.noWaits = new RemoteCacheNoWait[1]; - facade.noWaits[0] = (RemoteCacheNoWait) ic; - facade.remoteCacheAttributes.setFailoverIndex( i ); + // may need to do this more gracefully + log.debug( "resetting no wait" ); + facade.noWaits = new RemoteCacheNoWait[1]; + facade.noWaits[0] = (RemoteCacheNoWait) ic; + facade.remoteCacheAttributes.setFailoverIndex( i ); - synchronized ( this ) + synchronized ( this ) + { + if ( log.isDebugEnabled() ) { - if ( log.isDebugEnabled() ) + log.debug( "setting ALRIGHT to true" ); + if ( i > 0 ) { - log.debug( "setting ALRIGHT to true" ); - if ( i > 0 ) - { - log.debug( "Moving to Primary Recovery Mode, failover index = " + i ); - } - else + log.debug( "Moving to Primary Recovery Mode, failover index = " + i ); + } + else + { + if ( log.isInfoEnabled() ) { - if ( log.isInfoEnabled() ) - { - String message = "No need to connect to failover, the primary server is back up."; - log.info( message ); - } + String message = "No need to connect to failover, the primary server is back up."; + log.info( message ); } } + } - alright = true; + alright = true; - if ( log.isInfoEnabled() ) - { - log.info( "CONNECTED to host = [" + rca.getRemoteHost() + "] port = [" - + rca.getRemotePort() + "]" ); - } + if ( log.isInfoEnabled() ) + { + log.info( "CONNECTED to host = [" + rca.getRemoteHost() + "] port = [" + + rca.getRemotePort() + "]" ); } } } - else - { - log.info( "noWait is null" ); - } } catch ( Exception ex ) { @@ -368,116 +361,106 @@ public class RemoteCacheFailoverRunner 0 ) { - int fidx = facade.remoteCacheAttributes.getFailoverIndex(); + String serverOld = failovers[fidx]; - if ( fidx > 0 ) + if ( log.isDebugEnabled() ) { - String serverOld = failovers[fidx]; + log.debug( "Failover Index = " + fidx + " the server at that index is [" + + serverOld + "]" ); + } - if ( log.isDebugEnabled() ) - { - log.debug( "Failover Index = " + fidx + " the server at that index is [" - + serverOld + "]" ); - } + if ( serverOld != null ) + { + // create attributes that reflect the + // previous failed over configuration. + RemoteCacheAttributes rcaOld = (RemoteCacheAttributes) facade.remoteCacheAttributes.copy(); + rcaOld.setRemoteHost( serverOld.substring( 0, serverOld.indexOf( ":" ) ) ); + rcaOld.setRemotePort( Integer.parseInt( serverOld.substring( serverOld + .indexOf( ":" ) + 1 ) ) ); + RemoteCacheManager rcmOld = RemoteCacheManager.getInstance( rcaOld, cacheMgr, cacheEventLogger, elementSerializer ); - if ( serverOld != null ) + if ( rcmOld != null ) { - // create attributes that reflect the - // previous failed over configuration. - RemoteCacheAttributes rcaOld = (RemoteCacheAttributes) facade.remoteCacheAttributes.copy(); - rcaOld.setRemoteHost( serverOld.substring( 0, serverOld.indexOf( ":" ) ) ); - rcaOld.setRemotePort( Integer.parseInt( serverOld.substring( serverOld - .indexOf( ":" ) + 1 ) ) ); - RemoteCacheManager rcmOld = RemoteCacheManager.getInstance( rcaOld, cacheMgr, cacheEventLogger, elementSerializer ); - - if ( rcmOld != null ) - { - // manager can remove by name if - // necessary - rcmOld.removeRemoteCacheListener( rcaOld ); - } - if ( log.isInfoEnabled() ) - { - log.info( "Successfully deregistered from FAILOVER remote server = " - + serverOld ); - } + // manager can remove by name if + // necessary + rcmOld.removeRemoteCacheListener( rcaOld ); } - } - else if ( fidx == 0 ) - { - // this should never happen. If there are no - // failovers this shouldn't get called. - if ( log.isDebugEnabled() ) + if ( log.isInfoEnabled() ) { - log.debug( "No need to restore primary, it is already restored." ); - return true; + log.info( "Successfully deregistered from FAILOVER remote server = " + + serverOld ); } } - else if ( fidx < 0 ) + } + else if ( fidx == 0 ) + { + // this should never happen. If there are no + // failovers this shouldn't get called. + if ( log.isDebugEnabled() ) { - // this should never happen - log.warn( "Failover index is less than 0, this shouldn't happen" ); + log.debug( "No need to restore primary, it is already restored." ); + return true; } } - } - catch ( IOException e ) - { - // TODO, should try again, or somehow stop the listener - log.error( - "Trouble trying to deregister old failover listener prior to restoring the primary = " - + server, e ); - } - - // Restore primary - // may need to do this more gracefully, letting the failover finish in the background - RemoteCacheNoWait failoverNoWait = facade.noWaits[0]; - - // swap in a new one - facade.noWaits = new RemoteCacheNoWait[1]; - facade.noWaits[0] = (RemoteCacheNoWait) ic; - facade.remoteCacheAttributes.setFailoverIndex( 0 ); - - if ( log.isInfoEnabled() ) - { - String message = "Successfully reconnected to PRIMARY remote server. Substituted primary for failoverNoWait [" + failoverNoWait + "]"; - log.info( message ); - - if ( facade.getCacheEventLogger() != null ) + else if ( fidx < 0 ) { - facade.getCacheEventLogger().logApplicationEvent( "RemoteCacheFailoverRunner", "RestoredPrimary", - message ); + // this should never happen + log.warn( "Failover index is less than 0, this shouldn't happen" ); } } - return true; + } + catch ( IOException e ) + { + // TODO, should try again, or somehow stop the listener + log.error( + "Trouble trying to deregister old failover listener prior to restoring the primary = " + + server, e ); } - // else all right - // if the failover index was at 0 here, we would be in a bad - // situation, unless there were just - // no failovers configured. - if ( log.isDebugEnabled() ) + // Restore primary + // may need to do this more gracefully, letting the failover finish in the background + RemoteCacheNoWait failoverNoWait = facade.noWaits[0]; + + // swap in a new one + facade.noWaits = new RemoteCacheNoWait[1]; + facade.noWaits[0] = (RemoteCacheNoWait) ic; + facade.remoteCacheAttributes.setFailoverIndex( 0 ); + + if ( log.isInfoEnabled() ) { - log.debug( "Primary server status in error, not connected." ); + String message = "Successfully reconnected to PRIMARY remote server. Substituted primary for failoverNoWait [" + failoverNoWait + "]"; + log.info( message ); + + if ( facade.getCacheEventLogger() != null ) + { + facade.getCacheEventLogger().logApplicationEvent( "RemoteCacheFailoverRunner", "RestoredPrimary", + message ); + } } + return true; } - else + + // else all right + // if the failover index was at 0 here, we would be in a bad + // situation, unless there were just + // no failovers configured. + if ( log.isDebugEnabled() ) { - if ( log.isDebugEnabled() ) - { - log.debug( "Primary server is null, not connected." ); - } + log.debug( "Primary server status in error, not connected." ); } } catch ( NumberFormatException ex ) Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java Sat Mar 29 21:36:24 2014 @@ -33,8 +33,6 @@ import org.apache.commons.jcs.engine.beh import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager; import org.apache.commons.jcs.engine.behavior.IElementSerializer; import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * The RemoteCacheFactory creates remote caches for the cache hub. It returns a no wait facade which @@ -45,9 +43,6 @@ import org.apache.commons.logging.LogFac public class RemoteHttpCacheFactory implements AuxiliaryCacheFactory { - /** The logger. */ - private final static Log log = LogFactory.getLog( RemoteHttpCacheFactory.class ); - /** The name of this auxiliary */ private String name; @@ -79,14 +74,7 @@ public class RemoteHttpCacheFactory // TODO, use the configured value. rca.setRemoteType( RemoteType.LOCAL ); ICache ic = rcm.getCache( rca ); - if ( ic != null ) - { - noWaits.add( ic ); - } - else - { - log.info( "noWait is null" ); - } + noWaits.add( ic ); @SuppressWarnings("unchecked") // No generic arrays in java RemoteCacheNoWait[] rcnwArray = noWaits.toArray( new RemoteCacheNoWait[0] ); Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java Sat Mar 29 21:36:24 2014 @@ -93,7 +93,7 @@ public class RemoteCacheServer>(); /** The central hub */ - private CompositeCacheManager cacheManager; + private transient CompositeCacheManager cacheManager; /** relates listener id with a type */ private final Hashtable idTypeMap = new Hashtable(); @@ -342,24 +342,13 @@ public class RemoteCacheServer[] qlist = getEventQList( cacheDesc, requesterId ); - - if ( qlist != null ) + if ( log.isDebugEnabled() ) { - if ( log.isDebugEnabled() ) - { - log.debug( "qlist.length = " + qlist.length ); - } - for ( int i = 0; i < qlist.length; i++ ) - { - qlist[i].addPutEvent( item ); - } + log.debug( "qlist.length = " + qlist.length ); } - else + for ( int i = 0; i < qlist.length; i++ ) { - if ( log.isDebugEnabled() ) - { - log.debug( "q list is null" ); - } + qlist[i].addPutEvent( item ); } } } Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java Sat Mar 29 21:36:24 2014 @@ -210,8 +210,14 @@ public class RemoteCacheStartupServlet try { + String characterEncoding = response.getCharacterEncoding(); + if (characterEncoding == null) + { + characterEncoding = "UTF-8"; + response.setCharacterEncoding(characterEncoding); + } OutputStream os = response.getOutputStream(); - os.write( stats.getBytes() ); + os.write( stats.getBytes(characterEncoding) ); os.close(); } catch ( IOException e ) Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/CacheInfo.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/CacheInfo.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/CacheInfo.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/CacheInfo.java Sat Mar 29 21:36:24 2014 @@ -40,8 +40,8 @@ public final class CacheInfo * TODO: may have some trouble in failover mode if the cache keeps its old * id. We may need to reset this when moving into failover. */ - protected static VMID vmid = new VMID(); + protected static final VMID vmid = new VMID(); /** By default this is the hashcode of the VMID */ - public static long listenerId = vmid.hashCode(); + public static final long listenerId = vmid.hashCode(); } Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ElementAttributes.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ElementAttributes.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ElementAttributes.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ElementAttributes.java Sat Mar 29 21:36:24 2014 @@ -19,11 +19,6 @@ package org.apache.commons.jcs.engine; * under the License. */ -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; @@ -43,7 +38,7 @@ import org.apache.commons.jcs.engine.con * */ public class ElementAttributes - implements IElementAttributes, Serializable, Cloneable + implements IElementAttributes, Serializable { /** Don't change. */ private static final long serialVersionUID = 7814990748035017441L; @@ -151,42 +146,6 @@ public class ElementAttributes } /** - * Deep clone the attributes. - *

- * @return a clone of these attributes - */ - public Object clone2() - { - try - { - ByteArrayOutputStream baos = new ByteArrayOutputStream( 100 ); - ObjectOutputStream oos = new ObjectOutputStream( baos ); - oos.writeObject( this ); - byte buf[] = baos.toByteArray(); - oos.close(); - - // deserialize byte array into ArrayList - - ByteArrayInputStream bais = new ByteArrayInputStream( buf ); - ObjectInputStream ois = new ObjectInputStream( bais ); - ElementAttributes attr = (ElementAttributes) ois.readObject(); - ois.close(); - - attr.createTime = System.currentTimeMillis(); - return attr; - } - catch ( IOException e ) - { - // swallow - } - catch (ClassNotFoundException e) - { - // swallow - } - return null; - } - - /** * Sets the maxLife attribute of the IAttributes object. *

* @param mls The new MaxLifeSeconds value Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java Sat Mar 29 21:36:24 2014 @@ -109,17 +109,32 @@ public class CompositeCacheConfigurator protected void doConfigure( String configFileName ) { Properties props = new Properties(); + FileInputStream istream = null; + try { - FileInputStream istream = new FileInputStream( configFileName ); + istream = new FileInputStream( configFileName ); props.load( istream ); - istream.close(); } catch ( IOException e ) { log.error( "Could not read configuration file, ignored: " + configFileName, e ); return; } + finally + { + if (istream != null) + { + try + { + istream.close(); + } + catch (IOException e) + { + log.error( "Could not close configuration file " + configFileName, e ); + } + } + } // If we reach here, then the config file is alright. doConfigure( props ); @@ -155,8 +170,8 @@ public class CompositeCacheConfigurator // set default element attr setDefaultElementAttributes( properties ); - // set up ssytem caches to be used by non system caches - // need to make sure there is no circuarity of reference + // set up system caches to be used by non system caches + // need to make sure there is no circularity of reference parseSystemRegions( properties ); // setup preconfigured caches Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java Sat Mar 29 21:36:24 2014 @@ -70,11 +70,8 @@ import org.apache.commons.logging.LogFac * It is recommended that you use the JCS convenience class for all cache access. */ public class CompositeCacheManager - implements IRemoteCacheConstants, Serializable, ICompositeCacheManager, IShutdownObservable, IProvideScheduler + implements IRemoteCacheConstants, ICompositeCacheManager, IShutdownObservable, IProvideScheduler { - /** Don't change */ - private static final long serialVersionUID = 7598584393134401756L; - /** The logger */ protected final static Log log = LogFactory.getLog( CompositeCacheManager.class ); Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/StatElement.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/StatElement.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/StatElement.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/StatElement.java Sat Mar 29 21:36:24 2014 @@ -27,6 +27,9 @@ import org.apache.commons.jcs.engine.sta public class StatElement implements IStatElement { + /** Don't change */ + private static final long serialVersionUID = -2982373725267618092L; + /** name of the stat */ private String name = null; Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/behavior/IStatElement.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/behavior/IStatElement.java?rev=1583059&r1=1583058&r2=1583059&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/behavior/IStatElement.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/stats/behavior/IStatElement.java Sat Mar 29 21:36:24 2014 @@ -1,5 +1,7 @@ package org.apache.commons.jcs.engine.stats.behavior; +import java.io.Serializable; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -22,7 +24,7 @@ package org.apache.commons.jcs.engine.st /** * IAuxiliaryCacheStats will hold these IStatElements. */ -public interface IStatElement +public interface IStatElement extends Serializable { /** * Get the name of the stat element, ex. HitCount