This is an automated email from the ASF dual-hosted git repository.
tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git
The following commit(s) were added to refs/heads/master by this push:
new 37ea469 JCS-212 - Redundant local variable
new e7cb310 Merge pull request #36 from arturobernalg/feature/JCS-212
37ea469 is described below
commit 37ea46990953f06427492ee631fb6a95de835ab4
Author: Arturo Bernal <[email protected]>
AuthorDate: Sun Mar 28 16:51:12 2021 +0200
JCS-212 - Redundant local variable
---
.../jcs3/auxiliary/disk/block/BlockDiskCache.java | 4 +---
.../auxiliary/disk/jdbc/JDBCDiskCacheFactory.java | 6 ++----
.../jcs3/auxiliary/lateral/LateralCacheNoWait.java | 4 +---
.../auxiliary/lateral/LateralCacheNoWaitFacade.java | 4 +---
.../lateral/socket/tcp/LateralTCPCacheFactory.java | 9 ++-------
.../jcs3/auxiliary/remote/RemoteCacheFactory.java | 8 ++------
.../jcs3/auxiliary/remote/RemoteCacheManager.java | 4 +---
.../jcs3/auxiliary/remote/RemoteCacheNoWait.java | 3 +--
.../commons/jcs3/auxiliary/remote/RemoteLocation.java | 3 +--
.../commons/jcs3/auxiliary/remote/RemoteUtils.java | 3 +--
.../remote/http/client/RemoteHttpCacheDispatcher.java | 3 +--
.../remote/http/server/RemoteHttpCacheServlet.java | 5 ++---
.../auxiliary/remote/server/RemoteCacheServer.java | 19 +++++++------------
.../remote/util/RemoteCacheRequestFactory.java | 9 +++------
.../jcs3/engine/control/CompositeCacheManager.java | 4 +---
.../commons/jcs3/utils/config/PropertySetter.java | 3 +--
.../utils/serialization/CompressingSerializer.java | 3 +--
.../serialization/SerializationConversionUtil.java | 5 ++---
.../commons/jcs3/utils/struct/DoubleLinkedList.java | 3 +--
.../jcs3/utils/threadpool/ThreadPoolManager.java | 15 +++++----------
.../java/org/apache/commons/jcs3/jcache/JCSCache.java | 5 ++---
21 files changed, 39 insertions(+), 83 deletions(-)
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCache.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCache.java
index 835b3db..0ae7483 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCache.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskCache.java
@@ -265,7 +265,7 @@ public class BlockDiskCache<K, V>
final Set<K> matchingKeys = getKeyMatcher().getMatchingKeysFromArray(
pattern, keyArray );
- final Map<K, ICacheElement<K, V>> elements = matchingKeys.stream()
+ return matchingKeys.stream()
.collect(Collectors.toMap(
key -> key,
this::processGet)).entrySet().stream()
@@ -273,8 +273,6 @@ public class BlockDiskCache<K, V>
.collect(Collectors.toMap(
Entry::getKey,
Entry::getValue));
-
- return elements;
}
/**
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
index ebd4040..42d7626 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
@@ -222,9 +222,9 @@ public class JDBCDiskCacheFactory
}
- final DataSourceFactory dsFactory =
this.dsFactories.computeIfAbsent(poolName, key -> {
+ return this.dsFactories.computeIfAbsent(poolName, key -> {
final DataSourceFactory newDsFactory;
- JDBCDiskCacheAttributes dsConfig = null;
+ JDBCDiskCacheAttributes dsConfig;
if (cattr.getConnectionPoolName() == null)
{
@@ -260,7 +260,5 @@ public class JDBCDiskCacheFactory
}
return newDsFactory;
});
-
- return dsFactory;
}
}
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 589f9dc..4de8837 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
@@ -168,7 +168,7 @@ public class LateralCacheNoWait<K, V>
{
if ( keys != null && !keys.isEmpty() )
{
- final Map<K, ICacheElement<K, V>> elements = keys.stream()
+ return keys.stream()
.collect(Collectors.toMap(
key -> key,
this::get)).entrySet().stream()
@@ -176,8 +176,6 @@ public class LateralCacheNoWait<K, V>
.collect(Collectors.toMap(
Entry::getKey,
Entry::getValue));
-
- return elements;
}
return new HashMap<>();
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 f432e8d..911caea 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
@@ -236,7 +236,7 @@ public class LateralCacheNoWaitFacade<K, V>
{
if (keys != null && !keys.isEmpty())
{
- final Map<K, ICacheElement<K, V>> elements = keys.stream()
+ return keys.stream()
.collect(Collectors.toMap(
key -> key,
this::get)).entrySet().stream()
@@ -244,8 +244,6 @@ public class LateralCacheNoWaitFacade<K, V>
.collect(Collectors.toMap(
Entry::getKey,
Entry::getValue));
-
- return elements;
}
return new HashMap<>();
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
index 6ab4dfd..e97a1d4 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
@@ -224,8 +224,7 @@ public class LateralTCPCacheFactory
return service;
});
- final ICacheServiceNonLocal<K, V> service =
- (ICacheServiceNonLocal<K, V>)
csnlInstances.computeIfAbsent(key, name -> {
+ return (ICacheServiceNonLocal<K, V>)
csnlInstances.computeIfAbsent(key, name -> {
log.info( "Instance for [{0}] is null, creating", name );
@@ -253,8 +252,6 @@ public class LateralTCPCacheFactory
return zombieService;
}
});
-
- return service;
}
/**
@@ -269,13 +266,11 @@ public class LateralTCPCacheFactory
{
final String key = ilca.getUdpDiscoveryAddr() + ":" +
ilca.getUdpDiscoveryPort();
- final LateralTCPDiscoveryListener ins =
lTCPDLInstances.computeIfAbsent(key, key1 -> {
+ return lTCPDLInstances.computeIfAbsent(key, key1 -> {
log.info("Created new discovery listener for cacheName {0} for
request {1}",
key1, ilca.getCacheName());
return new LateralTCPDiscoveryListener( this.getName(),
cacheManager);
});
-
- return ins;
}
/**
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheFactory.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheFactory.java
index 5ab84b7..a7d9efd 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheFactory.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheFactory.java
@@ -151,10 +151,7 @@ public class RemoteCacheFactory
break;
}
- final RemoteCacheNoWaitFacade<K, V> rcnwf =
- new RemoteCacheNoWaitFacade<>(noWaits, rca, cacheEventLogger,
elementSerializer, this );
-
- return rcnwf;
+ return new RemoteCacheNoWaitFacade<>(noWaits, rca, cacheEventLogger,
elementSerializer, this);
}
// end createCache
@@ -176,9 +173,8 @@ public class RemoteCacheFactory
}
final RemoteLocation loc = cattr.getRemoteLocation();
- final RemoteCacheManager ins = managers.get( loc );
- return ins;
+ return managers.get( loc );
}
/**
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheManager.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheManager.java
index 84fae9a..2a8f8d0 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheManager.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheManager.java
@@ -228,11 +228,9 @@ public class RemoteCacheManager
@SuppressWarnings("unchecked") // Need to cast because of common map for
all caches
public <K, V> RemoteCacheNoWait<K, V> getCache( final
IRemoteCacheAttributes cattr )
{
- final RemoteCacheNoWait<K, V> remoteCacheNoWait =
- (RemoteCacheNoWait<K, V>)
caches.computeIfAbsent(cattr.getCacheName(), key ->
newRemoteCacheNoWait(cattr));
// might want to do some listener sanity checking here.
- return remoteCacheNoWait;
+ return (RemoteCacheNoWait<K, V>)
caches.computeIfAbsent(cattr.getCacheName(), key ->
newRemoteCacheNoWait(cattr));
}
/**
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 517a47f..71c3f99 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
@@ -114,13 +114,12 @@ public class RemoteCacheNoWait<K, V>
private ICacheEventQueue<K, V> createCacheEventQueue( final
IRemoteCacheClient<K, V> client )
{
final CacheEventQueueFactory<K, V> factory = new
CacheEventQueueFactory<>();
- final ICacheEventQueue<K, V> ceq = factory.createCacheEventQueue(
+ return factory.createCacheEventQueue(
new CacheAdaptor<>( client ),
client.getListenerId(),
client.getCacheName(),
client.getAuxiliaryCacheAttributes().getEventQueuePoolName(),
client.getAuxiliaryCacheAttributes().getEventQueueType() );
- return ceq;
}
/**
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteLocation.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteLocation.java
index 00f07c7..4eca121 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteLocation.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteLocation.java
@@ -131,8 +131,7 @@ public final class RemoteLocation
if (match.find() && match.groupCount() == 2)
{
- final RemoteLocation location = new RemoteLocation(
match.group(1), Integer.parseInt( match.group(2) ) );
- return location;
+ return new RemoteLocation( match.group(1), Integer.parseInt(
match.group(2) ) );
}
log.error("Invalid server descriptor: {0}", server);
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteUtils.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteUtils.java
index 4244c91..4125967 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteUtils.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteUtils.java
@@ -256,7 +256,6 @@ public class RemoteUtils
{ // TODO improve this check? See also JCS-133
return "//[" + registryHost.replaceFirst("%", "%25") + "]:" +
registryPort + "/" + serviceName;
}
- final String registryURL = "//" + registryHost + ":" + registryPort +
"/" + serviceName;
- return registryURL;
+ return "//" + registryHost + ":" + registryPort + "/" + serviceName;
}
}
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
index 3a8f14b..1d5ad1e 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
@@ -161,8 +161,7 @@ public class RemoteHttpCacheDispatcher
builder.setEntity(new ByteArrayEntity( requestAsByteArray ));
final HttpResponse httpResponse = doWebserviceCall( builder );
- final byte[] response = EntityUtils.toByteArray(
httpResponse.getEntity() );
- return response;
+ return EntityUtils.toByteArray( httpResponse.getEntity() );
}
/**
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 c0d69b6..0125cf1 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
@@ -287,10 +287,9 @@ public class RemoteHttpCacheServlet
*/
protected ICacheEventLogger configureCacheEventLogger( final Properties
props )
{
- final ICacheEventLogger cacheEventLogger = AuxiliaryCacheConfigurator
- .parseCacheEventLogger( props,
IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX );
- return cacheEventLogger;
+ return AuxiliaryCacheConfigurator
+ .parseCacheEventLogger( props,
IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX );
}
/**
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 291de08..4081a8a 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
@@ -423,8 +423,7 @@ public class RemoteCacheServer<K, V>
final CacheListeners<K, V> cacheDesc = getCacheListeners( cacheName );
- final ICacheElement<K, V> element = getFromCacheListeners( key,
fromCluster, cacheDesc, null );
- return element;
+ return getFromCacheListeners( key, fromCluster, cacheDesc, null );
}
/**
@@ -653,8 +652,7 @@ public class RemoteCacheServer<K, V>
keys, cacheName, requesterId, fromCluster );
final CacheListeners<K, V> cacheDesc = getCacheListeners( cacheName );
- final Map<K, ICacheElement<K, V>> elements =
getMultipleFromCacheListeners( keys, null, fromCluster, cacheDesc );
- return elements;
+ return getMultipleFromCacheListeners( keys, null, fromCluster,
cacheDesc );
}
/**
@@ -1038,12 +1036,11 @@ public class RemoteCacheServer<K, V>
*/
protected CacheListeners<K, V> getCacheListeners( final String cacheName )
{
- final CacheListeners<K, V> cacheListeners =
cacheListenersMap.computeIfAbsent(cacheName, key -> {
+
+ return cacheListenersMap.computeIfAbsent(cacheName, key -> {
final CompositeCache<K, V> cache = cacheManager.getCache(key);
return new CacheListeners<>( cache );
});
-
- return cacheListeners;
}
/**
@@ -1055,12 +1052,11 @@ public class RemoteCacheServer<K, V>
*/
protected CacheListeners<K, V> getClusterListeners( final String cacheName
)
{
- final CacheListeners<K, V> cacheListeners =
clusterListenersMap.computeIfAbsent(cacheName, key -> {
+
+ return clusterListenersMap.computeIfAbsent(cacheName, key -> {
final CompositeCache<K, V> cache = cacheManager.getCache(
cacheName );
return new CacheListeners<>( cache );
});
-
- return cacheListeners;
}
/**
@@ -1504,8 +1500,7 @@ public class RemoteCacheServer<K, V>
*/
protected String getExtraInfoForRequesterId( final long requesterId )
{
- final String ipAddress = idIPMap.get( Long.valueOf( requesterId ) );
- return ipAddress;
+ return idIPMap.get( Long.valueOf( requesterId ) );
}
/**
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/util/RemoteCacheRequestFactory.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/util/RemoteCacheRequestFactory.java
index 97b64ca..4c7c1f9 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/util/RemoteCacheRequestFactory.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/util/RemoteCacheRequestFactory.java
@@ -143,9 +143,8 @@ public class RemoteCacheRequestFactory
*/
public static <K, V> RemoteCacheRequest<K, V> createRemoveAllRequest(
final String cacheName, final long requesterId )
{
- final RemoteCacheRequest<K, V> request = createRequest(cacheName,
RemoteRequestType.REMOVE_ALL, requesterId);
- return request;
+ return createRequest(cacheName, RemoteRequestType.REMOVE_ALL,
requesterId);
}
/**
@@ -157,9 +156,8 @@ public class RemoteCacheRequestFactory
*/
public static <K, V> RemoteCacheRequest<K, V> createDisposeRequest( final
String cacheName, final long requesterId )
{
- final RemoteCacheRequest<K, V> request = createRequest(cacheName,
RemoteRequestType.DISPOSE, requesterId);
- return request;
+ return createRequest(cacheName, RemoteRequestType.DISPOSE,
requesterId);
}
/**
@@ -194,8 +192,7 @@ public class RemoteCacheRequestFactory
*/
public static <K, V> RemoteCacheRequest<K, V> createAliveCheckRequest(
final long requesterId )
{
- final RemoteCacheRequest<K, V> request = createRequest(null,
RemoteRequestType.ALIVE_CHECK, requesterId);
- return request;
+ return createRequest(null, RemoteRequestType.ALIVE_CHECK, requesterId);
}
}
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 80d44a9..9e6a407 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
@@ -547,14 +547,12 @@ public class CompositeCacheManager
{
log.debug( "attr = {0}", attr );
- final CompositeCache<K, V> cache = (CompositeCache<K, V>)
caches.computeIfAbsent(cattr.getCacheName(),
+ return (CompositeCache<K, V>)
caches.computeIfAbsent(cattr.getCacheName(),
cacheName -> {
final CompositeCacheConfigurator configurator = newConfigurator();
return configurator.parseRegion(
this.getConfigurationProperties(), this, cacheName,
this.defaultAuxValues, cattr );
});
-
- return cache;
}
protected CompositeCacheConfigurator newConfigurator() {
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/PropertySetter.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/PropertySetter.java
index 1578843..6f723d0 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/PropertySetter.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/PropertySetter.java
@@ -260,8 +260,7 @@ public class PropertySetter
}
else if( type.isEnum() )
{
- final Enum<?> en = Enum.valueOf(type.asSubclass(Enum.class), v );
- return en;
+ return Enum.valueOf(type.asSubclass(Enum.class), v );
}
else if ( File.class.isAssignableFrom( type ) )
{
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/serialization/CompressingSerializer.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/serialization/CompressingSerializer.java
index b9ffb80..efb7f20 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/serialization/CompressingSerializer.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/serialization/CompressingSerializer.java
@@ -63,8 +63,7 @@ public class CompressingSerializer extends StandardSerializer
throws IOException
{
final byte[] uncompressed = serializer.serialize(obj);
- final byte[] compressed = CompressionUtil.compressByteArray(
uncompressed );
- return compressed;
+ return CompressionUtil.compressByteArray( uncompressed );
}
/**
diff --git
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/serialization/SerializationConversionUtil.java
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/serialization/SerializationConversionUtil.java
index 2f3707d..cc07043 100644
---
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/serialization/SerializationConversionUtil.java
+++
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/serialization/SerializationConversionUtil.java
@@ -84,10 +84,9 @@ public class SerializationConversionUtil
throw e;
}
}
- final ICacheElementSerialized<K, V> serialized = new
CacheElementSerialized<>(
- element.getCacheName(), element.getKey(), serializedValue,
element.getElementAttributes() );
- return serialized;
+ return new CacheElementSerialized<>(
+ element.getCacheName(), element.getKey(), serializedValue,
element.getElementAttributes() );
}
/**
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 86e5830..107d2e6 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
@@ -187,8 +187,7 @@ public class DoubleLinkedList<T extends
DoubleLinkedListNode>
{
me.prev = null;
}
- final T next = (T) me.next;
- me = next;
+ me = (T) me.next;
}
first = last = null;
// make sure this will work, could be add while this is happening.
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 cd94da7..c256bdc 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
@@ -185,11 +185,10 @@ public class ThreadPoolManager
*/
public ScheduledExecutorService createSchedulerPool( final
PoolConfiguration config, final String threadNamePrefix, final int
threadPriority )
{
- final ScheduledExecutorService scheduler =
Executors.newScheduledThreadPool(
- config.getMaximumPoolSize(),
- new DaemonThreadFactory(threadNamePrefix,
threadPriority));
- return scheduler;
+ return Executors.newScheduledThreadPool(
+ config.getMaximumPoolSize(),
+ new DaemonThreadFactory(threadNamePrefix, threadPriority));
}
/**
@@ -250,13 +249,11 @@ public class ThreadPoolManager
*/
public ExecutorService getExecutorService( final String name )
{
- final ExecutorService pool = pools.computeIfAbsent(name, key -> {
+ return pools.computeIfAbsent(name, key -> {
log.debug( "Creating pool for name [{0}]", key );
final PoolConfiguration config = loadConfig( PROP_NAME_ROOT + "."
+ key, defaultConfig );
return createPool( config, "JCS-ThreadPoolManager-" + key + "-" );
});
-
- return pool;
}
/**
@@ -270,14 +267,12 @@ public class ThreadPoolManager
*/
public ScheduledExecutorService getSchedulerPool( final String name )
{
- final ScheduledExecutorService pool =
schedulerPools.computeIfAbsent(name, key -> {
+ return schedulerPools.computeIfAbsent(name, key -> {
log.debug( "Creating scheduler pool for name [{0}]", key );
final PoolConfiguration config = loadConfig(
PROP_NAME_SCHEDULER_ROOT + "." + key,
defaultSchedulerConfig );
return createSchedulerPool( config, "JCS-ThreadPoolManager-" + key
+ "-", Thread.NORM_PRIORITY );
});
-
- return pool;
}
/**
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 6bde9aa..004420d 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
@@ -468,10 +468,9 @@ public class JCSCache<K, V> implements Cache<K, V>
final long start = Times.now(!statisticsEnabled);
writer.delete(key);
- final K cacheKey = key;
- final ICacheElement<K, V> v = delegate.get(cacheKey);
- delegate.remove(cacheKey);
+ final ICacheElement<K, V> v = delegate.get(key);
+ delegate.remove(key);
final V value = v != null && v.getVal() != null ? v.getVal() : null;
final boolean remove = v != null;