Skip to content

Commit

Permalink
WW-5355 Prevent AtomicInteger being initialised to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
kusalk committed Oct 15, 2023
1 parent 74d2fdc commit 5011a79
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
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
Expand Down

0 comments on commit 5011a79

Please sign in to comment.