/** * Create an <code>lru-entry-count</code> eviction controller, assigning it to the enclosed * <code>region-attributes</code>. Allow any combination of attributes to be provided. Use the * default values for any attribute that is not provided. * */ private void startLRUEntryCount(Attributes atts) { final String maximum = atts.getValue(MAXIMUM); int max = EvictionAttributes.DEFAULT_ENTRIES_MAXIMUM; if (maximum != null) { max = parseInt(maximum); } final String lruAction = atts.getValue(ACTION); EvictionAction action = EvictionAction.DEFAULT_EVICTION_ACTION; if (lruAction != null) { action = EvictionAction.parseAction(lruAction); } RegionAttributesCreation regAttrs = peekRegionAttributesContext(LRU_ENTRY_COUNT); regAttrs.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(max, action)); }
public EvictionAttributes convertToEvictionAttributes() { EvictionAction action = EvictionAction.parseAction(evictionAction); ObjectSizer sizer; if (objectSizer != null) { try { Class<ObjectSizer> sizerClass = (Class<ObjectSizer>) ClassPathLoader.getLatest().forName(objectSizer); sizer = sizerClass.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException( "Unable to instantiate class " + objectSizer + " - " + e.toString()); } } else { sizer = ObjectSizer.DEFAULT; } if (maxMemory == null && maxEntryCount == null) { return EvictionAttributes.createLRUHeapAttributes(sizer, action); } else if (maxMemory != null) { return EvictionAttributes.createLRUMemoryAttributes(maxMemory, sizer, action); } else { return EvictionAttributes.createLRUEntryAttributes(maxEntryCount, action); } } }
.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes( ManagementConstants.NOTIF_REGION_MAX_ENTRIES, EvictionAction.LOCAL_DESTROY));
int capacity = diskProps.getOverFlowCapacity(); factory.setEvictionAttributes( EvictionAttributes.createLRUEntryAttributes(capacity, EvictionAction.OVERFLOW_TO_DISK));
protected static EvictionPolicyMetaData fromDefaults() { return new EvictionPolicyMetaData(EvictionAttributes.createLRUEntryAttributes()); }
protected static EvictionPolicyMetaData fromDefaults() { return new EvictionPolicyMetaData(EvictionAttributes.createLRUEntryAttributes()); }
EvictionAttributes createAttributes() { switch (type) { case HEAP_PERCENTAGE: if (threshold != null) { throw new IllegalArgumentException("HEAP_PERCENTAGE (LRU_HEAP algorithm) does not support threshold (a.k.a. maximum)!"); } return EvictionAttributes.createLRUHeapAttributes(getObjectSizer(), getAction()); case MEMORY_SIZE: return (threshold != null ? EvictionAttributes.createLRUMemoryAttributes(getThreshold(), getObjectSizer(), getAction()) : EvictionAttributes.createLRUMemoryAttributes(getObjectSizer(), getAction())); case ENTRY_COUNT: default: return (threshold != null ? EvictionAttributes.createLRUEntryAttributes(getThreshold(), getAction()) : EvictionAttributes.createLRUEntryAttributes(DEFAULT_LRU_MAXIMUM_ENTRIES, getAction())); } }
EvictionAttributes createAttributes() { switch (type) { case HEAP_PERCENTAGE: if (threshold != null) { throw new IllegalArgumentException("HEAP_PERCENTAGE (LRU_HEAP algorithm) does not support threshold (a.k.a. maximum)!"); } return EvictionAttributes.createLRUHeapAttributes(getObjectSizer(), getAction()); case MEMORY_SIZE: return (threshold != null ? EvictionAttributes.createLRUMemoryAttributes(getThreshold(), getObjectSizer(), getAction()) : EvictionAttributes.createLRUMemoryAttributes(getObjectSizer(), getAction())); case ENTRY_COUNT: default: return (threshold != null ? EvictionAttributes.createLRUEntryAttributes(getThreshold(), getAction()) : EvictionAttributes.createLRUEntryAttributes(DEFAULT_LRU_MAXIMUM_ENTRIES, getAction())); } }