This is an automated email from the ASF dual-hosted git repository.

ilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b8ddd9  IGNITE-13102 IgniteCache#isClosed() returns false on server 
node even if the cache had been closed before - Fixes #8087.
4b8ddd9 is described below

commit 4b8ddd9bf4b7acf12dc05c1c657662b821f6e42f
Author: Konstantin Sirotkin <konstantins...@gmail.com>
AuthorDate: Tue Aug 11 15:50:36 2020 +0300

    IGNITE-13102 IgniteCache#isClosed() returns false on server node even if 
the cache had been closed before - Fixes #8087.
    
    Signed-off-by: Ilya Kasnacheev <ilya.kasnach...@gmail.com>
---
 .../processors/cache/IgniteCacheProxyImpl.java     |  2 +-
 .../cache/CacheStopAndDestroySelfTest.java         | 22 ++++++++++++++++++++++
 .../IgniteCacheClusterReadOnlyModeSelfTest.java    |  5 -----
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
index 0c6c117..6222f60 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
@@ -1925,7 +1925,7 @@ public class IgniteCacheProxyImpl<K, V> extends 
AsyncSupportAdapter<IgniteCache<
     @Override public boolean isClosed() {
         GridCacheContext<K, V> ctx = getContextSafe();
 
-        return ctx.kernalContext().cache().context().closed(ctx);
+        return isProxyClosed() || 
ctx.kernalContext().cache().context().closed(ctx);
     }
 
     /** {@inheritDoc} */
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
index ffd567f..3df7c7e 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
@@ -531,6 +531,28 @@ public class CacheStopAndDestroySelfTest extends 
GridCommonAbstractTest {
     }
 
     /**
+     * Test status of closed cache instance
+     *
+     * @throws Exception If failed
+     */
+    @Test
+    public void testServerCacheInstanceClose_isClosedShouldReturnTrue() throws 
Exception {
+        IgniteCache<String, String> cache = 
startGrid(0).getOrCreateCache(getDhtConfig());
+
+        assertFalse(cache.isClosed());
+
+        cache.close();
+
+        assertTrue(cache.isClosed());
+
+        IgniteCache<String, String> cacheNew = grid(0).cache(CACHE_NAME_DHT);
+
+        assertNotSame(cache, cacheNew);
+
+        assertFalse(cacheNew.isClosed());
+    }
+
+    /**
      * Test Client close.
      *
      * @throws Exception If failed.
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeSelfTest.java
index 5a764c7..cac0953 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeSelfTest.java
@@ -516,11 +516,6 @@ public class IgniteCacheClusterReadOnlyModeSelfTest 
extends IgniteCacheClusterRe
     @Test
     public void testCloseAllowed() {
         performAction((node, cache) -> {
-            if (!node.configuration().isClientMode()) {
-                // FIXME https://issues.apache.org/jira/browse/IGNITE-13102
-                return;
-            }
-
             assertFalse(cache.isClosed());
 
             cache.close();

Reply via email to