/** * Returns true if this factory is open and can produce dynamic regions. Factories are only active * after their cache has been created. */ public boolean isActive() { return isOpen() && this.cache != null; }
/** * Returns true if dynamic region factory is closed. */ public boolean isClosed() { return !isOpen(); }
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); } }
if (DynamicRegionFactory.get().isOpen()) { return false;
if (DynamicRegionFactory.get().isOpen()) {
protected void razeDynamicRegion(EntryEvent event) { if (!DynamicRegionFactory.this.isOpen()) return; // Because CacheClientUpdater calls localDestroy we need to allow // "local" events. If this is a true local then c.getRegion will return // null and this code will do nothing. // When bug 35644 fixed the following "if" can be uncommented. // Ignore the callback if it originated in this process (because the region // will already have been destroyed) String fullRegionName = (String) event.getKey(); Region drRegion = cache.getRegion(fullRegionName); if (drRegion != null) { try { doBeforeRegionDestroyed(drRegion, true, event.getOperation().isDistributed(), event.getOperation().isExpiration(), event.getDistributedMember()); drRegion.localDestroyRegion(); doAfterRegionDestroyed(drRegion, true, event.getOperation().isDistributed(), event.getOperation().isExpiration(), event.getDistributedMember()); } catch (Exception e) { cache.getLogger().warning( String.format("Error attempting to locally destroy Dynamic Region: %s", fullRegionName), e); } } }