Merge pull request #18 from arturobernalg/feature/minor_improvements
Minor Improvements:
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/JCS.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/JCS.java
index 4dc25b5..56dd1b8 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/JCS.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/JCS.java
@@ -41,10 +41,10 @@
public abstract class JCS
{
/** cache.ccf alternative. */
- private static String configFilename = null;
+ private static String configFilename;
/** alternative configuration properties */
- private static Properties configProps = null;
+ private static Properties configProps;
/** Cache manager use by the various forms of defineRegion and getAccess */
private static CompositeCacheManager cacheMgr;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/AbstractDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/AbstractDiskCache.java
index b3aca70..f4a59b7 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/AbstractDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/AbstractDiskCache.java
@@ -64,7 +64,7 @@
private static final Log log = LogManager.getLog( AbstractDiskCache.class );
/** Generic disk cache attributes */
- private IDiskCacheAttributes diskCacheAttributes = null;
+ private final IDiskCacheAttributes diskCacheAttributes;
/**
* Map where elements are stored between being added to this cache and actually spooled to disk.
@@ -86,13 +86,13 @@
* Indicates whether the cache is 'alive': initialized, but not yet disposed. Child classes must
* set this to true.
*/
- private boolean alive = false;
+ private boolean alive;
/** Every cache will have a name, subclasses must set this when they are initialized. */
private final String cacheName;
/** DEBUG: Keeps a count of the number of purgatory hits for debug messages */
- private int purgHits = 0;
+ private int purgHits;
/**
* We lock here, so that we cannot get an update after a remove all. an individual removal locks
@@ -553,7 +553,7 @@
implements ICacheListener<K, V>
{
/** Id of the listener */
- private long listenerId = 0;
+ private long listenerId;
/**
* @return cacheElement.getElementAttributes();
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/PurgatoryElement.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/PurgatoryElement.java
index f7fa6f5..3f14c13 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/PurgatoryElement.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/PurgatoryElement.java
@@ -36,7 +36,7 @@
private static final long serialVersionUID = -8152034342684135628L;
/** Is the element ready to be spooled? */
- private boolean spoolable = false;
+ private boolean spoolable;
/** Wrapped cache Element */
private final ICacheElement<K, V> cacheElement;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java
index 42dd314..bb4519f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java
@@ -403,8 +403,8 @@
public final static String TAG = "orig-lru-size";
// size of the content in kB
- private AtomicInteger contentSize;
- private int maxSize;
+ private final AtomicInteger contentSize;
+ private final int maxSize;
/**
* Default
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
index 92cb591..0d5f1c4 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
@@ -97,19 +97,19 @@
private boolean isShutdownOptimizationEnabled = true;
/** are we currently optimizing the files */
- private boolean isOptimizing = false;
+ private boolean isOptimizing;
/** The number of times the file has been optimized. */
- private int timesOptimized = 0;
+ private int timesOptimized;
/** The thread optimizing the file. */
private volatile Thread currentOptimizationThread;
/** used for counting the number of requests */
- private int removeCount = 0;
+ private int removeCount;
/** Should we queue puts. True when optimizing. We write the queue post optimization. */
- private boolean queueInput = false;
+ private boolean queueInput;
/** list where puts made during optimization are made */
private final ConcurrentSkipListSet<IndexedDiskElementDescriptor> queuedPutList;
@@ -121,10 +121,10 @@
private final IndexedDiskCacheAttributes cattr;
/** How many slots have we recycled. */
- private int recycleCnt = 0;
+ private int recycleCnt;
/** How many items were there on startup. */
- private int startupSize = 0;
+ private int startupSize;
/** the number of bytes free on disk. */
private final AtomicLong bytesFree = new AtomicLong(0);
@@ -1533,8 +1533,8 @@
public static final String TAG = "orig";
// size of the content in kB
- private AtomicInteger contentSize;
- private int maxSize;
+ private final AtomicInteger contentSize;
+ private final int maxSize;
/**
* Default
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java
index d55f352..b425a61 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java
@@ -103,7 +103,7 @@
private static final int LOG_INTERVAL = 100;
/** db connection pool */
- private DataSourceFactory dsFactory = null;
+ private final DataSourceFactory dsFactory;
/** tracks optimization */
private TableState tableState;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java
index 92009b4..1905f9c 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java
@@ -54,7 +54,7 @@
private String jndiPath;
/** The time between two JNDI lookups */
- private long jndiTTL = 0L;
+ private long jndiTTL;
/** The table name */
private String tableName = DEFAULT_TABLE_NAME;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
index 830b42c..975f68f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java
@@ -48,7 +48,7 @@
public class JndiDataSourceFactory implements DataSourceFactory
{
/** The log. */
- private static Log log = LogManager.getLog(JndiDataSourceFactory.class);
+ private static final Log log = LogManager.getLog(JndiDataSourceFactory.class);
/** The name of the factory. */
private String name;
@@ -60,13 +60,13 @@
private Context ctx;
/** A locally cached copy of the DataSource */
- private DataSource ds = null;
+ private DataSource ds;
/** Time of last actual lookup action */
- private long lastLookup = 0;
+ private long lastLookup;
/** Time between two lookups */
- private long ttl = 0; // ms
+ private long ttl; // ms
/**
* @return the name of the factory.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java
index 7fff446..43f3d3b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java
@@ -42,13 +42,13 @@
public class SharedPoolDataSourceFactory implements DataSourceFactory
{
/** The log. */
- private static Log log = LogManager.getLog(SharedPoolDataSourceFactory.class);
+ private static final Log log = LogManager.getLog(SharedPoolDataSourceFactory.class);
/** The name of the factory. */
private String name;
/** The wrapped <code>DataSource</code>. */
- private SharedPoolDataSource ds = null;
+ private SharedPoolDataSource ds;
/**
* @return the name of the factory.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheAttributes.java
index 3325714..ca61e14 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheAttributes.java
@@ -41,7 +41,7 @@
* <p>
* 03:01,15:00 will cause the optimizer to run at 3 am and at 3 pm.
*/
- private String optimizationSchedule = null;
+ private String optimizationSchedule;
/**
* If true, we will balk, that is return null during optimization rather than block.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java
index ab78af4..aa5b566 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java
@@ -46,10 +46,10 @@
private static final Log log = LogManager.getLog( MySQLTableOptimizer.class );
/** The data source */
- private DataSource dataSource = null;
+ private final DataSource dataSource;
/** The name of the table. */
- private String tableName = null;
+ private String tableName;
/** optimizing, etc. */
private final TableState tableState;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWait.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWait.java
index 8aba713..cc9e05b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWait.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWait.java
@@ -62,13 +62,13 @@
private ICacheEventQueue<K, V> eventQueue;
/** times get called */
- private int getCount = 0;
+ private int getCount;
/** times remove called */
- private int removeCount = 0;
+ private int removeCount;
/** times put called */
- private int putCount = 0;
+ private int putCount;
/**
* Constructs with the given lateral cache, and fires up an event queue for asynchronous
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java
index 0ba977a..a64bb5f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java
@@ -69,7 +69,7 @@
private final ILateralCacheAttributes lateralCacheAttributes;
/** Disposed state of this facade */
- private boolean disposed = false;
+ private boolean disposed;
/**
* Constructs with the given lateral cache, and fires events to any listeners.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java
index 801f511..c99e7f2 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java
@@ -82,13 +82,13 @@
private ExecutorService pooledExecutor;
/** put count */
- private int putCnt = 0;
+ private int putCnt;
/** remove count */
- private int removeCnt = 0;
+ private int removeCnt;
/** get count */
- private int getCnt = 0;
+ private int getCnt;
/**
* Use the vmid by default. This can be set for testing. If we ever need to run more than one
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java
index acac70d..769a472 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java
@@ -51,7 +51,7 @@
private Socket socket;
/** how many messages sent */
- private int sendCnt = 0;
+ private int sendCnt;
/** Use to synchronize multiple threads that may be trying to get. */
private final Object getLock = new int[0];
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPService.java
index 5173b83..36a7c64 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPService.java
@@ -54,7 +54,7 @@
private final boolean issueRemoveOnPut;
/** Sends to another lateral. */
- private LateralTCPSender sender;
+ private final LateralTCPSender sender;
/** use the vmid by default */
private long listenerId = CacheInfo.listenerId;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
index 935dc45..be1122c 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
@@ -67,7 +67,7 @@
private String tcpServer = "";
/** The port */
- private int tcpListenerPort = 0;
+ private int tcpListenerPort;
/** The host */
private String tcpListenerHost = "";
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/AbstractRemoteAuxiliaryCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
index f4a7d1e..a178b9f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
@@ -77,10 +77,10 @@
private IRemoteCacheAttributes remoteCacheAttributes;
/** A thread pool for gets if configured. */
- private ExecutorService pool = null;
+ private ExecutorService pool;
/** Should we get asynchronously using a pool. */
- private boolean usePoolForGet = false;
+ private boolean usePoolForGet;
/**
* Creates the base.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/AbstractRemoteCacheListener.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/AbstractRemoteCacheListener.java
index 1db3bcb..6eaf2b9 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/AbstractRemoteCacheListener.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/AbstractRemoteCacheListener.java
@@ -42,7 +42,7 @@
private static final Log log = LogManager.getLog( AbstractRemoteCacheListener.class );
/** The cached name of the local host. The remote server gets this for logging purposes. */
- private static String localHostName = null;
+ private static String localHostName;
/**
* The cache manager used to put items in different regions. This is set lazily and should not
@@ -54,7 +54,7 @@
private final IRemoteCacheAttributes irca;
/** This is set by the remote cache server. */
- private long listenerId = 0;
+ private long listenerId;
/** Custom serializer. */
private final IElementSerializer elementSerializer;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/CommonRemoteCacheAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/CommonRemoteCacheAttributes.java
index a0960f5..f85bf71 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/CommonRemoteCacheAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/CommonRemoteCacheAttributes.java
@@ -50,10 +50,10 @@
private boolean removeUponRemotePut = true;
/** Can we receive from or put to the remote. this probably shouldn't be used. Use receive. */
- private boolean getOnly = false;
+ private boolean getOnly;
/** Should we put and get from the clusters. */
- private boolean localClusterConsistency = false;
+ private boolean localClusterConsistency;
/** read and connect timeout */
private int rmiSocketFactoryTimeoutMillis = DEFAULT_RMI_SOCKET_FACTORY_TIMEOUT_MILLIS;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheAttributes.java
index 3637f60..7204f1e 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheAttributes.java
@@ -41,10 +41,10 @@
private String failoverServers = "";
/** callback */
- private int localPort = 0;
+ private int localPort;
/** what failover server we are connected to. */
- private int failoverIndex = 0;
+ private int failoverIndex;
/** List of failover server addresses */
private List<RemoteLocation> failovers;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheListener.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheListener.java
index 64fbfc8..6d6974e 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheListener.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheListener.java
@@ -45,7 +45,7 @@
private static final Log log = LogManager.getLog( RemoteCacheListener.class );
/** Has this client been shutdown. */
- private boolean disposed = false;
+ private boolean disposed;
/**
* Only need one since it does work for all regions, just reference by multiple region names.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheNoWait.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheNoWait.java
index 01d47cb..dfdc0ec 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheNoWait.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheNoWait.java
@@ -76,19 +76,19 @@
private ICacheEventQueue<K, V> cacheEventQueue;
/** how many times get has been called. */
- private int getCount = 0;
+ private int getCount;
/** how many times getMatching has been called. */
- private int getMatchingCount = 0;
+ private int getMatchingCount;
/** how many times getMultiple has been called. */
- private int getMultipleCount = 0;
+ private int getMultipleCount;
/** how many times remove has been called. */
- private int removeCount = 0;
+ private int removeCount;
/** how many times put has been called. */
- private int putCount = 0;
+ private int putCount;
/**
* Constructs with the given remote cache, and fires up an event queue for asynchronous
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/AbstractHttpClient.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/AbstractHttpClient.java
index d9a01c7..a060146 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/AbstractHttpClient.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/AbstractHttpClient.java
@@ -43,7 +43,7 @@
private final HttpClient httpClient;
/** The protocol version */
- private HttpVersion httpVersion;
+ private final HttpVersion httpVersion;
/** Configuration settings. */
private final RemoteHttpCacheAttributes remoteHttpCacheAttributes;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheClient.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheClient.java
index 76b33a4..5f84bd7 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheClient.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheClient.java
@@ -48,7 +48,7 @@
private RemoteHttpCacheAttributes remoteHttpCacheAttributes;
/** Set to true when initialize is called */
- private boolean initialized = false;
+ private boolean initialized;
/** For factory construction. */
public RemoteHttpCacheClient()
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
index 2644672..f0ec7ab 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
@@ -38,7 +38,7 @@
private final ConcurrentHashMap<RemoteHttpCache<?, ?>, RemoteHttpCache<?, ?>> remoteHttpCaches;
/** Factory instance */
- private RemoteHttpCacheFactory factory = null;
+ private final RemoteHttpCacheFactory factory;
/**
* Constructor for the RemoteCacheMonitor object
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/AbstractRemoteCacheService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/AbstractRemoteCacheService.java
index 3ee7f4c..b11dcfd 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/AbstractRemoteCacheService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/AbstractRemoteCacheService.java
@@ -51,7 +51,7 @@
private String eventLogSourceName = "AbstractRemoteCacheService";
/** Number of puts into the cache. */
- private int puts = 0;
+ private int puts;
/** The interval at which we will log updates. */
private final int logInterval = 100;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/RemoteHttpCacheServlet.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
index daa93bc..9aba440 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/RemoteHttpCacheServlet.java
@@ -74,7 +74,7 @@
private final StandardSerializer serializer = new StandardSerializer();
/** Number of service calls. */
- private int serviceCalls = 0;
+ private int serviceCalls;
/** The interval at which we will log the count. */
private final int logInterval = 100;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServer.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServer.java
index 6f6aede..79fa7ea 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServer.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServer.java
@@ -80,7 +80,7 @@
private static final Log log = LogManager.getLog( RemoteCacheServer.class );
/** Number of puts into the cache. */
- private int puts = 0;
+ private int puts;
/** Maps cache name to CacheListeners object. association of listeners (regions). */
private final transient ConcurrentMap<String, CacheListeners<K, V>> cacheListenersMap =
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerAttributes.java
index c8587f1..bda89e4 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerAttributes.java
@@ -33,7 +33,7 @@
private static final long serialVersionUID = -2741662082869155365L;
/** port the server will listen to */
- private int servicePort = 0;
+ private int servicePort;
/** Can a cluster remote get from other remotes */
private boolean allowClusterGet = true;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerFactory.java
index 4a2ae88..bb4a0a9 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerFactory.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerFactory.java
@@ -65,7 +65,7 @@
private static ScheduledExecutorService keepAliveDaemon;
/** A reference to the registry. */
- private static Registry registry = null;
+ private static Registry registry;
/** Constructor for the RemoteCacheServerFactory object. */
private RemoteCacheServerFactory()
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheStartupServlet.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheStartupServlet.java
index d949047..21d44bf 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheStartupServlet.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheStartupServlet.java
@@ -84,7 +84,7 @@
private int registryPort = DEFAULT_REGISTRY_PORT;
/** Configuration properties */
- private String registryHost = null;
+ private String registryHost;
/**
* Starts the registry and then tries to bind to it.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/value/RemoteCacheRequest.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/value/RemoteCacheRequest.java
index fdb903f..c5be34c 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/value/RemoteCacheRequest.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/value/RemoteCacheRequest.java
@@ -37,10 +37,10 @@
private static final long serialVersionUID = -8858447417390442569L;
/** The request type specifies the type of request: get, put, remove, . . */
- private RemoteRequestType requestType = null;
+ private RemoteRequestType requestType;
/** Used to identify the source. Same as listener id on the client side. */
- private long requesterId = 0;
+ private long requesterId;
/** The name of the region */
private String cacheName;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/AbstractCacheEventQueue.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/AbstractCacheEventQueue.java
index 48f28f4..6055a82 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/AbstractCacheEventQueue.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/AbstractCacheEventQueue.java
@@ -206,7 +206,7 @@
protected abstract class AbstractCacheEvent implements Runnable
{
/** Number of failures encountered processing this event. */
- int failures = 0;
+ int failures;
/**
* Main processing method for the AbstractCacheEvent object
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/CacheAdaptor.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/CacheAdaptor.java
index 8b43b9d..dfdb3c4 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/CacheAdaptor.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/CacheAdaptor.java
@@ -36,7 +36,7 @@
private final ICache<K, V> cache;
/** The unique id of this listener. */
- private long listenerId = 0;
+ private long listenerId;
/**
* Sets the listenerId attribute of the CacheAdaptor object
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/ElementAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/ElementAttributes.java
index badc117..e35a234 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/ElementAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/ElementAttributes.java
@@ -68,13 +68,13 @@
private long maxIdleTime = -1;
/** The byte size of the field. Must be manually set. */
- private int size = 0;
+ private int size;
/** The creation time. This is used to enforce the max life. */
- private long createTime = 0;
+ private long createTime;
/** The last access time. This is used to enforce the max idel time. */
- private long lastAccessTime = 0;
+ private long lastAccessTime;
/**
* The list of Event handlers to use. This is transient, since the event handlers cannot usually
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/PooledCacheEventQueue.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/PooledCacheEventQueue.java
index 0e86b49..5460ca7 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/PooledCacheEventQueue.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/PooledCacheEventQueue.java
@@ -53,10 +53,10 @@
private static final QueueType queueType = QueueType.POOLED;
/** The Thread Pool to execute events with. */
- protected ExecutorService pool = null;
+ protected ExecutorService pool;
/** The Thread Pool queue */
- protected BlockingQueue<Runnable> queue = null;
+ protected BlockingQueue<Runnable> queue;
/**
* Constructor for the CacheEventQueue object
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/ZombieCacheServiceNonLocal.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/ZombieCacheServiceNonLocal.java
index e312b01..7cb5dde 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/ZombieCacheServiceNonLocal.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/ZombieCacheServiceNonLocal.java
@@ -49,7 +49,7 @@
private static final Log log = LogManager.getLog( ZombieCacheServiceNonLocal.class );
/** How big can the queue grow. */
- private int maxQueueSize = 0;
+ private int maxQueueSize;
/** The queue */
private final ConcurrentLinkedQueue<ZombieEvent> queue;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java
index a7ca90f..011fce1 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java
@@ -113,7 +113,7 @@
private final AtomicLong missCountExpired;
/** Cache manager. */
- private CompositeCacheManager cacheManager = null;
+ private CompositeCacheManager cacheManager;
/**
* The cache hub can only have one memory cache. This could be made more flexible in the future,
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java
index 67b6dea..beaccd4 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java
@@ -139,13 +139,13 @@
private Thread shutdownHook;
/** Indicates whether the instance has been initialized. */
- private boolean isInitialized = false;
+ private boolean isInitialized;
/** Indicates whether configure has been called. */
- private boolean isConfigured = false;
+ private boolean isConfigured;
/** Indicates whether JMX bean has been registered. */
- private boolean isJMXRegistered = false;
+ private boolean isJMXRegistered;
private String jmxName = JMX_OBJECT_NAME;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/event/ElementEventQueue.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/event/ElementEventQueue.java
index 4b6a2b4..e59c611 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/event/ElementEventQueue.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/event/ElementEventQueue.java
@@ -43,7 +43,7 @@
private static final Log log = LogManager.getLog( ElementEventQueue.class );
/** shutdown or not */
- private boolean destroyed = false;
+ private boolean destroyed;
/** The worker thread pool. */
private ExecutorService queueProcessor;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/memory/shrinking/ShrinkerThread.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/memory/shrinking/ShrinkerThread.java
index 55272eb..89db6e9 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/memory/shrinking/ShrinkerThread.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/memory/shrinking/ShrinkerThread.java
@@ -50,7 +50,7 @@
private final int maxSpoolPerRun;
/** Should we limit the number spooled per run. If so, the maxSpoolPerRun will be used. */
- private boolean spoolLimit = false;
+ private boolean spoolLimit;
/**
* Constructor for the ShrinkerThread object.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/CacheStats.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/CacheStats.java
index 64a8df7..bf32a03 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/CacheStats.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/CacheStats.java
@@ -37,10 +37,10 @@
private static final long serialVersionUID = 529914708798168590L;
/** The region */
- private String regionName = null;
+ private String regionName;
/** What that auxiliaries are reporting. */
- private List<IStats> auxStats = null;
+ private List<IStats> auxStats;
/**
* Stats are for a region, though auxiliary data may be for more.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/StatElement.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/StatElement.java
index b4169f2..b7b92d2 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/StatElement.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/StatElement.java
@@ -31,10 +31,10 @@
private static final long serialVersionUID = -2982373725267618092L;
/** name of the stat */
- private String name = null;
+ private String name;
/** the data */
- private V data = null;
+ private V data;
/**
* Constructor
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/Stats.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/Stats.java
index 4e86ed7..262d892 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/Stats.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/stats/Stats.java
@@ -34,10 +34,10 @@
private static final long serialVersionUID = 227327902875154010L;
/** The stats */
- private List<IStatElement<?>> stats = null;
+ private List<IStatElement<?>> stats;
/** The type of stat */
- private String typeName = null;
+ private String typeName;
/**
* @return IStatElement[]
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/Log.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/Log.java
index 649a0e3..8ce41ef 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/Log.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/Log.java
@@ -24,7 +24,7 @@
* All logging operations, except configuration, are done through this interface.
*
* <p>
- * The canonical way to obtain a Logger for a class is through {@link LogManager#getLog()}.
+ * The canonical way to obtain a Logger for a class is through {@link LogManager#getLog(String)}}.
* Typically, each class should get its own Log named after its fully qualified class name
* </p>
*
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/LogManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/LogManager.java
index 942cf2d..34128eb 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/LogManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/LogManager.java
@@ -30,7 +30,7 @@
/**
* The name of log subsystem
*/
- private static String logSystem = null;
+ private static String logSystem;
/** Log systems currently known */
public static final String LOGSYSTEM_JAVA_UTIL_LOGGING = "jul";
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/MessageFormatter.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/MessageFormatter.java
index 1a50f74..8c93f05 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/MessageFormatter.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/MessageFormatter.java
@@ -29,7 +29,7 @@
public class MessageFormatter
{
private final String messagePattern;
- private transient Object[] parameters;
+ private final transient Object[] parameters;
private transient String formattedMessage;
private transient Throwable throwable;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/access/JCSWorker.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/access/JCSWorker.java
index e3545c8..96cd113 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/access/JCSWorker.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/access/JCSWorker.java
@@ -97,15 +97,15 @@
private static final Log logger = LogManager.getLog( JCSWorker.class );
/** The cache we are working with */
- private CacheAccess<K, V> cache;
+ private final CacheAccess<K, V> cache;
/** The cache we are working with */
- private GroupCacheAccess<K, V> groupCache;
+ private final GroupCacheAccess<K, V> groupCache;
/**
* Map to hold who's doing work presently.
*/
- private volatile ConcurrentMap<String, JCSWorkerHelper<V>> map = new ConcurrentHashMap<>();
+ private final ConcurrentMap<String, JCSWorkerHelper<V>> map = new ConcurrentHashMap<>();
/**
* Region for the JCS cache.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/DiscoveredService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/DiscoveredService.java
index a64a179..a39d5cc 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/DiscoveredService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/DiscoveredService.java
@@ -45,7 +45,7 @@
private int servicePort;
/** last time we heard from this service? */
- private long lastHearFromTime = 0;
+ private long lastHearFromTime;
/**
* @param cacheNames the cacheNames to set
@@ -148,13 +148,8 @@
{
return false;
}
- if (servicePort != other.servicePort)
- {
- return false;
- }
-
- return true;
- }
+ return servicePort == other.servicePort;
+ }
/**
* @return string for debugging purposes.
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryAttributes.java
index e832152..8fe7c7d 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryAttributes.java
@@ -53,13 +53,13 @@
private String udpDiscoveryAddr = DEFAULT_UDP_DISCOVERY_ADDRESS;
/** udp discovery network interface */
- private String udpDiscoveryInterface = null;
+ private String udpDiscoveryInterface;
/** udp discovery port */
private int udpDiscoveryPort = DEFAULT_UDP_DISCOVERY_PORT;
/** udp datagram TTL */
- private int udpTTL = 0;
+ private int udpTTL;
/** default delay between sending passive broadcasts */
private static final int DEFAULT_SEND_DELAY_SEC = 60;
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryManager.java
index 5bd9c28..1d51838 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryManager.java
@@ -39,7 +39,7 @@
private static final Log log = LogManager.getLog( UDPDiscoveryManager.class );
/** Singleton instance */
- private static UDPDiscoveryManager INSTANCE = new UDPDiscoveryManager();
+ private static final UDPDiscoveryManager INSTANCE = new UDPDiscoveryManager();
/** Known services */
private final ConcurrentMap<String, UDPDiscoveryService> services = new ConcurrentHashMap<>();
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryReceiver.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryReceiver.java
index 27f8b04..3f03ca5 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryReceiver.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryReceiver.java
@@ -72,7 +72,7 @@
private final InetAddress multicastAddress;
/** Is it shutdown. */
- private boolean shutdown = false;
+ private boolean shutdown;
/**
* Constructor for the LateralUDPReceiver object.
@@ -274,7 +274,7 @@
implements Runnable
{
/** The message to handle. Passed in during construction. */
- private UDPDiscoveryMessage message = null;
+ private final UDPDiscoveryMessage message;
/**
* @param message
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryService.java
index ad530d2..3f324aa 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryService.java
@@ -57,13 +57,13 @@
private UDPDiscoveryReceiver receiver;
/** the runnable that sends messages via the clock daemon */
- private UDPDiscoverySenderThread sender = null;
+ private final UDPDiscoverySenderThread sender;
/** attributes */
- private UDPDiscoveryAttributes udpDiscoveryAttributes = null;
+ private UDPDiscoveryAttributes udpDiscoveryAttributes;
/** is this shut down? */
- private boolean shutdown = false;
+ private boolean shutdown;
/** This is a set of services that have been discovered. */
private final Set<DiscoveredService> discoveredServices = new CopyOnWriteArraySet<>();
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/struct/AbstractLRUMap.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/struct/AbstractLRUMap.java
index 26a0d6b..b1a247d 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/struct/AbstractLRUMap.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/struct/AbstractLRUMap.java
@@ -67,13 +67,13 @@
private final Lock lock = new ReentrantLock();
/** stats */
- private long hitCnt = 0;
+ private long hitCnt;
/** stats */
- private long missCnt = 0;
+ private long missCnt;
/** stats */
- private long putCnt = 0;
+ private long putCnt;
/**
* This creates an unbounded version. Setting the max objects will result in spooling on
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/struct/DoubleLinkedList.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/struct/DoubleLinkedList.java
index c209034..86e5830 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/struct/DoubleLinkedList.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/struct/DoubleLinkedList.java
@@ -30,7 +30,7 @@
public class DoubleLinkedList<T extends DoubleLinkedListNode>
{
/** record size to avoid having to iterate */
- private int size = 0;
+ private int size;
/** The logger */
private static final Log log = LogManager.getLog( DoubleLinkedList.class );
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java
index d454e99..cd94da7 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java
@@ -80,7 +80,7 @@
* You can specify the properties to be used to configure the thread pool. Setting this post
* initialization will have no effect.
*/
- private static volatile Properties props = null;
+ private static volatile Properties props;
/** Map of names to pools. */
private final ConcurrentHashMap<String, ExecutorService> pools;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/JCSLightLoadUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/JCSLightLoadUnitTest.java
index f9b7396..274027b 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/JCSLightLoadUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/JCSLightLoadUnitTest.java
@@ -30,7 +30,7 @@
extends TestCase
{
/** number to use for the test */
- private static int items = 20000;
+ private static final int items = 20000;
/**
* Test setup
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/JCSvsHashtablePerformanceTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/JCSvsHashtablePerformanceTest.java
index 16fa449..44a2063 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/JCSvsHashtablePerformanceTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/JCSvsHashtablePerformanceTest.java
@@ -38,10 +38,10 @@
extends TestCase
{
/** jcs / hashtable */
- float ratioPut = 0;
+ float ratioPut;
/** jcs / hashtable */
- float ratioGet = 0;
+ float ratioGet;
/** ration goal */
float target = 3.50f;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/TestTCPLateralCache.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/TestTCPLateralCache.java
index 0c11012..6a8226e 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/TestTCPLateralCache.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/TestTCPLateralCache.java
@@ -38,7 +38,7 @@
* Number of items to cache, twice the configured maxObjects for the memory
* cache regions.
*/
- private static int items = 200;
+ private static final int items = 200;
/**
* Constructor for the TestTCPLateralCache object.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/ZeroSizeCacheUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/ZeroSizeCacheUnitTest.java
index 1a6fd43..adad87c 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/ZeroSizeCacheUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/ZeroSizeCacheUnitTest.java
@@ -32,7 +32,7 @@
extends TestCase
{
/** number to get each loop */
- private static int items = 20000;
+ private static final int items = 20000;
/**
* Test setup
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/access/TestCacheAccess.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/access/TestCacheAccess.java
index 8186410..779d5ea 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/access/TestCacheAccess.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/access/TestCacheAccess.java
@@ -46,13 +46,13 @@
private static final Log log = LogManager.getLog( TestCacheAccess.class );
/** cache instance to use in testing */
- private CacheAccess<String, String> cache_control = null;
+ private CacheAccess<String, String> cache_control;
/** cache instance to use in testing */
- private GroupCacheAccess<String, String> group_cache_control = null;
+ private GroupCacheAccess<String, String> group_cache_control;
/** do we use system.out.println to print out debug data? */
- private static boolean isSysOut = false;
+ private static boolean isSysOut;
/** Construct and initialize the cachecontrol based on the config file. */
public TestCacheAccess()
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/MockAuxiliaryCache.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/MockAuxiliaryCache.java
index 2803f78..d695e19 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/MockAuxiliaryCache.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/MockAuxiliaryCache.java
@@ -43,7 +43,7 @@
public CacheStatus status = CacheStatus.ALIVE;
/** Times getMatching was Called */
- public int getMatchingCallCount = 0;
+ public int getMatchingCallCount;
/**
* @param ce
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/MockCacheEventLogger.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/MockCacheEventLogger.java
index e094781..8efb021 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/MockCacheEventLogger.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/MockCacheEventLogger.java
@@ -34,16 +34,16 @@
implements ICacheEventLogger
{
/** times called */
- public int applicationEventCalls = 0;
+ public int applicationEventCalls;
/** times called */
- public int startICacheEventCalls = 0;
+ public int startICacheEventCalls;
/** times called */
- public int endICacheEventCalls = 0;
+ public int endICacheEventCalls;
/** times called */
- public int errorEventCalls = 0;
+ public int errorEventCalls;
/** list of messages */
public List<String> errorMessages = new ArrayList<>();
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java
index 03c7a44..2d13165 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java
@@ -42,7 +42,7 @@
* Number of items to cache, twice the configured maxObjects for the memory
* cache regions.
*/
- private static int items = 200;
+ private static final int items = 200;
/**
* Constructor for the TestDiskCache object.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java
index b827b60..01cbd1a 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java
@@ -41,10 +41,10 @@
private static final String LOG_DIVIDER = "---------------------------";
/** the runtime. */
- private static Runtime rt = Runtime.getRuntime();
+ private static final Runtime rt = Runtime.getRuntime();
/** The decimal format to use int he logs. */
- private static DecimalFormat format = new DecimalFormat( "#,###" );
+ private static final DecimalFormat format = new DecimalFormat( "#,###" );
/**
* Insert 2000 wait 1 second, repeat. Average 1000 / sec.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java
index 18016cd..6d84878 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java
@@ -44,7 +44,7 @@
* Number of items to cache, twice the configured maxObjects for the memory
* cache regions.
*/
- private static int items = 200;
+ private static final int items = 200;
/**
* Constructor for the TestDiskCache object.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java
index 6e540c1..ead24bf 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java
@@ -47,10 +47,10 @@
private static final int LOG_INCREMENT = 5000;
/** for getting memory usage */
- private static Runtime rt = Runtime.getRuntime();
+ private static final Runtime rt = Runtime.getRuntime();
/** for displaying memory usage */
- private static DecimalFormat format = new DecimalFormat( "#,###" );
+ private static final DecimalFormat format = new DecimalFormat( "#,###" );
/**
* @throws Exception
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java
index 709c3e2..acbbe0c 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java
@@ -43,7 +43,7 @@
* Number of items to cache; the configured maxObjects for the memory cache
* regions is 0.
*/
- private static int items = 2000;
+ private static final int items = 2000;
/**
* @param testName
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java
index 292e510..b96e6d5 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java
@@ -42,10 +42,10 @@
private static final String LOG_DIVIDER = "---------------------------";
/** For getting memory info */
- private static Runtime rt = Runtime.getRuntime();
+ private static final Runtime rt = Runtime.getRuntime();
/** For display */
- private static DecimalFormat format = new DecimalFormat( "#,###" );
+ private static final DecimalFormat format = new DecimalFormat( "#,###" );
/**
* Insert 2000 wait 1 second, repeat. Average 1000 / sec.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/LRUMapSizeVsCount.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/LRUMapSizeVsCount.java
index 9b84e29..ef9d34c 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/LRUMapSizeVsCount.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/indexed/LRUMapSizeVsCount.java
@@ -36,10 +36,10 @@
extends TestCase
{
/** The put put ration after the test */
- double ratioPut = 0;
+ double ratioPut;
/** The ratio after the test */
- double ratioGet = 0;
+ double ratioGet;
/** put size / count ratio */
float targetPut = 1.2f;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDataSourceFactoryUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDataSourceFactoryUnitTest.java
index 4564665..bdfbbe4 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDataSourceFactoryUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDataSourceFactoryUnitTest.java
@@ -146,7 +146,7 @@
/* For JNDI mocking */
public static class MockInitialContextFactory implements InitialContextFactory
{
- private static Context context;
+ private static final Context context;
static
{
@@ -154,7 +154,7 @@
{
context = new InitialContext(true)
{
- Map<String, Object> bindings = new HashMap<>();
+ final Map<String, Object> bindings = new HashMap<>();
@Override
public void bind(final String name, final Object obj) throws NamingException
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java
index 2518567..885e7d8 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java
@@ -41,7 +41,7 @@
/**
* Number of items to cache, twice the configured maxObjects for the memory cache regions.
*/
- private static int items = 100;
+ private static final int items = 100;
/**
* Constructor for the TestDiskCache object.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java
index c2c7a85..b6ba254 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java
@@ -35,7 +35,7 @@
extends TestCase
{
/** Should we write out. */
- private static boolean isSysOut = false;
+ private static final boolean isSysOut = false;
//private static boolean isSysOut = true;
/**
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java
index bccd146..4eec002 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java
@@ -35,7 +35,7 @@
extends TestCase
{
/** Does the test print to system out. */
- private static boolean isSysOut = false;
+ private static final boolean isSysOut = false;
/** The port the server will listen to. */
private final int serverPort = 2001;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java
index 068d315..88bb9ad 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java
@@ -36,7 +36,7 @@
extends TestCase
{
/** Should log data go to system out. */
- private static boolean isSysOut = false;
+ private static final boolean isSysOut = false;
/** The port the server will listen to. */
private final int serverPort = 1118;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheClientTester.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheClientTester.java
index 1eeaaef..197e493 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheClientTester.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheClientTester.java
@@ -60,7 +60,7 @@
final int count;
/** Description of the Field */
- protected static long listenerId = 0;
+ protected static long listenerId;
/**
* Gets the remoteType attribute of the RemoteCacheClientTest object
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheManualTester.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheManualTester.java
index 838edf5..0af08bd 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheManualTester.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheManualTester.java
@@ -29,7 +29,7 @@
extends TestCase
{
/** number to use for the test */
- private static int items = 100;
+ private static final int items = 100;
/**
* Test setup
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
index 7c066a8..eec4129 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
@@ -58,12 +58,12 @@
/**
* Server instance to use in the tests.
*/
- private static RemoteCacheServer<String, String> server = null;
+ private static RemoteCacheServer<String, String> server;
/**
* Factory instance to use in the tests.
*/
- private static RemoteCacheFactory factory = null;
+ private static RemoteCacheFactory factory;
/**
* the remote server port
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/EventQueueConcurrentLoadTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/EventQueueConcurrentLoadTest.java
index 47bc46e..248fb18 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/EventQueueConcurrentLoadTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/EventQueueConcurrentLoadTest.java
@@ -38,10 +38,10 @@
extends TestCase
{
/** The queue implementation */
- private static CacheEventQueue<String, String> queue = null;
+ private static CacheEventQueue<String, String> queue;
/** The mock listener */
- private static CacheListenerImpl<String, String> listen = null;
+ private static CacheListenerImpl<String, String> listen;
/** max failure setting */
private final int maxFailure = 3;
@@ -269,12 +269,12 @@
/**
* <code>putCount</code>
*/
- protected int putCount = 0;
+ protected int putCount;
/**
* <code>removeCount</code>
*/
- protected int removeCount = 0;
+ protected int removeCount;
/**
* @param item
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/SystemPropertyUsageUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/SystemPropertyUsageUnitTest.java
index 9f075fd..60827d4 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/SystemPropertyUsageUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/SystemPropertyUsageUnitTest.java
@@ -37,7 +37,7 @@
private static final String JCS_DEFAULT_CACHEATTRIBUTES_MAX_OBJECTS = "jcs.default.cacheattributes.MaxObjects";
private static final int testValue = 6789;
- private CompositeCacheManager manager = null;
+ private CompositeCacheManager manager;
@Override
protected void setUp() throws Exception
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/CompositeCacheDiskUsageUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/CompositeCacheDiskUsageUnitTest.java
index 4855f75..3117f25 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/CompositeCacheDiskUsageUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/CompositeCacheDiskUsageUnitTest.java
@@ -326,7 +326,7 @@
public ICacheElement<K, V> lastUpdatedItem;
/** The number of times update was called. */
- public int updateCount = 0;
+ public int updateCount;
/** The type that should be returned from getCacheType. */
public CacheType cacheType = CacheType.DISK_CACHE;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/MockElementSerializer.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/MockElementSerializer.java
index 49c27b6..288cde3 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/MockElementSerializer.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/MockElementSerializer.java
@@ -35,10 +35,10 @@
private final StandardSerializer serializer = new StandardSerializer();
/** times out was called */
- public int deSerializeCount = 0;
+ public int deSerializeCount;
/** times in was called */
- public int serializeCount = 0;
+ public int serializeCount;
/**
* @param bytes
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/event/ElementEventHandlerMockImpl.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/event/ElementEventHandlerMockImpl.java
index 5916b85..db4a655 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/event/ElementEventHandlerMockImpl.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/event/ElementEventHandlerMockImpl.java
@@ -32,25 +32,25 @@
implements IElementEventHandler
{
/** Times called. */
- private int callCount = 0;
+ private int callCount;
/** The logger */
private static final Log log = LogManager.getLog( ElementEventHandlerMockImpl.class );
/** ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE */
- private int spoolCount = 0;
+ private int spoolCount;
/** ELEMENT_EVENT_SPOOLED_NOT_ALLOWED */
- private int spoolNotAllowedCount = 0;
+ private int spoolNotAllowedCount;
/** ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE */
- private int spoolNoDiskCount = 0;
+ private int spoolNoDiskCount;
/** ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND */
- private int exceededMaxLifeBackgroundCount = 0;
+ private int exceededMaxLifeBackgroundCount;
/** ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND */
- private int exceededIdleTimeBackgroundCount = 0;
+ private int exceededIdleTimeBackgroundCount;
/**
* @param event
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/event/SimpleEventHandlingUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/event/SimpleEventHandlingUnitTest.java
index a2504d8..5d3c11e 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/event/SimpleEventHandlingUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/control/event/SimpleEventHandlingUnitTest.java
@@ -35,7 +35,7 @@
extends TestCase
{
/** Items to test with */
- private static int items = 20000;
+ private static final int items = 20000;
/**
* Test setup with expected configuration parameters.
@@ -281,19 +281,19 @@
implements IElementEventHandler
{
/** times spool called */
- private int spoolCount = 0;
+ private int spoolCount;
/** times spool not allowed */
- private int spoolNotAllowedCount = 0;
+ private int spoolNotAllowedCount;
/** times spool without disk */
- private int spoolNoDiskCount = 0;
+ private int spoolNoDiskCount;
/** times exceeded maxlife */
- private int exceededMaxlifeCount = 0;
+ private int exceededMaxlifeCount;
/** times exceeded idle time */
- private int exceededIdletimeCount = 0;
+ private int exceededIdletimeCount;
/**
* @param event
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/MockMemoryCache.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/MockMemoryCache.java
index 36f8ae4..38c3841 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/MockMemoryCache.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/MockMemoryCache.java
@@ -47,10 +47,10 @@
private final HashMap<K, ICacheElement<K, V>> map = new HashMap<>();
/** The number of times waterfall was called. */
- public int waterfallCallCount = 0;
+ public int waterfallCallCount;
/** The number passed to the last call of free elements. */
- public int lastNumberOfFreedElements = 0;
+ public int lastNumberOfFreedElements;
/**
* Does nothing
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java
index a5341c5..9673993 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java
@@ -43,7 +43,7 @@
* Number of items to cache, twice the configured maxObjects for the memory
* cache regions.
*/
- private static int items = 200;
+ private static final int items = 200;
/**
* Constructor for the TestDiskCache object.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
index ed43bc8..d2b4cbd 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
@@ -43,7 +43,7 @@
* Number of items to cache, twice the configured maxObjects for the memory
* cache regions.
*/
- private static int items = 200;
+ private static final int items = 200;
/**
* Constructor for the TestDiskCache object.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/mru/LRUvsMRUPerformanceTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/mru/LRUvsMRUPerformanceTest.java
index 4c6de19..6d14abe 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/mru/LRUvsMRUPerformanceTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/engine/memory/mru/LRUvsMRUPerformanceTest.java
@@ -34,10 +34,10 @@
extends TestCase
{
/** ration we want */
- float ratioPut = 0;
+ float ratioPut;
/** ration we want */
- float ratioGet = 0;
+ float ratioGet;
/** ration we want */
float target = 1.20f;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/access/JCSWorkerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/access/JCSWorkerUnitTest.java
index 250f474..c923712 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/access/JCSWorkerUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/access/JCSWorkerUnitTest.java
@@ -49,7 +49,7 @@
// This is the helper.
final JCSWorkerHelper<Long> helper = new AbstractJCSWorkerHelper<Long>()
{
- int timesCalled = 0;
+ int timesCalled;
@Override
public Long doWork()
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/JCSvsCommonsLRUMapPerformanceTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/JCSvsCommonsLRUMapPerformanceTest.java
index 4b52ccc..3bac7b6 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/JCSvsCommonsLRUMapPerformanceTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/JCSvsCommonsLRUMapPerformanceTest.java
@@ -34,10 +34,10 @@
extends TestCase
{
/** jcs / commons */
- float ratioPut = 0;
+ float ratioPut;
/** jcs / commons */
- float ratioGet = 0;
+ float ratioGet;
/** goal */
float target = 1.0f;
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/LRUMapConcurrentUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/LRUMapConcurrentUnitTest.java
index 3140a31..4318863 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/LRUMapConcurrentUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/LRUMapConcurrentUnitTest.java
@@ -54,7 +54,7 @@
extends TestCase
{
/** number to test with */
- private static int items = 20000;
+ private static final int items = 20000;
/**
* Constructor for the TestSimpleLoad object
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/LRUMapPerformanceTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/LRUMapPerformanceTest.java
index db29f2e..0ff3339 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/LRUMapPerformanceTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/utils/struct/LRUMapPerformanceTest.java
@@ -34,10 +34,10 @@
extends TestCase
{
/** The put put ration after the test */
- float ratioPut = 0;
+ float ratioPut;
/** The ratio after the test */
- float ratioGet = 0;
+ float ratioGet;
/** put jcs / commons ratio */
float targetPut = 1.2f;
diff --git a/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/cdi/ExtraJCacheExtension.java b/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/cdi/ExtraJCacheExtension.java
index 75a7c3d..8acf092 100644
--- a/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/cdi/ExtraJCacheExtension.java
+++ b/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/cdi/ExtraJCacheExtension.java
@@ -34,8 +34,8 @@
{
private static final boolean ACTIVATED = "true".equals(System.getProperty("org.apache.jcs.extra.cdi", "true"));
- private boolean cacheManagerFound = false;
- private boolean cacheProviderFound = false;
+ private boolean cacheManagerFound;
+ private boolean cacheProviderFound;
private CacheManager cacheManager;
private CachingProvider cachingProvider;
diff --git a/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/web/InMemoryResponse.java b/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/web/InMemoryResponse.java
index 92cc770..cc11e76 100644
--- a/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/web/InMemoryResponse.java
+++ b/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/web/InMemoryResponse.java
@@ -42,7 +42,7 @@
private final Collection<Cookie> cookies = new CopyOnWriteArraySet<>();
private final Map<String, List<Serializable>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
private int status = SC_OK;
- private String contentType = null;
+ private String contentType;
private PrintWriter writer;
private int contentLength;
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java
index cf10908..a5cd1b1 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java
@@ -80,7 +80,7 @@
private final ObjectName cacheConfigObjectName;
private final ObjectName cacheStatsObjectName;
private final String name;
- private volatile boolean closed = false;
+ private volatile boolean closed;
private final Map<CacheEntryListenerConfiguration<K, V>, JCSListener<K, V>> listeners = new ConcurrentHashMap<>();
private final Statistics statistics = new Statistics();
private final ExecutorService pool;
@@ -857,7 +857,7 @@
final Iterator<K> keys = new HashSet<>(delegate.getKeySet()).iterator();
return new Iterator<Entry<K, V>>()
{
- private K lastKey = null;
+ private K lastKey;
@Override
public boolean hasNext()
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java
index 0e47b9b..7df782d 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java
@@ -25,6 +25,7 @@
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
@@ -96,7 +97,7 @@
private final Properties properties;
private final ConcurrentMap<String, Cache<?, ?>> caches = new ConcurrentHashMap<>();
private final Properties configProperties;
- private volatile boolean closed = false;
+ private volatile boolean closed;
private final InternalManager delegate = InternalManager.create();
public JCSCachingManager(final CachingProvider provider, final URI uri, final ClassLoader loader, final Properties properties)
@@ -125,7 +126,7 @@
final Enumeration<URL> resources = loader.getResources(uri.getPath());
if (!resources.hasMoreElements()) // default
{
- props.load(new ByteArrayInputStream(DEFAULT_CONFIG.getBytes("UTF-8")));
+ props.load(new ByteArrayInputStream(DEFAULT_CONFIG.getBytes(StandardCharsets.UTF_8)));
}
else
{
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/TempStateCacheView.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/TempStateCacheView.java
index b4aca4a..87049bf 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/TempStateCacheView.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/TempStateCacheView.java
@@ -44,8 +44,8 @@
private final JCSCache<K, V> cache;
private final Map<K, V> put = new HashMap<>();
private final Collection<K> remove = new LinkedList<>();
- private boolean removeAll = false;
- private boolean clear = false;
+ private boolean removeAll;
+ private boolean clear;
public TempStateCacheView(final JCSCache<K, V> entries)
{
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java
index 14476e0..d01d0d5 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java
@@ -55,7 +55,7 @@
private static final Logger LOGGER = Logger.getLogger(CDIJCacheHelper.class.getName());
private static final boolean CLOSE_CACHE = !Boolean.getBoolean("org.apache.commons.jcs3.jcache.cdi.skip-close");
- private volatile CacheResolverFactoryImpl defaultCacheResolverFactory = null; // lazy to not create any cache if not needed
+ private volatile CacheResolverFactoryImpl defaultCacheResolverFactory; // lazy to not create any cache if not needed
private final CacheKeyGeneratorImpl defaultCacheKeyGenerator = new CacheKeyGeneratorImpl();
private final Collection<CreationalContext<?>> toRelease = new ArrayList<>();
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheInvocationContextImpl.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheInvocationContextImpl.java
index a6aef50..c4b776e 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheInvocationContextImpl.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheInvocationContextImpl.java
@@ -30,7 +30,7 @@
{
private static final Object[] EMPTY_ARGS = new Object[0];
- private CacheInvocationParameter[] parameters = null;
+ private CacheInvocationParameter[] parameters;
public CacheInvocationContextImpl(final InvocationContext delegate, final A cacheAnnotation, final String cacheName,
final CDIJCacheHelper.MethodMeta meta)
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheKeyInvocationContextImpl.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheKeyInvocationContextImpl.java
index a0c0a52..11b65ea 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheKeyInvocationContextImpl.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheKeyInvocationContextImpl.java
@@ -26,8 +26,8 @@
public class CacheKeyInvocationContextImpl<A extends Annotation> extends CacheInvocationContextImpl<A> implements CacheKeyInvocationContext<A>
{
- private CacheInvocationParameter[] keyParams = null;
- private CacheInvocationParameter valueParam = null;
+ private CacheInvocationParameter[] keyParams;
+ private CacheInvocationParameter valueParam;
public CacheKeyInvocationContextImpl(final InvocationContext delegate, final A annotation, final String name,
final CDIJCacheHelper.MethodMeta methodMeta)
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/jmx/ConfigurableMBeanServerIdBuilder.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/jmx/ConfigurableMBeanServerIdBuilder.java
index 5bc04bc..29660d6 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/jmx/ConfigurableMBeanServerIdBuilder.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/jmx/ConfigurableMBeanServerIdBuilder.java
@@ -31,7 +31,7 @@
public class ConfigurableMBeanServerIdBuilder extends MBeanServerBuilder
{
- private static ConcurrentMap<Key, MBeanServer> JVM_SINGLETONS = new ConcurrentHashMap<>();
+ private static final ConcurrentMap<Key, MBeanServer> JVM_SINGLETONS = new ConcurrentHashMap<>();
private static class Key
{
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/lang/Subsitutor.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/lang/Subsitutor.java
index 3e07545..9f1e044 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/lang/Subsitutor.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/lang/Subsitutor.java
@@ -23,7 +23,7 @@
{
String substitute(String value);
- public static class Helper {
+ class Helper {
public static final Subsitutor INSTANCE;
static {
Subsitutor value = null;