ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject incubator-ignite git commit: # IGNITE-312 Remove DiscoverySpiListener#onCustomMessage()
Date Tue, 24 Feb 2015 16:19:30 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-312 a0387afd7 -> e6a6bad55


# IGNITE-312 Remove DiscoverySpiListener#onCustomMessage()


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

Branch: refs/heads/ignite-312
Commit: e6a6bad55c569c3e4ea2c19ef22db446cc59a8cf
Parents: a0387af
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Tue Feb 24 19:19:22 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Tue Feb 24 19:19:22 2015 +0300

----------------------------------------------------------------------
 .../managers/discovery/GridDiscoveryManager.java | 11 ++++-------
 .../spi/discovery/DiscoverySpiListener.java      | 12 +-----------
 .../spi/discovery/tcp/TcpClientDiscoverySpi.java |  2 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java       |  9 +++++----
 .../spi/discovery/AbstractDiscoverySelfTest.java | 19 +++----------------
 5 files changed, 14 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6a6bad5/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 ee07e62..fc44cc1 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
@@ -260,7 +260,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                 long topVer,
                 ClusterNode node,
                 Collection<ClusterNode> topSnapshot,
-                Map<Long, Collection<ClusterNode>> snapshots
+                Map<Long, Collection<ClusterNode>> snapshots,
+                @Nullable Object data
             ) {
                 final ClusterNode locNode = localNode();
 
@@ -275,7 +276,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                 // Put topology snapshot into discovery history.
                 // There is no race possible between history maintenance and concurrent discovery
                 // event notifications, since SPI notifies manager about all events from
this listener.
-                if (type != EVT_NODE_METRICS_UPDATED) {
+                if (type != EVT_NODE_METRICS_UPDATED && type != EVT_DISCOVERY_CUSTOM_EVT)
{
                     DiscoCache cache = new DiscoCache(locNode, F.view(topSnapshot, F.remoteNodes(locNode.id())));
 
                     discoCacheHist.put(topVer, cache);
@@ -310,11 +311,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                         ", evt=" + U.gridEventName(type) + ']';
                 }
 
-                discoWrk.addEvent(type, topVer, node, topSnapshot, null);
-            }
-
-            @Override public void onCustomMessage(@NotNull Object data, @NotNull ClusterNode
node, long topVer) {
-                discoWrk.addEvent(EVT_DISCOVERY_CUSTOM_EVT, topVer, node, null, data);
+                discoWrk.addEvent(type, topVer, node, topSnapshot, data);
             }
         });
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6a6bad5/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 960094c..c8e2750 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
@@ -39,15 +39,5 @@ public interface DiscoverySpiListener {
      * @param topHist Topology snapshots history.
      */
     public void onDiscovery(int type, long topVer, ClusterNode node, Collection<ClusterNode>
topSnapshot,
-        @Nullable Map<Long, Collection<ClusterNode>> topHist);
-
-    /**
-     * Notification for node custom events.
-     *
-     * @param msg The custom message.
-     * @param node The mode that created message.
-     * @param topVer Topology version or {@code 0} if configured discovery SPI implementation
-     *      does not support versioning.
-     */
-    public void onCustomMessage(Object msg, ClusterNode node, long topVer);
+        @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable Object
data);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6a6bad5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
index 21c93e7..cc491a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
@@ -1225,7 +1225,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements
Tcp
                     log.debug("Discovery notification [node=" + node + ", type=" + U.gridEventName(type)
+
                         ", topVer=" + topVer + ']');
 
-                lsnr.onDiscovery(type, topVer, node, top, new TreeMap<>(topHist));
+                lsnr.onDiscovery(type, topVer, node, top, new TreeMap<>(topHist), null);
             }
             else if (log.isDebugEnabled())
                 log.debug("Skipped discovery notification [node=" + node + ", type=" + U.gridEventName(type)
+

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6a6bad5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index baf62d5..3da9413 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1033,7 +1033,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
 
                     Map<Long, Collection<ClusterNode>> hist = updateTopologyHistory(topVer,
top);
 
-                    lsnr.onDiscovery(EVT_NODE_FAILED, topVer, n, top, hist);
+                    lsnr.onDiscovery(EVT_NODE_FAILED, topVer, n, top, hist, null);
                 }
             }
         }
