Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B3431840D for ; Wed, 10 Jun 2015 18:15:46 +0000 (UTC) Received: (qmail 65611 invoked by uid 500); 10 Jun 2015 18:15:46 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 65581 invoked by uid 500); 10 Jun 2015 18:15:46 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 65572 invoked by uid 99); 10 Jun 2015 18:15:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2015 18:15:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 10 Jun 2015 18:13:33 +0000 Received: (qmail 59358 invoked by uid 99); 10 Jun 2015 18:15:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2015 18:15:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id F130BE045C; Wed, 10 Jun 2015 18:15:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Message-Id: <0c0d287e17014f369768cd132000e9c3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: ignite-929 Date: Wed, 10 Jun 2015 18:15:19 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-ignite Updated Branches: refs/heads/ignite-929 9faf635b6 -> 00eb9f192 ignite-929 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/00eb9f19 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/00eb9f19 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/00eb9f19 Branch: refs/heads/ignite-929 Commit: 00eb9f192c104c855a42832978086a282bcdb12e Parents: 9faf635 Author: avinogradov Authored: Wed Jun 10 21:15:06 2015 +0300 Committer: avinogradov Committed: Wed Jun 10 21:15:06 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheGateway.java | 27 ++++++++++- .../processors/cache/GridCacheProcessor.java | 9 ++++ .../processors/cache/IgniteCacheProxy.java | 4 +- .../cache/CacheStopAndDestroySelfTest.java | 48 ++++++++++++++++++-- 4 files changed, 80 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/00eb9f19/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java index d9d151c..b66fe7b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java @@ -35,6 +35,9 @@ public class GridCacheGateway { /** Stopped flag for dynamic caches. */ private volatile boolean stopped; + /** Closed flag for dynamic caches. */ + private volatile boolean closed; + /** */ private GridSpinReadWriteLock rwLock = new GridSpinReadWriteLock(); @@ -68,7 +71,7 @@ public class GridCacheGateway { * * @return {@code True} if enter successful, {@code false} if the cache or the node was stopped. */ - public boolean enterIfNotClosed() { + public boolean enterIfNotStopped() { onEnter(); // Must unlock in case of unexpected errors to avoid @@ -89,7 +92,7 @@ public class GridCacheGateway { * * @return {@code True} if enter successful, {@code false} if the cache or the node was stopped. */ - public boolean enterIfNotClosedNoLock() { + public boolean enterIfNotStoppedNoLock() { onEnter(); return !stopped; @@ -150,6 +153,12 @@ public class GridCacheGateway { throw new IllegalStateException("Cache has been stopped: " + ctx.name()); } + if (closed) { + rwLock.readUnlock(); + + throw new IllegalStateException("Cache has been closed: " + ctx.name()); + } + // Must unlock in case of unexpected errors to avoid // deadlocks during kernal stop. try { @@ -236,6 +245,20 @@ public class GridCacheGateway { /** * */ + public void open() { + closed = false; + } + + /** + * + */ + public void close() { + closed = true; + } + + /** + * + */ public void onStopped() { boolean interrupted = false; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/00eb9f19/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java index c81e6aa..5415b22 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java @@ -1988,6 +1988,12 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (cfg.getCacheMode() == LOCAL) return dynamicDestroyCache(cacheName); else { + IgniteCacheProxy proxy = jCacheProxies.get(maskNull(cacheName)); + + // Closing gateway first. + if (proxy != null) + proxy.gate().close(); + GridCacheAdapter cache = caches.get(maskNull(cacheName)); if (cache != null && !cache.context().affinityNode()) { @@ -2668,6 +2674,9 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (cache == null) cache = startJCache(cacheName, failIfNotStarted); + if (cache != null) + cache.gate().open(); + return (IgniteCacheProxy)cache; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/00eb9f19/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index ff8135b..f3240d9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -1588,9 +1588,9 @@ public class IgniteCacheProxy extends AsyncSupportAdapter