ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: IGNITE-9736 Fixed usages of Discovery SPI listener. - Fixes #4868.
Date Mon, 01 Oct 2018 09:49:21 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-2.7 c328ea6c6 -> 8a05a9627


IGNITE-9736 Fixed usages of Discovery SPI listener. - Fixes #4868.

Signed-off-by: Alexey Goncharuk <alexey.goncharuk@gmail.com>


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

Branch: refs/heads/ignite-2.7
Commit: 8a05a9627320cfa0989848bab86da421f1f3fc56
Parents: c328ea6
Author: Pavel Kovalenko <jokserfn@gmail.com>
Authored: Mon Oct 1 11:52:42 2018 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Mon Oct 1 12:49:00 2018 +0300

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         |  7 +-
 .../ignite/spi/discovery/DiscoverySpi.java      |  6 +-
 .../spi/discovery/DiscoverySpiListener.java     |  4 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    | 14 +---
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 14 +---
 ...iteMarshallerCacheClassNameConflictTest.java |  8 +-
 .../IgniteMarshallerCacheFSRestoreTest.java     |  8 +-
 ...gniteAbstractStandByClientReconnectTest.java |  6 +-
 .../discovery/AbstractDiscoverySelfTest.java    | 25 +++---
 .../ignite/testframework/GridTestUtils.java     |  3 +-
 .../zk/internal/ZookeeperDiscoveryImpl.java     | 85 +++++++-------------
 11 files changed, 72 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/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 5ce4cb6..19c11ac 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
@@ -99,6 +99,7 @@ import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
 import org.apache.ignite.internal.util.lang.GridTuple6;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.CI1;
@@ -587,7 +588,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                 }
             }
 
