Repository: ignite
Updated Branches:
  refs/heads/master f2b390a38 -> f83a5f701


ignite-2528 Removed cache blocking operations from kernal write lock.

This closes #730


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f83a5f70
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f83a5f70
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f83a5f70

Branch: refs/heads/master
Commit: f83a5f701b28549d0de2b7c135db191321772ffd
Parents: f2b390a
Author: sboikov <[email protected]>
Authored: Mon May 23 09:52:43 2016 +0300
Committer: sboikov <[email protected]>
Committed: Mon May 23 09:52:43 2016 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 11 +--
 ...eConcurrentEntryProcessorAccessStopTest.java | 82 ++++++++++++++++++++
 .../testsuites/IgniteKernalSelfTestSuite.java   |  2 +
 3 files changed, 90 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f83a5f70/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 18e5c62..e77875e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1907,11 +1907,6 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                 Thread.currentThread().interrupt();
 
             try {
-                GridCacheProcessor cache = ctx.cache();
-
-                if (cache != null)
-                    cache.blockGateways();
-
                 assert gw.getState() == STARTED || gw.getState() == STARTING 
|| gw.getState() == DISCONNECTED;
 
                 // No more kernal calls from this point on.
@@ -1926,6 +1921,12 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                 gw.writeUnlock();
             }
 
+            // Stopping cache operations.
+            GridCacheProcessor cache = ctx.cache();
+
+            if (cache != null)
+                cache.blockGateways();
+
             // Unregister MBeans.
             if (!(
                 unregisterMBean(pubExecSvcMBean) &

http://git-wip-us.apache.org/repos/asf/ignite/blob/f83a5f70/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java
new file mode 100644
index 0000000..864c9dc
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests node stop while it is being accessed from EntryProcessor.
+ */
+public class IgniteConcurrentEntryProcessorAccessStopTest extends 
GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrid();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
+        super.afterTestsStopped();
+    }
+
+    /**
+     * Tests concurrent instance shutdown.
+     *
+     * @throws Exception If failed.
+     */
+    public void testConcurrentAccess() throws Exception {
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+        Ignite ignite = grid();
+
+        final IgniteCache<Object, Object> dfltCache = 
ignite.getOrCreateCache(ccfg);
+
+        dfltCache.put("1", "1");
+
+        Thread invoker = new Thread(new Runnable() {
+            @Override public void run() {
+                dfltCache.invoke("1", new EntryProcessor<Object, Object, 
Object>() {
+                    @Override public Object process(MutableEntry<Object, 
Object> e, Object... args) {
+                        int i = 100_000;
+
+                        while (i-- >= 0)
+                            grid().cluster().nodes();
+
+                        e.remove();
+
+                        return null;
+                    }
+                });
+            }
+        });
+
+        invoker.setName("ConcurrentEntryProcessorActionThread");
+
+        invoker.start();
+
+        stopGrid();
+
+        invoker.join();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f83a5f70/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index 05d33d7..bb7c569 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.GridDiscoverySelfTest;
 import org.apache.ignite.internal.GridFailedInputParametersSelfTest;
 import org.apache.ignite.internal.GridHomePathSelfTest;
 import org.apache.ignite.internal.GridKernalConcurrentAccessStopSelfTest;
+import org.apache.ignite.internal.IgniteConcurrentEntryProcessorAccessStopTest;
 import org.apache.ignite.internal.GridListenActorSelfTest;
 import org.apache.ignite.internal.GridLocalEventListenerSelfTest;
 import org.apache.ignite.internal.GridNodeFilterSelfTest;
@@ -112,6 +113,7 @@ public class IgniteKernalSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridListenActorSelfTest.class);
         suite.addTestSuite(GridNodeLocalSelfTest.class);
         suite.addTestSuite(GridKernalConcurrentAccessStopSelfTest.class);
+        suite.addTestSuite(IgniteConcurrentEntryProcessorAccessStopTest.class);
         suite.addTestSuite(GridUpdateNotifierSelfTest.class);
         
suite.addTestSuite(IgniteUpdateNotifierPerClusterSettingSelfTest.class);
         suite.addTestSuite(GridLocalEventListenerSelfTest.class);

Reply via email to