/** * This creates Dynamic Regions that already exist in other publishing processes */ private void createDefinedDynamicRegions() throws CacheException { // TODO: perhaps add some logic here to avoid the possibility of synchronization issues Set set = this.dynamicRegionList.entrySet(false); Iterator iterator = set.iterator(); SortedMap sorted = new TreeMap(); // sort by region name before creating (bug 35528) while (iterator.hasNext()) { Region.Entry e = (Region.Entry) iterator.next(); DynamicRegionAttributes dda = (DynamicRegionAttributes) e.getValue(); sorted.put(dda.rootRegionName + '/' + dda.name, dda); } iterator = sorted.values().iterator(); while (iterator.hasNext()) { DynamicRegionAttributes dda = (DynamicRegionAttributes) iterator.next(); doBeforeRegionCreated(dda.rootRegionName, dda.name); Region region = createDynamicRegionImpl(dda.rootRegionName, dda.name, false); doAfterRegionCreated(region, false, false, null); } }
/** * Creates the dynamic Region in the local cache and distributes the creation to other caches. * * @param parentRegionName the new region is created as a subregion of the region having this path * @param regionName the name of the new subregion * @return the {@code Region} created */ public Region createDynamicRegion(String parentRegionName, String regionName) throws CacheException { if (isClosed()) { throw new IllegalStateException("Dynamic region factory is closed"); } doBeforeRegionCreated(parentRegionName, regionName); Region region = createDynamicRegionImpl(parentRegionName, regionName, true); doAfterRegionCreated(region, false, false, null); return region; }
protected void buildDynamicRegion(EntryEvent event) { if (!DynamicRegionFactory.this.isOpen()) return; // Ignore the callback if it originated in this process (because the region // will already have been created) and the event is not a client event if (!event.isOriginRemote() && !event.hasClientOrigin()) return; // DynamicRegionAttributes dra = (DynamicRegionAttributes) event.getNewValue(); String parentRegionName = dra.rootRegionName; String newRegionName = dra.name; try { doBeforeRegionCreated(parentRegionName, newRegionName); Region region = createDynamicRegionImpl(parentRegionName, newRegionName, false); doAfterRegionCreated(region, true, true, event.getDistributedMember()); } catch (Exception e) { cache.getLogger().warning( String.format("Error attempting to locally create Dynamic Region: %s", newRegionName), e); } }