You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/05/22 17:02:07 UTC

incubator-ignite git commit: # ignite-929

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-929 156821420 -> 4b0659af8


# 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/4b0659af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4b0659af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4b0659af

Branch: refs/heads/ignite-929
Commit: 4b0659af8b8ed3d7988c0c1938012635e35430aa
Parents: 1568214
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 22 18:01:53 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 22 18:01:53 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java     | 19 ++++++++++---------
 .../cache/CacheStopAndDestroySelfTest.java       |  8 ++------
 2 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b0659af/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 a3ae64f..4edfd8b 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
@@ -1954,21 +1954,22 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         if (cfg.getCacheMode() == LOCAL)
             return dynamicDestroyCache(cacheName);
-        else if (ctx.config().isClientMode()) {
-            GridCacheAdapter<?, ?> cache = caches.remove(maskNull(cacheName));
+        else {
+            GridCacheAdapter<?, ?> cache = caches.get(maskNull(cacheName));
 
-            if (cache != null) {
-                GridCacheContext<?, ?> ctx = cache.context();
+            if (cache != null && !cache.context().affinityNode()) {
+                if (caches.remove(maskNull(cacheName)) != null) {
+                    GridCacheContext<?, ?> ctx = cache.context();
 
-                sharedCtx.removeCacheContext(ctx);
+                    sharedCtx.removeCacheContext(ctx);
 
-                onKernalStop(cache, true);
-                stopCache(cache, true);
+                    onKernalStop(cache, true);
+                    stopCache(cache, true);
+                }
             }
 
-            return null;
+            return null; // No-op.
         }
-        else return null;// No-Op.
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b0659af/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
----------------------------------------------------------------------
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 6a1be12..82a5ec6 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
@@ -57,7 +57,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration iCfg = super.getConfiguration(gridName);
 
-        if (gridName.endsWith("2"))
+        if (getTestGridName(2).equals(gridName))
             iCfg.setClientMode(true);
 
         iCfg.setCacheConfiguration();
@@ -68,13 +68,11 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
     /**
      * Test.
      *
-     * @throws Exception
+     * @throws Exception If failed.
      */
     public void testCacheStopAndDestroy() throws Exception {
         startGridsMultiThreaded(gridCount());
 
-        awaitPartitionMapExchange();
-
         CacheConfiguration cCfg1 = defaultCacheConfiguration();
         cCfg1.setName(CACHE_NAME_1);
         cCfg1.setCacheMode(CacheMode.PARTITIONED);
@@ -240,7 +238,5 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
                 }
             }
         }
-
     }
-
 }