@Override public void setRegionAttributes(String id, RegionAttributes attrs) { RegionAttributes a = attrs; if (!(a instanceof RegionAttributesCreation)) { a = new RegionAttributesCreation(this, a, false); } this.namedRegionAttributes.put(id, a); this.regionAttributesNames.add(id); }
private void startDynamicRegionFactory(Attributes atts) { // push attributes onto the stack for processing in endDynamicRegionFactory String disablePersist = atts.getValue(DISABLE_PERSIST_BACKUP); if (disablePersist == null) { stack.push("false"); } else { stack.push(disablePersist); } String disableRegisterInterest = atts.getValue(DISABLE_REGISTER_INTEREST); if (disableRegisterInterest == null) { stack.push("false"); } else { stack.push(disableRegisterInterest); } String poolName = atts.getValue(POOL_NAME); if (poolName == null) { stack.push(null); } else { stack.push(poolName); } // hi-jack RegionAttributesCreation for the disk-dirs, loader, writer and compressor RegionAttributesCreation attrs = new RegionAttributesCreation(this.cache); stack.push(attrs); }
public static void validateRegion(Cache cache, RegionConfiguration configuration, Region region) { // Get the attributes of the existing region RegionAttributes existingAttributes = region.getAttributes(); // Create region attributes creation on existing region attributes. // The RAC is created to execute the sameAs method. RegionAttributesCreation existingRACreation = new RegionAttributesCreation(existingAttributes, false); // Create requested region attributes RegionAttributes requestedRegionAttributes = getRegionAttributes(cache, configuration); // Compare the two region attributes. This method either returns true or throws a // RuntimeException. existingRACreation.sameAs(requestedRegionAttributes); }
/** * Creates a new <code>RegionCreation</code> with the given name and with the default * <code>RegionAttributes</code>. */ public RegionCreation(CacheCreation cache, RegionCreation parent, String name, String refid) { this.cache = cache; if (parent != null) { this.fullPath = parent.getFullPath() + SEPARATOR + name; } else { this.fullPath = SEPARATOR + name; } this.name = name; this.refid = refid; this.attrs = new RegionAttributesCreation(this.cache); if (refid != null) { this.attrs.setRefid(refid); this.attrs.inheritAttributes(cache); } }
RegionAttributesCreation attrs = new RegionAttributesCreation(this.cache); String scope = atts.getValue(SCOPE); if (scope == null) {
/** * Note: hydra invokes this with setRefid=false. */ public void setAttributes(RegionAttributes attrs, boolean setRefid) { this.hasAttributes = true; if (attrs instanceof RegionAttributesCreation) { this.attrs = (RegionAttributesCreation) attrs; } else { this.attrs = new RegionAttributesCreation(this.cache, attrs, false); } if ((setRefid && (this.attrs.getRefid() == null))) { this.attrs.setRefid(getRefid()); } if (attrs.getPartitionAttributes() != null && attrs.getEvictionAttributes() != null && attrs.getEvictionAttributes().getAlgorithm().isLRUMemory() && attrs.getPartitionAttributes().getLocalMaxMemory() != 0 && attrs.getEvictionAttributes() .getMaximum() != attrs.getPartitionAttributes().getLocalMaxMemory()) { getCache().getLogger().warning(String.format( "For region %s with data policy PARTITION, memory LRU eviction attribute maximum has been reset from %sMB to local-max-memory %sMB", new Object[] {this.getName(), attrs.getEvictionAttributes().getMaximum(), attrs.getPartitionAttributes().getLocalMaxMemory()})); this.attrs.setEvictionAttributes(attrs.getEvictionAttributes().createLRUMemoryAttributes( attrs.getPartitionAttributes().getLocalMaxMemory(), attrs.getEvictionAttributes().getObjectSizer(), attrs.getEvictionAttributes().getAction())); } }
public static void validateRegion(Cache cache, RegionConfiguration configuration, Region region) { // Get the attributes of the existing region RegionAttributes existingAttributes = region.getAttributes(); // Create region attributes creation on existing region attributes. // The RAC is created to execute the sameAs method. RegionAttributesCreation existingRACreation = new RegionAttributesCreation(existingAttributes, false); // Create requested region attributes RegionAttributes requestedRegionAttributes = getRegionAttributes(cache, configuration); // Compare the two region attributes. This method either returns true or throws a // RuntimeException. existingRACreation.sameAs(requestedRegionAttributes); }