Search in sources :

Example 1 with NewLIFOClockHand

use of org.apache.geode.internal.cache.lru.NewLIFOClockHand 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));
    }
}
Also used : HeapLRUCapacityController(org.apache.geode.internal.cache.lru.HeapLRUCapacityController) LRUAlgorithm(org.apache.geode.internal.cache.lru.LRUAlgorithm) MemLRUCapacityController(org.apache.geode.internal.cache.lru.MemLRUCapacityController) NewLIFOClockHand(org.apache.geode.internal.cache.lru.NewLIFOClockHand) NewLRUClockHand(org.apache.geode.internal.cache.lru.NewLRUClockHand) EvictionAlgorithm(org.apache.geode.cache.EvictionAlgorithm)

Aggregations

EvictionAlgorithm (org.apache.geode.cache.EvictionAlgorithm)1 HeapLRUCapacityController (org.apache.geode.internal.cache.lru.HeapLRUCapacityController)1 LRUAlgorithm (org.apache.geode.internal.cache.lru.LRUAlgorithm)1 MemLRUCapacityController (org.apache.geode.internal.cache.lru.MemLRUCapacityController)1 NewLIFOClockHand (org.apache.geode.internal.cache.lru.NewLIFOClockHand)1 NewLRUClockHand (org.apache.geode.internal.cache.lru.NewLRUClockHand)1