fix wrong initialization of mem evictions counter
This commit is contained in:
parent
1e84c439e5
commit
7874291c0e
|
@ -46,7 +46,7 @@ public class SoftFilterCache extends AbstractConcurrentMapFilterCache implements
|
||||||
private final TimeValue expire;
|
private final TimeValue expire;
|
||||||
|
|
||||||
private final AtomicLong evictions = new AtomicLong();
|
private final AtomicLong evictions = new AtomicLong();
|
||||||
private final AtomicLong memEvictions = new AtomicLong();
|
private AtomicLong memEvictions;
|
||||||
|
|
||||||
@Inject public SoftFilterCache(Index index, @IndexSettings Settings indexSettings) {
|
@Inject public SoftFilterCache(Index index, @IndexSettings Settings indexSettings) {
|
||||||
super(index, indexSettings);
|
super(index, indexSettings);
|
||||||
|
@ -55,6 +55,7 @@ public class SoftFilterCache extends AbstractConcurrentMapFilterCache implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected ConcurrentMap<Object, ReaderValue> buildCache() {
|
@Override protected ConcurrentMap<Object, ReaderValue> buildCache() {
|
||||||
|
memEvictions = new AtomicLong(); // we need to init it here, since its called from the super constructor
|
||||||
// better to have soft on the whole ReaderValue, simpler on the GC to clean it
|
// better to have soft on the whole ReaderValue, simpler on the GC to clean it
|
||||||
MapMaker mapMaker = new MapMaker().weakKeys().softValues();
|
MapMaker mapMaker = new MapMaker().weakKeys().softValues();
|
||||||
mapMaker.evictionListener(new CacheMapEvictionListener(memEvictions));
|
mapMaker.evictionListener(new CacheMapEvictionListener(memEvictions));
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class WeakFilterCache extends AbstractConcurrentMapFilterCache implements
|
||||||
private final TimeValue expire;
|
private final TimeValue expire;
|
||||||
|
|
||||||
private final AtomicLong evictions = new AtomicLong();
|
private final AtomicLong evictions = new AtomicLong();
|
||||||
private final AtomicLong memEvictions = new AtomicLong();
|
private AtomicLong memEvictions;
|
||||||
|
|
||||||
@Inject public WeakFilterCache(Index index, @IndexSettings Settings indexSettings) {
|
@Inject public WeakFilterCache(Index index, @IndexSettings Settings indexSettings) {
|
||||||
super(index, indexSettings);
|
super(index, indexSettings);
|
||||||
|
@ -55,6 +55,7 @@ public class WeakFilterCache extends AbstractConcurrentMapFilterCache implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected ConcurrentMap<Object, ReaderValue> buildCache() {
|
@Override protected ConcurrentMap<Object, ReaderValue> buildCache() {
|
||||||
|
memEvictions = new AtomicLong(); // we need to init it here, since its called from the super constructor
|
||||||
// better to have weak on the whole ReaderValue, simpler on the GC to clean it
|
// better to have weak on the whole ReaderValue, simpler on the GC to clean it
|
||||||
MapMaker mapMaker = new MapMaker().weakKeys().softValues();
|
MapMaker mapMaker = new MapMaker().weakKeys().softValues();
|
||||||
mapMaker.evictionListener(new CacheMapEvictionListener(memEvictions));
|
mapMaker.evictionListener(new CacheMapEvictionListener(memEvictions));
|
||||||
|
|
Loading…
Reference in New Issue