-            @Override public IgniteInternalFuture onDiscovery(
+            @Override public IgniteFuture<?> onDiscovery(
                 final int type,
                 final long topVer,
                 final ClusterNode node,
@@ -595,7 +596,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                 final Map<Long, Collection<ClusterNode>> snapshots,
                 @Nullable DiscoverySpiCustomMessage spiCustomMsg
             ) {
-                GridFutureAdapter notificationFut = new GridFutureAdapter();
+                GridFutureAdapter<?> notificationFut = new GridFutureAdapter<>();
 
                 discoNtfWrk.submit(notificationFut, () -> {
                     synchronized (discoEvtMux) {
@@ -603,7 +604,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                     }
                 });
 
-                return notificationFut;
+                return new IgniteFutureImpl<>(notificationFut);
             }
 
             /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
index 98222a3..545e1a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
@@ -99,13 +99,11 @@ public interface DiscoverySpi extends IgniteSpi {
      * {@link org.apache.ignite.events.DiscoveryEvent} for a set of all possible
      * discovery events.
      * <p>
-     * Note that as of Ignite 3.0.2 this method is called <b>before</b>
-     * method {@link #spiStart(String)} is called. This is done to
-     * avoid potential window when SPI is started but the listener is
-     * not registered yet.
+     * TODO: This method should be removed from public API in Apache Ignite 3.0
      *
      * @param lsnr Listener to discovery events or {@code null} to unset the listener.
      */
+    @Deprecated
     public void setListener(@Nullable DiscoverySpiListener lsnr);
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
index 519a235..db59de0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
@@ -21,7 +21,7 @@ import java.util.Collection;
 import java.util.Map;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.events.DiscoveryEvent;
-import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.lang.IgniteFuture;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -52,7 +52,7 @@ public interface DiscoverySpiListener {
      *
      * @return A future that will be completed when notification process has finished.
      */
-    public IgniteInternalFuture onDiscovery(
+    public IgniteFuture<?> onDiscovery(
         int type,
         long topVer,
         ClusterNode node,

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index faaaff7..3b57457 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -479,12 +479,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
                 Collection<ClusterNode> top = updateTopologyHistory(topVer + 1, null);
 
-                try {
-                    lsnr.onDiscovery(EVT_NODE_FAILED, topVer, n, top, new TreeMap<>(topHist),
null).get();
-                }
-                catch (IgniteCheckedException e) {
-                    throw new IgniteException("Failed to wait for discovery listener notification",
e);
-                }
+                lsnr.onDiscovery(EVT_NODE_FAILED, topVer, n, top, new TreeMap<>(topHist),
null).get();
             }
         }
 
@@ -2594,12 +2589,7 @@ class ClientImpl extends TcpDiscoveryImpl {
                     debugLog.debug("Discovery notification [node=" + node + ", type=" + U.gridEventName(type)
+
                         ", topVer=" + topVer + ']');
 
-                try {
-                    lsnr.onDiscovery(type, topVer, node, top, new TreeMap<>(topHist),
data).get();
-                }
-                catch (IgniteCheckedException e) {
-                    throw new IgniteException("Failed to wait for discovery listener notification",
e);
-                }
+                lsnr.onDiscovery(type, topVer, node, top, new TreeMap<>(topHist), data).get();
             }
             else if (debugLog.isDebugEnabled())
                 debugLog.debug("Skipped discovery notification [node=" + node + ", type="
+ U.gridEventName(type) +

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 778e8d7..7b0ad53 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -70,7 +70,6 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.failure.FailureContext;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
-import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.IgniteNodeAttributes;
 import org.apache.ignite.internal.IgnitionEx;
@@ -99,6 +98,7 @@ import org.apache.ignite.internal.util.worker.GridWorker;
 import org.apache.ignite.internal.util.worker.GridWorkerListener;
 import org.apache.ignite.internal.worker.WorkersRegistry;
 import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
@@ -5639,21 +5639,15 @@ class ServerImpl extends TcpDiscoveryImpl {
                     throw new IgniteException("Failed to unmarshal discovery custom message:
" + msg, t);
                 }
 
-                IgniteInternalFuture fut = lsnr.onDiscovery(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
+                IgniteFuture<?> fut = lsnr.onDiscovery(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
                     msg.topologyVersion(),
                     node,
                     snapshot,
                     hist,
                     msgObj);
 
-                if (waitForNotification || msgObj.isMutable()) {
-                    try {
-                        fut.get();
-                    }
-                    catch (IgniteCheckedException e) {
-                        throw new IgniteException("Failed to wait for discovery listener
notification", e);
-                    }
-                }
+                if (waitForNotification || msgObj.isMutable())
+                    fut.get();
 
                 if (msgObj.isMutable()) {
                     try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
index 64c7817..b3e0e45 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
@@ -31,10 +31,10 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.BinaryConfiguration;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
-import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
 import org.apache.ignite.spi.discovery.DiscoverySpiListener;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -193,7 +193,7 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
             }
 
             /** {@inheritDoc} */
-            @Override public IgniteInternalFuture onDiscovery(
+            @Override public IgniteFuture<?> onDiscovery(
                     int type,
                     long topVer,
                     ClusterNode node,
@@ -221,7 +221,7 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
                 if (delegate != null)
                     return delegate.onDiscovery(type, topVer, node, topSnapshot, topHist,
spiCustomMsg);
 
-                return new GridFinishedFuture();
+                return new IgniteFinishedFutureImpl<>();
             }
 
             /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java
index 7aa61eb..47c01dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java
@@ -34,11 +34,11 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.PersistentStoreConfiguration;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
 import org.apache.ignite.internal.processors.marshaller.MappingProposedMessage;
-import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
 import org.apache.ignite.spi.discovery.DiscoverySpiListener;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -245,7 +245,7 @@ public class IgniteMarshallerCacheFSRestoreTest extends GridCommonAbstractTest
{
             }
 
             /** {@inheritDoc} */
-            @Override public IgniteInternalFuture onDiscovery(
+            @Override public IgniteFuture<?> onDiscovery(
                 int type,
                 long topVer,
                 ClusterNode node,
@@ -271,7 +271,7 @@ public class IgniteMarshallerCacheFSRestoreTest extends GridCommonAbstractTest
{
                 if (delegate != null)
                     return delegate.onDiscovery(type, topVer, node, topSnapshot, topHist,
spiCustomMsg);
 
-                return new GridFinishedFuture();
+                return new IgniteFinishedFutureImpl<>();
             }
 
             /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
index d01e11a..176d34e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
@@ -31,9 +31,9 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.events.EventType;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
 import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
 import org.apache.ignite.spi.discovery.DiscoverySpiListener;
@@ -389,7 +389,7 @@ public abstract class IgniteAbstractStandByClientReconnectTest extends
GridCommo
         }
 
         /** {@inheritDoc} */
-        @Override public IgniteInternalFuture onDiscovery(
+        @Override public IgniteFuture<?> onDiscovery(
             int type,
             long topVer,
             ClusterNode node,
@@ -397,7 +397,7 @@ public abstract class IgniteAbstractStandByClientReconnectTest extends
GridCommo
             @Nullable Map<Long, Collection<ClusterNode>> topHist,
             @Nullable DiscoverySpiCustomMessage data
         ) {
-            IgniteInternalFuture fut = delegate.onDiscovery(type, topVer, node, topSnapshot,
topHist, data);
+            IgniteFuture<?> fut = delegate.onDiscovery(type, topVer, node, topSnapshot,
topHist, data);
 
             if (type == EVT_CLIENT_NODE_DISCONNECTED) {
                 try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
index e59d24a..3e0fb89 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
@@ -34,9 +34,9 @@ import javax.management.ObjectName;
 import mx4j.tools.adaptor.http.HttpAdaptor;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.spi.IgniteSpi;
 import org.apache.ignite.spi.IgniteSpiAdapter;
@@ -162,7 +162,7 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
         }
 
         /** {@inheritDoc} */
-        @Override public IgniteInternalFuture onDiscovery(
+        @Override public IgniteFuture<?> onDiscovery(
             int type,
             long topVer,
             ClusterNode node,
@@ -172,7 +172,7 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
             if (type == EVT_NODE_METRICS_UPDATED)
                 isMetricsUpdate = true;
 
-            return new GridFinishedFuture();
+            return new IgniteFinishedFutureImpl<>();
         }
     }
 
@@ -246,7 +246,7 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
                     // No-op.
                 }
 
-                @Override public IgniteInternalFuture onDiscovery(int type, long topVer,
ClusterNode node,
+                @Override public IgniteFuture<?> onDiscovery(int type, long topVer,
ClusterNode node,
                     Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist,
                     @Nullable DiscoverySpiCustomMessage data) {
                     // If METRICS_UPDATED came from local node
@@ -254,7 +254,7 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
                         && node.id().equals(spi.getLocalNode().id()))
                         spiCnt.addAndGet(1);
 
-                    return new GridFinishedFuture();
+                    return new IgniteFinishedFutureImpl<>();
                 }
             };
 
@@ -416,16 +416,21 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
                     }
 
                     @SuppressWarnings({"NakedNotify"})
-                    @Override public IgniteInternalFuture onDiscovery(int type, long topVer,
ClusterNode node,
-                        Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist,
-                        @Nullable DiscoverySpiCustomMessage data) {
+                    @Override public IgniteFuture<?> onDiscovery(
+                        int type,
+                        long topVer,
+                        ClusterNode node,
+                        Collection<ClusterNode> topSnapshot,
+                        Map<Long, Collection<ClusterNode>> topHist,
+                        @Nullable DiscoverySpiCustomMessage data
+                    ) {
                         info("Discovery event [type=" + type + ", node=" + node + ']');
 
                         synchronized (mux) {
                             mux.notifyAll();
                         }
 
-                        return new GridFinishedFuture();
+                        return new IgniteFinishedFutureImpl<>();
                     }
                 });
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index 4195551..caa292b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -97,6 +97,7 @@ import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.LT;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -160,7 +161,7 @@ public final class GridTestUtils {
         }
 
         /** {@inheritDoc} */
-        @Override public IgniteInternalFuture onDiscovery(int type, long topVer, ClusterNode
node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>>
topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg) {
+        @Override public IgniteFuture<?> onDiscovery(int type, long topVer, ClusterNode
node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>>
topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg) {
             hook.handleDiscoveryMessage(spiCustomMsg);
 
             return delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8a05a962/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
index 3771c7b..3d42042 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
@@ -70,6 +70,7 @@ import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.LT;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.marshaller.MarshallerUtils;
@@ -467,17 +468,12 @@ public class ZookeeperDiscoveryImpl {
         if (rtState.joined) {
             assert rtState.evtsData != null;
 
-            try {
-                lsnr.onDiscovery(EVT_CLIENT_NODE_DISCONNECTED,
-                    rtState.evtsData.topVer,
-                    locNode,
-                    rtState.top.topologySnapshot(),
-                    Collections.emptyMap(),
-                    null).get();
-            }
-            catch (IgniteCheckedException e) {
-                throw new IgniteException("Failed to wait for discovery listener notification",
e);
-            }
+            lsnr.onDiscovery(EVT_CLIENT_NODE_DISCONNECTED,
+                rtState.evtsData.topVer,
+                locNode,
+                rtState.top.topologySnapshot(),
+                Collections.emptyMap(),
+                null).get();
         }
 
         try {
@@ -540,17 +536,12 @@ public class ZookeeperDiscoveryImpl {
         if (nodes.isEmpty())
             nodes = Collections.singletonList(locNode);
 
-        try {
-            lsnr.onDiscovery(EVT_NODE_SEGMENTED,
-                rtState.evtsData != null ? rtState.evtsData.topVer : 1L,
-                locNode,
-                nodes,
-                Collections.emptyMap(),
-                null).get();
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException("Failed to wait for discovery listener notification",
e);
-        }
+        lsnr.onDiscovery(EVT_NODE_SEGMENTED,
+            rtState.evtsData != null ? rtState.evtsData.topVer : 1L,
+            locNode,
+            nodes,
+            Collections.emptyMap(),
+            null).get();
     }
 
     /**
@@ -2273,10 +2264,10 @@ public class ZookeeperDiscoveryImpl {
                 Collections.emptyMap(),
                 null).get();
         }
-        catch (IgniteCheckedException e) {
+        catch (IgniteException e) {
             joinFut.onDone(e);
 
-            throw new IgniteException("Failed to wait for discovery listener notification",
e);
+            throw new IgniteException("Failed to wait for discovery listener notification
on node join", e);
         }
 
         // Reset events (this is also notification for clients left from previous cluster).
@@ -3432,7 +3423,7 @@ public class ZookeeperDiscoveryImpl {
 
         final List<ClusterNode> topSnapshot = rtState.top.topologySnapshot();
 
-        IgniteInternalFuture fut = lsnr.onDiscovery(
+        IgniteFuture<?> fut = lsnr.onDiscovery(
             DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
             evtData.topologyVersion(),
             sndNode,
@@ -3441,14 +3432,8 @@ public class ZookeeperDiscoveryImpl {
             msg
         );
 
-        if (msg != null && msg.isMutable()) {
-            try {
-                fut.get();
-            }
-            catch (IgniteCheckedException e) {
-                throw new IgniteException("Failed to wait for discovery listener notification",
e);
-            }
-        }
+        if (msg != null && msg.isMutable())
+            fut.get();
     }
 
     /**
@@ -3466,17 +3451,12 @@ public class ZookeeperDiscoveryImpl {
 
         final List<ClusterNode> topSnapshot = rtState.top.topologySnapshot();
 
-        try {
-            lsnr.onDiscovery(EVT_NODE_JOINED,
-                joinedEvtData.topVer,
-                joinedNode,
-                topSnapshot,
-                Collections.emptyMap(),
-                null).get();
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException("Failed to wait for discovery listener notification",
e);
-        }
+        lsnr.onDiscovery(EVT_NODE_JOINED,
+            joinedEvtData.topVer,
+            joinedNode,
+            topSnapshot,
+            Collections.emptyMap(),
+            null).get();
     }
 
     /**
@@ -3502,17 +3482,12 @@ public class ZookeeperDiscoveryImpl {
 
         final List<ClusterNode> topSnapshot = rtState.top.topologySnapshot();
 
-        try {
-            lsnr.onDiscovery(EVT_NODE_FAILED,
-                topVer,
-                failedNode,
-                topSnapshot,
-                Collections.emptyMap(),
-                null).get();
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException("Failed to wait for discovery listener notification",
e);
-        }
+        lsnr.onDiscovery(EVT_NODE_FAILED,
+            topVer,
+            failedNode,
+            topSnapshot,
+            Collections.emptyMap(),
+            null).get();
 
         stats.onNodeFailed();
     }


Mime
View raw message