use of org.apache.geode.internal.cache.lru.HeapLRUCapacityController in project geode by apache.
the class AbstractLRURegionMap method initialize.
protected void initialize(Object owner, Attributes attr, InternalRegionArguments internalRegionArgs) {
super.initialize(owner, attr, internalRegionArgs, true);
EvictionAlgorithm ea;
LRUAlgorithm ec;
if (owner instanceof LocalRegion) {
ea = ((LocalRegion) owner).getEvictionAttributes().getAlgorithm();
ec = ((LocalRegion) owner).getEvictionController();
} else if (owner instanceof PlaceHolderDiskRegion) {
PlaceHolderDiskRegion phdr = (PlaceHolderDiskRegion) owner;
ea = phdr.getActualLruAlgorithm();
ec = phdr.getEvictionAttributes().createEvictionController(null, phdr.getOffHeap());
} else {
throw new IllegalStateException("expected LocalRegion or PlaceHolderDiskRegion");
}
this.evictionController = ec;
if (ea.isLRUMemory()) {
((MemLRUCapacityController) ec).setEntryOverHead(getEntryOverHead());
}
if (ea.isLRUHeap()) {
((HeapLRUCapacityController) ec).setEntryOverHead(getEntryOverHead());
}
_setCCHelper(getHelper(ec));
/*
* modification for LIFO Logic incubation
*
*/
if (ea == EvictionAlgorithm.LIFO_ENTRY || ea == EvictionAlgorithm.LIFO_MEMORY) {
_setLruList(new NewLIFOClockHand(owner, _getCCHelper(), internalRegionArgs));
} else {
_setLruList(new NewLRUClockHand(owner, _getCCHelper(), internalRegionArgs));
}
}
Aggregations