ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [11/27] incubator-ignite git commit: IGNITE-594 - Fixed NPE, added test.
Date Thu, 26 Mar 2015 09:36:59 GMT
IGNITE-594 - Fixed NPE, added test.


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

Branch: refs/heads/ignite-release-test-no-mod
Commit: 411481c80797384b61e520a0b2bd057058701a82
Parents: f9f649a
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Wed Mar 25 22:10:11 2015 -0700
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Wed Mar 25 22:10:11 2015 -0700

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         |  3 +-
 .../cache/IgniteDynamicCacheStartSelfTest.java  | 33 ++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/411481c8/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 2eb6916..3cd6aab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -369,7 +369,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
 
                 if (type == DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT) {
                     try {
-                        customEvtLsnr.apply(data);
+                        if (customEvtLsnr != null)
+                            customEvtLsnr.apply(data);
                     }
                     catch (Exception e) {
                         U.error(log, "Failed to notify direct custom event listener: " +
data, e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/411481c8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index 1752368..e57a0a2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -62,6 +62,9 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest
{
     /** */
     private boolean testAttribute = true;
 
+    /** */
+    private boolean daemon;
+
     /**
      * @return Number of nodes for this test.
      */
@@ -88,6 +91,9 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest
{
 
         cfg.setIncludeEventTypes(EventType.EVT_CACHE_STARTED, EventType.EVT_CACHE_STOPPED,
EventType.EVT_CACHE_NODES_LEFT);
 
+        if (daemon)
+            cfg.setDaemon(true);
+
         return cfg;
     }
 
@@ -969,4 +975,31 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest
{
                 ignite(i).events().stopLocalListen(lsnrs[i]);
         }
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDaemonNode() throws Exception {
+        daemon = true;
+
+        Ignite dNode = startGrid(nodeCount());
+
+        try {
+            CacheConfiguration cfg = new CacheConfiguration(DYNAMIC_CACHE_NAME);
+
+            try (IgniteCache cache = ignite(0).createCache(cfg)) {
+                for (int i = 0; i < 100; i++) {
+                    assertFalse(ignite(0).affinity(DYNAMIC_CACHE_NAME).mapKeyToPrimaryAndBackups(i)
+                        .contains(dNode.cluster().localNode()));
+
+                    cache.put(i, i);
+                }
+            }
+        }
+        finally {
+            stopGrid(nodeCount());
+
+            daemon = false;
+        }
+    }
 }


Mime
View raw message