org.apache.geode.cache.Region.isDestroyed()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中org.apache.geode.cache.Region.isDestroyed方法的一些代码示例,展示了Region.isDestroyed的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Region.isDestroyed方法的具体详情如下:
包路径:org.apache.geode.cache.Region
类名称:Region
方法名:isDestroyed

Region.isDestroyed介绍

[英]Returns whether this region has been destroyed.

Does not throw a RegionDestroyedException if this region has been destroyed.
[中]返回此区域是否已被销毁。
如果该区域已被摧毁,则不会抛出RegionDestroyedException

代码示例

代码示例来源:origin: apache/geode

@Override
public boolean isDestroyed() {
 return this.realRegion.isDestroyed();
}

代码示例来源:origin: apache/geode

public boolean isDestroyed() {
 return this.region.isDestroyed();
}

代码示例来源:origin: apache/geode

/**
 * 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);
 }
}

代码示例来源:origin: apache/geode

/**
 * 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);
 }
}

代码示例来源:origin: apache/geode

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
 }
}

代码示例来源:origin: apache/geode

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;
 }
}

代码示例来源:origin: apache/geode

@Override
public boolean isClosed() {
 return userRegion.isDestroyed() || !writer.isOpen();
}

代码示例来源:origin: apache/geode

@Override
public void close() {
 Region r = getRegion();
 if (r != null && !r.isDestroyed()) {
  try {
   r.close();
  } catch (RegionDestroyedException e) {
  }
 }
}

代码示例来源:origin: apache/geode

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);
 }
}

代码示例来源:origin: apache/geode

@Override
public void close() {
 Region r = getRegion();
 if (r != null && !r.isDestroyed()) {
  try {
   r.close();
  } catch (RegionDestroyedException ignore) {
  }
 }
}

代码示例来源:origin: apache/geode

@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);
}

代码示例来源:origin: apache/geode

@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();
 }
});

代码示例来源:origin: apache/geode

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);
   }
  }
 }
}

代码示例来源:origin: apache/geode

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) {
   }
  }
 }
}

代码示例来源:origin: apache/geode

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);
  }
 }
}

代码示例来源:origin: apache/geode

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);
 }
}

代码示例来源:origin: apache/geode

region.put(key, value);
 tilt = System.currentTimeMillis() + timeout;
 assertFalse(region.isDestroyed());
} finally {
 ExpiryTask.permitExpiration();

代码示例来源:origin: apache/geode

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;
}

代码示例来源:origin: apache/geode

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"));
 }
}

代码示例来源:origin: apache/geode

if (cache != null && !cache.isClosed()) {
 for (Region root : cache.rootRegions()) {
  if (root.isDestroyed() || root instanceof HARegion) {
   continue;

相关文章

微信公众号

最新文章

更多