You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "nabarun (JIRA)" <ji...@apache.org> on 2017/12/22 19:07:00 UTC
[jira] [Created] (GEODE-4162) Remove all instances of
GemFireCacheImple.getInstance() call from JUnit4CacheTestCase
nabarun created GEODE-4162:
------------------------------
Summary: Remove all instances of GemFireCacheImple.getInstance() call from JUnit4CacheTestCase
Key: GEODE-4162
URL: https://issues.apache.org/jira/browse/GEODE-4162
Project: Geode
Issue Type: Bug
Components: tests
Reporter: nabarun
{code:title=JUnit4CacheTestCase.java}
public final InternalCache getCache(final boolean client, final CacheFactory factory) {
synchronized (JUnit4CacheTestCase.class) {
InternalCache gemFireCache = GemFireCacheImpl.getInstance();
if (gemFireCache != null && !gemFireCache.isClosed()
&& gemFireCache.getCancelCriterion().isCancelInProgress()) {
Awaitility.await("waiting for cache to close").atMost(30, TimeUnit.SECONDS)
.until(gemFireCache::isClosed);
}
if (cache == null || cache.isClosed()) {
cache = null;
createCache(client, factory);
}
if (client && cache != null) {
IgnoredException.addIgnoredException("java.net.ConnectException");
}
return cache;
}
}
public final ClientCache getClientCache(final ClientCacheFactory factory) {
synchronized (JUnit4CacheTestCase.class) {
InternalCache gemFireCache = GemFireCacheImpl.getInstance();
if (gemFireCache != null && !gemFireCache.isClosed()
&& gemFireCache.getCancelCriterion().isCancelInProgress()) {
Awaitility.await("waiting for cache to close").atMost(30, TimeUnit.SECONDS)
.until(gemFireCache::isClosed);
}
if (cache == null || cache.isClosed()) {
cache = null;
disconnectFromDS();
cache = (InternalCache) factory.create();
}
if (cache != null) {
IgnoredException.addIgnoredException("java.net.ConnectException");
}
return (ClientCache) cache;
}
}
public static final synchronized void closeCache() {
// Workaround for the fact that some classes are now extending
// CacheTestCase but not using it properly.
if (cache == null) {
cache = GemFireCacheImpl.getInstance();
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)