[ https://issues.apache.org/jira/browse/GEODE-4162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kirk Lund updated GEODE-4162: ----------------------------- Summary: Remove all instances of GemFireCacheImpl.getInstance() call from JUnit4CacheTestCase (was: GEODE-4162 : Remove all instances of GemFireCacheImpl.getInstance() call from JUnit4CacheTestCase) > Remove all instances of GemFireCacheImpl.getInstance() call from > JUnit4CacheTestCase > ------------------------------------------------------------------------------------ > > Key: GEODE-4162 > URL: https://issues.apache.org/jira/browse/GEODE-4162 > Project: Geode > Issue Type: Sub-task > Components: tests > Reporter: nabarun > Assignee: Kirk Lund > Priority: Major > > {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 (v7.6.3#76005)