/** * Create an <code>lru-heap-percentage</code> eviction controller, assigning * it to the enclosed <code>region-attributes</code> * @param atts */ private void startLRUHeapPercentage(Attributes atts) { final String lruAction = atts.getValue(ACTION); EvictionAction action = EvictionAction.DEFAULT_EVICTION_ACTION; if (lruAction != null) { action = EvictionAction.parseAction(lruAction); } // Store for later addition of ObjectSizer, if any stack.push(EvictionAttributes.createLRUHeapAttributes(null, action)); }
/** * Create an <code>lru-heap-percentage</code> eviction controller, assigning * it to the enclosed <code>region-attributes</code> * @param atts */ private void startLRUHeapPercentage(Attributes atts) { final String lruAction = atts.getValue(ACTION); EvictionAction action = EvictionAction.DEFAULT_EVICTION_ACTION; if (lruAction != null) { action = EvictionAction.parseAction(lruAction); } // Store for later addition of ObjectSizer, if any stack.push(EvictionAttributes.createLRUHeapAttributes(null, action)); }
/** * Because an <code>LRUCapacityController</code> is {@link * Declarable}, it can be initialized with properties. The {@link * #MAXIMUM_ENTRIES "maximum-entries"} (case-sensitive) property can * be used to specify the capacity allowed by this controller. * Other properties in props are ignored. The {@link * #EVICTION_ACTION "eviction-action"} property specifies the action * to be taken when the region has reached its capacity. * * @throws NumberFormatException * The <code>maximum-entries</code> property cannot be * parsed as an integer * @throws IllegalArgumentException * The value of the <code>eviction-action</code> property is * not recoginzed. */ public void init(Properties props) throws NumberFormatException { String prop = null; if ( ( prop = props.getProperty( MAXIMUM_ENTRIES ) ) != null ) { this.maximumEntries = Integer.parseInt( prop ); } if ( ( prop = props.getProperty( EVICTION_ACTION ) ) != null ) { setEvictionAction(EvictionAction.parseAction(prop)); } }
/** * Because an <code>LRUCapacityController</code> is {@link * Declarable}, it can be initialized with properties. The {@link * #MAXIMUM_ENTRIES "maximum-entries"} (case-sensitive) property can * be used to specify the capacity allowed by this controller. * Other properties in props are ignored. The {@link * #EVICTION_ACTION "eviction-action"} property specifies the action * to be taken when the region has reached its capacity. * * @throws NumberFormatException * The <code>maximum-entries</code> property cannot be * parsed as an integer * @throws IllegalArgumentException * The value of the <code>eviction-action</code> property is * not recoginzed. */ public void init(Properties props) throws NumberFormatException { String prop = null; if ( ( prop = props.getProperty( MAXIMUM_ENTRIES ) ) != null ) { this.maximumEntries = Integer.parseInt( prop ); } if ( ( prop = props.getProperty( EVICTION_ACTION ) ) != null ) { setEvictionAction(EvictionAction.parseAction(prop)); } }
/** * Start the configuration of a <code>lru-memory-size</code> eviction controller. Allow * for any of the attributes to be missing. Store the attributes on the stack * anticipating the declaration of an {@link ObjectSizer}. * @param atts */ private void startLRUMemorySize(Attributes atts) { String lruAction = atts.getValue(ACTION); EvictionAction action = EvictionAction.DEFAULT_EVICTION_ACTION; if(lruAction != null){ action = EvictionAction.parseAction(lruAction); } String maximum = atts.getValue(MAXIMUM); int max = MemLRUCapacityController.DEFAULT_MAXIMUM_MEGABYTES; if (maximum != null) { max = parseInt(maximum); } // Store for later addition of ObjectSizer, if any (the cast is for clarity sake) stack.push(EvictionAttributes.createLRUMemoryAttributes(max, null, action)); }
/** * Start the configuration of a <code>lru-memory-size</code> eviction controller. Allow * for any of the attributes to be missing. Store the attributes on the stack * anticipating the declaration of an {@link ObjectSizer}. * @param atts */ private void startLRUMemorySize(Attributes atts) { String lruAction = atts.getValue(ACTION); EvictionAction action = EvictionAction.DEFAULT_EVICTION_ACTION; if(lruAction != null){ action = EvictionAction.parseAction(lruAction); } String maximum = atts.getValue(MAXIMUM); int max = MemLRUCapacityController.DEFAULT_MAXIMUM_MEGABYTES; if (maximum != null) { max = parseInt(maximum); } // Store for later addition of ObjectSizer, if any (the cast is for clarity sake) stack.push(EvictionAttributes.createLRUMemoryAttributes(max, null, action)); }
/** * @param atts */ private void startLRUEntryCount(Attributes atts) { final String maximum = atts.getValue(MAXIMUM); int max = LRUCapacityController.DEFAULT_MAXIMUM_ENTRIES; 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)); }
/** * @param atts */ private void startLRUEntryCount(Attributes atts) { final String maximum = atts.getValue(MAXIMUM); int max = LRUCapacityController.DEFAULT_MAXIMUM_ENTRIES; 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)); }
setEvictionAction(EvictionAction.parseAction(prop));
setEvictionAction(EvictionAction.parseAction(prop));
EvictionAction ea = EvictionAction.parseAction(lruActionOption); if (ea != null) { lruAction = (byte)ea.getValue();
EvictionAction ea = EvictionAction.parseAction(lruActionOption); if (ea != null) { lruAction = (byte)ea.getValue();