use of org.apache.geode.cache.CacheExistsException in project geode by apache.
the class ConcurrentIndexUpdateWithoutWLDUnitTest method getAvailableCacheElseCreateCache.
private final void getAvailableCacheElseCreateCache() {
synchronized (ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.class) {
try {
Cache newCache = GemFireCacheImpl.getInstance();
if (null == newCache) {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
newCache = CacheFactory.create(getSystem());
}
PRQueryDUnitHelper.setCache(newCache);
} catch (CacheExistsException e) {
// TODO: remove error handling
Assert.fail("the cache already exists", e);
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
Assert.fail("Checked exception while initializing cache??", ex);
} finally {
System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE");
}
}
}
Aggregations