You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/07/21 03:55:09 UTC

[16/50] [abbrv] incubator-ignite git commit: ignite-1085: reimplemented

ignite-1085: reimplemented


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

Branch: refs/heads/ignite-950
Commit: f0ace1f997b3e7b7a0692870aba4fd80302f9813
Parents: 24aae82
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 15 14:03:50 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 15 14:03:50 2015 +0300

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f0ace1f9/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 1bac4d0..b35628c 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
@@ -193,6 +193,9 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
         super(ctx, ctx.config().getDiscoverySpi());
     }
 
+    /** */
+    private final CountDownLatch startLatch = new CountDownLatch(1);
+
     /**
      * @return Memory usage of non-heap memory.
      */
@@ -376,8 +379,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
             });
         }
 
-        final CountDownLatch startLatch = new CountDownLatch(1);
-
         spi.setListener(new DiscoverySpiListener() {
             @Override public void onDiscovery(
                 int type,
@@ -1052,6 +1053,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
 
     /** {@inheritDoc} */
     @Override public void onKernalStop0(boolean cancel) {
+        startLatch.countDown();
+
         // Stop segment check worker.
         if (segChkWrk != null) {
             segChkWrk.cancel();
@@ -1224,16 +1227,9 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
      * @return Discovery collection cache.
      */
     public DiscoCache discoCache() {
-        Snapshot cur;
-
-        while ((cur = topSnap.get()) == null) {
-            // Wrap the SPI collection to avoid possible floating collection.
-            if (topSnap.compareAndSet(null, cur = new Snapshot(
-                AffinityTopologyVersion.ZERO,
-                new DiscoCache(localNode(), getSpi().getRemoteNodes())))) {
-                return cur.discoCache;
-            }
-        }
+        Snapshot cur = topSnap.get();
+
+        assert cur != null;
 
         return cur.discoCache;
     }