protected synchronized void unlinkEntry(EvictionNode evictionNode) { EvictionNode next = evictionNode.next(); EvictionNode previous = evictionNode.previous(); next.setPrevious(previous); previous.setNext(next); evictionNode.setNext(null); evictionNode.setPrevious(null); decrementSize(); }
/** * Remove and return the head entry in the list */ protected synchronized EvictionNode unlinkHeadEntry() { EvictionNode evictionNode = head.next(); if (evictionNode == tail) { return null; // end of list } unlinkEntry(evictionNode); return evictionNode; }
protected synchronized EvictionNode unlinkTailEntry() { EvictionNode evictionNode = tail.previous(); if (evictionNode == head) { return null; // end of eviction list } unlinkEntry(evictionNode); return evictionNode; }
public EvictionList create() { if (this.controller.getEvictionAlgorithm().isLIFO()) { return new LIFOList(this.controller); } else { if (evictionScanAsync) { return new LRUListWithAsyncSorting(this.controller); } else { return new LRUListWithSyncSorting(this.controller); } } }
@Override public boolean confirmEvictionDestroy(RegionEntry regionEntry) { // We assume here that a LRURegionMap contains LRUEntries EvictableEntry lruRe = (EvictableEntry) regionEntry; if (lruRe.isInUseByTransaction() || lruRe.isDestroyed()) { lruRe.unsetEvicted(); return false; } else { return true; } }
@Override public void close() { getCounters().close(); }
@Override public void closeStats() { getStatistics().close(); }
@Override public long limit() { return getCounters().getLimit(); }
@Override public Statistics getEvictionStatistics() { Statistics result = null; EvictionController evictionController = getEvictionController(); if (evictionController != null) { EvictionCounters es = evictionController.getCounters(); if (es != null) { result = es.getStatistics(); } } return result; }
private void closeOffHeapEvictor() { OffHeapEvictor evictor = this.offHeapEvictor; if (evictor != null) { evictor.close(); } }
private void closeHeapEvictor() { HeapEvictor evictor = this.heapEvictor; if (evictor != null) { evictor.close(); } }
/** * Returns a brief description of this capacity controller. * * @since GemFire 4.0 */ @Override public String toString() { return "MemLRUCapacityController with a capacity of " + this.getLimit() + " megabytes and and eviction action " + this.getEvictionAction(); } }
@Override public int entrySize(Object key, Object value) { // value is null only after eviction occurs. A change in size is // required for eviction stats, bug 30974 if (value == Token.TOMBSTONE) { return 0; } int size = getPerEntryOverhead(); size += sizeof(key); size += sizeof(value); return size; }
/** * Sets the limit on the number of entries allowed. This change takes place on next region * operation that could increase the region size. */ private void setMaximumEntries(int maximumEntries) { if (maximumEntries <= 0) { throw new IllegalArgumentException( "Maximum entries must be positive"); } this.maximumEntries = maximumEntries; getCounters().setLimit(maximumEntries); }
public List<Integer> testOnlyGetSizeOfTasks() { if (isRunning()) { return testTaskSetSizes; } return null; }
@Override public void incGreedyReturns(long greedyReturns) { this.stats.incGreedyReturns(greedyReturns); } }
@Override protected void appendToEvictionList(EvictionList evictionList) { if (evictionList != null) { evictionList.appendEntry(this); } } }
LRUListWithAsyncSorting(EvictionController controller, ExecutorService executor, int maxEvictionAttempts) { super(controller); this.scanThreshold = calculateScanThreshold(); this.executor = executor; this.maxEvictionAttempts = maxEvictionAttempts; }
protected synchronized boolean removeEntry(EvictionNode evictionNode) { if (evictionNode.next() == null) { // not in the list anymore. return false; } unlinkEntry(evictionNode); return true; }
public ExecutorService getEvictorThreadPool() { if (isRunning()) { return evictorThreadPool; } return null; }