@@ -1716,11 +1716,11 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
                 log.debug("Discovery notification [node=" + node + ", spiState=" + spiState
+
                     ", type=" + U.gridEventName(type) + ", topVer=" + topVer + ']');
 
-            Collection<ClusterNode> top = F.<TcpDiscoveryNode, ClusterNode>upcast(ring.visibleNodes());
+            Collection<ClusterNode> top = F.upcast(ring.visibleNodes());
 
             Map<Long, Collection<ClusterNode>> hist = updateTopologyHistory(topVer,
top);
 
-            lsnr.onDiscovery(type, topVer, node, top, hist);
+            lsnr.onDiscovery(type, topVer, node, top, hist, null);
         }
         else if (log.isDebugEnabled())
             log.debug("Skipped discovery notification [node=" + node + ", spiState=" + spiState
+
@@ -4397,7 +4397,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
             TcpDiscoverySpiState spiState = spiStateCopy();
 
             if (lsnr != null && (spiState == CONNECTED || spiState == DISCONNECTING))
-                lsnr.onCustomMessage(msg.message(), ring.node(msg.creatorNodeId()), msg.topologyVersion());
+                lsnr.onDiscovery(EVT_DISCOVERY_CUSTOM_EVT, msg.topologyVersion(), ring.node(msg.creatorNodeId()),
null,
+                    null, msg.message());
 
             if (ring.hasRemoteNodes())
                 sendMessageAcrossRing(msg);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6a6bad5/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 64de9d4..abc8e58 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
@@ -132,15 +132,10 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
 
         /** {@inheritDoc} */
         @Override public void onDiscovery(int type, long topVer, ClusterNode node, Collection<ClusterNode>
topSnapshot,
-            Map<Long, Collection<ClusterNode>> topHist) {
+            Map<Long, Collection<ClusterNode>> topHist, Object data) {
             if (type == EVT_NODE_METRICS_UPDATED)
                 isMetricsUpdate = true;
         }
-
-        /** {@inheritDoc} */
-        @Override public void onCustomMessage(Object msg, ClusterNode node, long topVer)
{
-            // No-op.
-        }
     }
 
     /**
@@ -209,16 +204,12 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
 
             DiscoverySpiListener locHeartbeatLsnr = new DiscoverySpiListener() {
                 @Override public void onDiscovery(int type, long topVer, ClusterNode node,
-                    Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist) {
+                    Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist, Object data) {
                     // If METRICS_UPDATED came from local node
                     if (type == EVT_NODE_METRICS_UPDATED
                         && node.id().equals(spi.getLocalNode().id()))
                         spiCnt.addAndGet(1);
                 }
-
-                @Override public void onCustomMessage(Object msg, ClusterNode node, long
topVer) {
-                    // No-op.
-                }
             };
 
             locUpdCnts[i] = spiCnt;
@@ -377,17 +368,13 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
                 spi.setListener(new DiscoverySpiListener() {
                     @SuppressWarnings({"NakedNotify"})
                     @Override public void onDiscovery(int type, long topVer, ClusterNode
node,
-                        Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist) {
+                        Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist, Object data) {
                         info("Discovery event [type=" + type + ", node=" + node + ']');
 
                         synchronized (mux) {
                             mux.notifyAll();
                         }
                     }
-
-                    @Override public void onCustomMessage(Object msg, ClusterNode node, long
topVer) {
-                        // No-op.
-                    }
                 });
 
                 spi.setDataExchange(new DiscoverySpiDataExchange() {


Mime
View raw message