mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
WW-5355 Prevent AtomicInteger being initialised to zero
This commit is contained in:
@@ -30,10 +30,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public class OgnlDefaultCache<Key, Value> implements OgnlCache<Key, Value> {
|
||||
|
||||
private final ConcurrentHashMap<Key, Value> ognlCache;
|
||||
private final AtomicInteger cacheEvictionLimit = new AtomicInteger();
|
||||
private final AtomicInteger cacheEvictionLimit;
|
||||
|
||||
public OgnlDefaultCache(int evictionLimit, int initialCapacity, float loadFactor) {
|
||||
cacheEvictionLimit.set(evictionLimit);
|
||||
cacheEvictionLimit = new AtomicInteger(evictionLimit);
|
||||
ognlCache = new ConcurrentHashMap<>(initialCapacity, loadFactor);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public class OgnlLRUCache<Key, Value> implements OgnlCache<Key, Value> {
|
||||
|
||||
private final Map<Key, Value> ognlLRUCache;
|
||||
private final AtomicInteger cacheEvictionLimit = new AtomicInteger();
|
||||
private final AtomicInteger cacheEvictionLimit;
|
||||
|
||||
public OgnlLRUCache(int evictionLimit, int initialCapacity, float loadFactor) {
|
||||
cacheEvictionLimit.set(evictionLimit);
|
||||
cacheEvictionLimit = new AtomicInteger(evictionLimit);
|
||||
// Access-order mode selected (order mode true in LinkedHashMap constructor).
|
||||
ognlLRUCache = Collections.synchronizedMap (new LinkedHashMap<Key, Value>(initialCapacity, loadFactor, true) {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user