@Override public int getMaximum() { if (this.algorithm.isLRUHeap()) { throw new UnsupportedOperationException("LRUHeap does not support a maximum"); } return this.maximum; }
@Override public int getMaximum() { if (this.algorithm.isLRUHeap()) { throw new UnsupportedOperationException("LRUHeap does not support a maximum"); } return this.maximum; }
/** returns true if this object uses a least-recently-used algorithm */ public boolean isLRU() { return this.isLRUEntry() || this.isLRUMemory() || this.isLRUHeap(); }
/** returns true if this object uses a least-recently-used algorithm */ public boolean isLRU() { return this.isLRUEntry() || this.isLRUMemory() || this.isLRUHeap(); }
@Override public String toString() { final StringBuilder buffer = new StringBuilder(128); buffer.append(" algorithm=").append(this.getAlgorithm()); if (!this.getAlgorithm().isNone()) { buffer.append("; action=").append(this.getAction()); if (!getAlgorithm().isLRUHeap()) { buffer.append("; maximum=").append(this.getMaximum()); } if (this.getObjectSizer() != null) { buffer.append("; sizer=").append(this.getObjectSizer()); } } return buffer.toString(); }
@Override public String toString() { final StringBuilder buffer = new StringBuilder(128); buffer.append(" algorithm=").append(this.getAlgorithm()); if (!this.getAlgorithm().isNone()) { buffer.append("; action=").append(this.getAction()); if (!getAlgorithm().isLRUHeap()) { buffer.append("; maximum=").append(this.getMaximum()); } if (this.getObjectSizer() != null) { buffer.append("; sizer=").append(this.getObjectSizer()); } } return buffer.toString(); }
/** * Dump the attributes which are common across the PR to the string builder. * @param msg */ public void dumpCommonAttributes(StringBuilder msg) { msg.append("\n\tlru=").append(getEvictionAttributes().getAlgorithm()); if (!getEvictionAttributes().getAlgorithm().isNone()) { msg.append("\n\tlruAction=").append(getEvictionAttributes().getAction()); if (!getEvictionAttributes().getAlgorithm().isLRUHeap()) { msg.append("\n\tlruLimit=").append(getEvictionAttributes().getMaximum()); } } msg.append("\n\tconcurrencyLevel=").append(getConcurrencyLevel()); msg.append("\n\tinitialCapacity=").append(getInitialCapacity()); msg.append("\n\tloadFactor=").append(getLoadFactor()); msg.append("\n\tstatisticsEnabled=").append(getStatisticsEnabled()); msg.append("\n\tdrId=").append(getId()); msg.append("\n\tisBucket=").append(isBucket()); msg.append("\n\tclearEntryId=").append(getClearOplogEntryId()); msg.append("\n\tflags=").append(getFlags()); }
protected boolean includeLocalRegion(LocalRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && region.getAttributes().getOffHeap()); }
protected boolean includeLocalRegion(LocalRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && region.getAttributes().getEnableOffHeapMemory()); }
protected boolean includeLocalRegion(LocalRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && !region.getAttributes().getOffHeap()); }
protected boolean includeLocalRegion(LocalRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && !region.getAttributes().getEnableOffHeapMemory()); }
protected boolean includePartitionedRegion(PartitionedRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && (region.getDataStore() != null) && !region.getAttributes().getOffHeap()); }
protected boolean includePartitionedRegion(PartitionedRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && (region.getDataStore() != null) && !region.getAttributes().getEnableOffHeapMemory()); }
protected boolean includePartitionedRegion(PartitionedRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && (region.getDataStore() != null) && region.getAttributes().getEnableOffHeapMemory()); }
protected boolean includePartitionedRegion(PartitionedRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && (region.getDataStore() != null) && region.getAttributes().getOffHeap()); }
@Override public final int hashCode() { if (getAlgorithm().isLRUHeap()) { return getAlgorithm().hashCode(); } else { return this.getAlgorithm().hashCode() ^ this.getMaximum(); } }
public int getSizeForEviction() { EvictionAttributes ea = this.getAttributes().getEvictionAttributes(); if (ea == null) return 0; EvictionAlgorithm algo = ea.getAlgorithm(); if (!algo.isLRUHeap()) return 0; EvictionAction action = ea.getAction(); int size = action.isLocalDestroy() ? this.getRegionMap().sizeInVM() : (int)this .getNumEntriesInVM(); return size; } @Override
public int getSizeForEviction() { EvictionAttributes ea = this.getAttributes().getEvictionAttributes(); if (ea == null) return 0; EvictionAlgorithm algo = ea.getAlgorithm(); if (!algo.isLRUHeap()) return 0; EvictionAction action = ea.getAction(); int size = action.isLocalDestroy() ? this.getRegionMap().sizeInVM() : (int)this .getNumEntriesInVM(); return size; } @Override
public static EvictionAttributesData getEvictionAttributesData(RegionAttributes regAttrs) { String algorithm = ""; Integer maximum = null; if (regAttrs.getEvictionAttributes().getAlgorithm() != null) { algorithm = regAttrs.getEvictionAttributes().getAlgorithm().toString(); if (algorithm.equals(EvictionAlgorithm.NONE.toString())) { EvictionAttributesData evictionAttributesData = new EvictionAttributesData(algorithm, null, EvictionAlgorithm.NONE.toString()); return evictionAttributesData; } if (!regAttrs.getEvictionAttributes().getAlgorithm().isLRUHeap()) { maximum = regAttrs.getEvictionAttributes().getMaximum(); } } String action = regAttrs.getEvictionAttributes().getAction().toString(); EvictionAttributesData evictionAttributesData = new EvictionAttributesData(algorithm, maximum, action); return evictionAttributesData; }
/** * Constructor for the LRUStatistics object * * @param name Description of the Parameter */ public LRUStatistics( StatisticsFactory factory, String name, EnableLRU helper) { String statName = helper.getStatisticsName() + "-" + name; stats = factory.createAtomicStatistics(helper.getStatisticsType(), statName); if(!helper.getEvictionAlgorithm().isLRUHeap()) { limitId = helper.getLimitStatId(); } destroysLimitId = helper.getDestroysLimitStatId(); counterId = helper.getCountStatId(); evictionsId = helper.getEvictionsStatId(); destroysId = helper.getDestroysStatId(); this.evaluationsId = helper.getEvaluationsStatId(); this.greedyReturnsId = helper.getGreedyReturnsStatId(); }