/** * Sets the attributes of this region */ public void setAttributes(RegionAttributes attrs) { setAttributes(attrs, true); }
@Override public Region createSubregion(String subregionName, RegionAttributes attrs) throws RegionExistsException, TimeoutException { RegionCreation subregion = new RegionCreation(this.cache, this, subregionName, null); subregion.setAttributes(attrs); this.addSubregion(subregionName, subregion); return subregion; }
/** * After popping the current <code>RegionAttributesCreation</code> off the stack, we add it to the * <code>RegionCreation</code> that should be on the top of the stack. */ private void endRegionAttributes() { RegionAttributesCreation attrs = (RegionAttributesCreation) stack.pop(); CacheCreation cache; Object top = stack.peek(); if (top instanceof RegionCreation) { RegionCreation region = (RegionCreation) top; region.setAttributes(attrs); cache = (CacheCreation) region.getCache(); } else if (top instanceof CacheCreation) { cache = (CacheCreation) top; } else { String s = "Did not expected a " + top.getClass().getName() + " on top of the stack."; Assert.assertTrue(false, s); cache = null; // Dead code } String id = attrs.getId(); if (id != null) { cache.setRegionAttributes(id, attrs); } }
@Override public Region createRegion(String name, RegionAttributes aRegionAttributes) throws RegionExistsException, TimeoutException { if (aRegionAttributes instanceof RegionAttributesCreation) { ((RegionAttributesCreation) aRegionAttributes).inheritAttributes(this); ((RegionAttributesCreation) aRegionAttributes).prepareForValidation(); } AttributesFactory.validateAttributes(aRegionAttributes); RegionCreation region = new RegionCreation(this, name, null); region.setAttributes(aRegionAttributes); this.addRootRegion(region); return region; }