You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Kirk Lund (JIRA)" <ji...@apache.org> on 2018/02/01 18:16:00 UTC

[jira] [Updated] (GEODE-4162) GEODE-4162 : Remove all instances of GemFireCacheImpl.getInstance() call from JUnit4CacheTestCase

     [ https://issues.apache.org/jira/browse/GEODE-4162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kirk Lund updated GEODE-4162:
-----------------------------
    Summary: GEODE-4162 : Remove all instances of GemFireCacheImpl.getInstance() call from JUnit4CacheTestCase  (was: GEODE-4162 : Remove all instances of GemFireCacheImple.getInstance() call from JUnit4CacheTestCase)

> GEODE-4162 : 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
>            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)