@Override public boolean isDestroyed() { return this.realRegion.isDestroyed(); }
public boolean isDestroyed() { return this.region.isDestroyed(); }
/** * put an entry in local monitoring region * * @param name MBean name * @param data The value part of the Map */ public void putEntryInLocalMonitoringRegion(String name, Object data) { if (localMonitoringRegion != null && !localMonitoringRegion.isDestroyed()) { localMonitoringRegion.put(name, data); } }
/** * uses putAll operation of region * * @param objectMap Object Map containing key-value operations */ public void putAllInLocalMonitoringRegion(Map<String, FederationComponent> objectMap) { if (localMonitoringRegion != null && !localMonitoringRegion.isDestroyed()) { localMonitoringRegion.putAll(objectMap); } }
public boolean keyExistsInLocalMonitoringRegion(String key) { if (localMonitoringRegion != null && !localMonitoringRegion.isDestroyed()) { // We want to just check locally without sending a message to the manager. // containsKey does this. return localMonitoringRegion.containsKey(key); } else { return true; // so caller will think it does not need to do a putAll } }
public void waitForChange() { Region pr = getPartitionedRegion(); synchronized (this) { while (!profileChanged && pr != null && !pr.isDestroyed()) { // the advisee might have been destroyed due to initialization failure try { this.wait(1000); } catch (InterruptedException e) { } } this.profileChanged = false; } }
@Override public boolean isClosed() { return userRegion.isDestroyed() || !writer.isOpen(); }
@Override public void close() { Region r = getRegion(); if (r != null && !r.isDestroyed()) { try { r.close(); } catch (RegionDestroyedException e) { } } }
protected void closeDown(Region region) { try { if (!region.isDestroyed()) { region.destroyRegion(); } } catch (Exception e) { this.logWriter.error("DiskRegionTestingBase::closeDown:Exception in destroyiong the region", e); } }
@Override public void close() { Region r = getRegion(); if (r != null && !r.isDestroyed()) { try { r.close(); } catch (RegionDestroyedException ignore) { } } }
@Before public void createMocks() { region = Mockito.mock(Region.class); Mockito.when(region.isDestroyed()).thenReturn(false); indexStats = Mockito.mock(LuceneIndexStats.class); fileSystemStats = Mockito.mock(FileSystemStats.class); }
@Override public void run2() { Cache cache = getCache(); Region<?, ?> pr = cache.getRegion(rName); assertThat(pr).describedAs("Region already destroyed.").isNotNull(); pr.destroyRegion(); assertThat(pr.isDestroyed()).describedAs("Region isDestroyed false").isTrue(); assertThat(cache.getRegion(rName)).describedAs("Region not destroyed.").isNull(); } });
protected static final void destroyRegions(final Cache cache) { if (cache != null && !cache.isClosed()) { // try to destroy the root regions first so that we clean up any persistent files. for (Region<?, ?> root : cache.rootRegions()) { String regionFullPath = root == null ? null : root.getFullPath(); // for colocated regions you can't locally destroy a partitioned region. if (root.isDestroyed() || root instanceof HARegion || root instanceof PartitionedRegion) { continue; } try { root.localDestroyRegion("teardown"); } catch (Throwable t) { logger.error("Failure during tearDown destroyRegions for " + regionFullPath, t); } } } }
private static void destroyRegions(final Cache cache) { if (cache != null && !cache.isClosed()) { // try to destroy the root regions first so that we clean up any persistent files. for (Region<?, ?> root : cache.rootRegions()) { String regionFullPath = root == null ? null : root.getFullPath(); // for colocated regions you can't locally destroy a partitioned region. if (root.isDestroyed() || root instanceof HARegion || root instanceof PartitionedRegion) { continue; } try { root.localDestroyRegion("CacheRule_tearDown"); } catch (Exception ignore) { } } } }
private void destroyAsyncEventQueue(boolean initiator) { String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath); // Get the AsyncEventQueue AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) cache.getAsyncEventQueue(aeqId); // Stop the AsyncEventQueue (this stops the AsyncEventQueue's underlying GatewaySender) // The AsyncEventQueue can be null in an accessor member if (aeq != null) { aeq.stop(); } // Remove the id from the dataRegion's AsyncEventQueue ids // Note: The region may already have been destroyed by a remote member Region region = getDataRegion(); if (!region.isDestroyed()) { region.getAttributesMutator().removeAsyncEventQueueId(aeqId); } // Destroy the aeq (this also removes it from the GemFireCacheImpl) // The AsyncEventQueue can be null in an accessor member if (aeq != null) { aeq.destroy(initiator); } if (logger.isDebugEnabled()) { logger.debug("Destroyed aeqId=" + aeqId); } } }
public void waitForProfileStatus(int status) { ProfileShutdownListener listener = new ProfileShutdownListener(); addProfileChangeListener(listener); try { int memberNum = 0; String regionName = getPartitionedRegion().getFullPath(); do { Region pr = getPartitionedRegion().getCache().getRegion(regionName); if (pr == null || pr.isDestroyed()) break; Set members = adviseNotAtShutDownAllStatus(status); memberNum = members.size(); if (memberNum > 0) { if (logger.isDebugEnabled()) { logger.debug("waitForProfileStatus {} at PR:{}, expecting {} members: {}", status, getPartitionedRegion().getFullPath(), memberNum, members); } listener.waitForChange(); } } while (memberNum > 0); } finally { removeProfileChangeListener(listener); } }
region.put(key, value); tilt = System.currentTimeMillis() + timeout; assertFalse(region.isDestroyed()); } finally { ExpiryTask.permitExpiration();
public static IndexManager getIndexManager(InternalCache cache, Region region, boolean createIfNotAvailable) { if (region == null || region.isDestroyed()) { return null; } InternalRegion lRegion = (InternalRegion) region; IndexManager idxMgr = lRegion.getIndexManager(); if (idxMgr == null && createIfNotAvailable) { // JUst before creating new IndexManager. if (testHook != null && region instanceof PartitionedRegion) { testHook.hook(0); } Object imSync = lRegion.getIMSync(); synchronized (imSync) { // Double checked locking if (lRegion.getIndexManager() == null) { idxMgr = new IndexManager(cache, region); lRegion.setIndexManager(idxMgr); } else { idxMgr = lRegion.getIndexManager(); } } } return idxMgr; }
public void remoteTestPostSnapshot(String name, boolean isController, boolean isRoot) throws CacheException { assertTrue(preSnapshotRegion.isDestroyed()); try { preSnapshotRegion.get("0"); fail("Should have thrown a RegionReinitializedException"); } catch (RegionReinitializedException e) { // pass } LogWriter log = getCache().getLogger(); // get new reference to region Region postSnapshotRegion = isRoot ? getRootRegion(name) : getRootRegion().getSubregion(name); assertNotNull("Could not get reference to reinitialized region", postSnapshotRegion); boolean expectData = isController || postSnapshotRegion.getAttributes().getMirrorType().isMirrored() || postSnapshotRegion.getAttributes().getDataPolicy().isPreloaded(); log.info("region has " + postSnapshotRegion.keySet().size() + " entries"); assertEquals(expectData ? MAX_KEYS : 0, postSnapshotRegion.keySet().size()); // gets the data either locally or by netSearch assertEquals(new Integer(3), postSnapshotRegion.get("3")); // bug 33311 coverage if (expectData) { assertFalse(postSnapshotRegion.containsValueForKey("9")); assertTrue(postSnapshotRegion.containsKey("9")); } }
if (cache != null && !cache.isClosed()) { for (Region root : cache.rootRegions()) { if (root.isDestroyed() || root instanceof HARegion) { continue;