Changeset 23ca6b4f


Ignore:
Timestamp:
Sep 25, 2012 7:24:11 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
87295b4
Parents:
9e35596
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/SimpleByteCache.java

    r9e35596 r23ca6b4f  
    1717public final class SimpleByteCache {
    1818
    19     private static final Map<Integer, SimpleByteCache> _caches = new ConcurrentHashMap(8);
     19    private static final ConcurrentHashMap<Integer, SimpleByteCache> _caches = new ConcurrentHashMap(8);
    2020
    2121    private static final int DEFAULT_SIZE = 64;
     
    4646        if (cache == null) {
    4747            cache = new SimpleByteCache(cacheSize, size);
    48             _caches.put(sz, cache);
     48            SimpleByteCache old = _caches.putIfAbsent(sz, cache);
     49            if (old != null)
     50                cache = old;
    4951        }
    5052        cache.resize(cacheSize);
Note: See TracChangeset for help on using the changeset viewer.