@Override public int getMaximum() { if (this.algorithm.isLRUHeap()) { return 0; } return this.maximum; }
/** 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(); }
/** * Dump the attributes which are common across the PR to the string builder. */ 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\toffHeap=").append(getOffHeap()); 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()); }
@Override 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().getOffHeap(); }
sb.append(lineSeparator); if (!getEvictionAttributes().getAlgorithm().isLRUHeap()) { sb.append("lruAction=" + getEvictionAttributes().getAction()); sb.append(lineSeparator);
@Override 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().getOffHeap(); }
lruAction = (byte) EvictionAction.NONE.getValue(); lruLimit = 0; } else if (ea.isLRUHeap()) { lruLimit = 0;
Integer maximum = getMaximum(); if (algorithm.isLRUHeap()) { RegionAttributesType.EvictionAttributes.LruHeapPercentage heapPercentage = new RegionAttributesType.EvictionAttributes.LruHeapPercentage();
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; }
if (!ea.getAlgorithm().isLRUHeap() && ea.getMaximum() != prconfEa.getMaximum()) { logger.warn( "For Partitioned Region {} the locally configured EvictionAttributes {} do not match with other EvictionAttributes {} and may cause misses during reads from VMs with smaller maximums.",
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; }
changeTotalEntrySize(delta); } else if (getEvictionController().getEvictionAlgorithm().isLRUHeap()) { changeTotalEntrySize(delta); try {
if (getEvictionController().getEvictionAlgorithm().isLRUHeap() && _isOwnerALocalRegion() && _getOwner() instanceof BucketRegion && HeapEvictor.EVICT_HIGH_ENTRY_COUNT_BUCKETS_FIRST) {
&& this.getEvictionAttributes().getAlgorithm().isLRUHeap()) { this.sortedBuckets = new ArrayList<BucketRegion>(); this.bucketSorter = LoggingExecutors.newScheduledThreadPool("BucketSorterThread", 1);
public void dump(PrintStream printStream) { String name = getName(); if (isBucket() && !logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY_VERBOSE)) { name = getPrName(); } String msg = name + ":" + " -lru=" + getEvictionAttributes().getAlgorithm(); if (!getEvictionAttributes().getAlgorithm().isNone()) { msg += " -lruAction=" + getEvictionAttributes().getAction(); if (!getEvictionAttributes().getAlgorithm().isLRUHeap()) { msg += " -lruLimit=" + getEvictionAttributes().getMaximum(); } } msg += " -concurrencyLevel=" + getConcurrencyLevel() + " -initialCapacity=" + getInitialCapacity() + " -loadFactor=" + getLoadFactor() + " -offHeap=" + getOffHeap() + " -compressor=" + (getCompressorClassName() == null ? "none" : getCompressorClassName()) + " -statisticsEnabled=" + getStatisticsEnabled(); if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY_VERBOSE)) { msg += " drId=" + getId() + " isBucket=" + isBucket() + " clearEntryId=" + getClearOplogEntryId() + " MyInitializingID=<" + getMyInitializingID() + ">" + " MyPersistentID=<" + getMyPersistentID() + ">" + " onlineMembers=" + getOnlineMembers() + " offlineMembers=" + getOfflineMembers() + " equalsMembers=" + getOfflineAndEqualMembers(); } printStream.println(msg); }
if (getEvictionAttributes().getAlgorithm().isLRUHeap()) { final LogWriter logWriter = this.cache.getLogger(); float evictionPercentage = DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE;
private BiConsumer<Region<?, ?>, Health.Builder> withRegionEvictionPolicyDetails() { return (region, builder) -> { String regionName = region.getName(); Optional.of(region) .filter(this::isRegionAttributesPresent) .map(Region::getAttributes) .map(RegionAttributes::getEvictionAttributes) .ifPresent(evictionAttributes -> { builder.withDetail(cacheRegionEvictionKey(regionName, "action"), String.valueOf(evictionAttributes.getAction())) .withDetail(cacheRegionEvictionKey(regionName, "algorithm"), String.valueOf(evictionAttributes.getAlgorithm())); // NOTE: Careful! Eviction Maximum does not apply when Eviction Algorithm is Heap LRU. Optional.ofNullable(evictionAttributes.getAlgorithm()) .filter(it -> !it.isLRUHeap()) .ifPresent(it -> builder .withDetail(cacheRegionEvictionKey(regionName,"maximum"), evictionAttributes.getMaximum())); }); }; }