You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/05/06 13:43:34 UTC

[1/3] incubator-ignite git commit: # IGNITE-831 Fix NPE

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-836_2 880b59b96 -> d0dac7de1


# IGNITE-831 Fix NPE


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

Branch: refs/heads/ignite-836_2
Commit: d0dac7de1e573ae3870e20adfe18abf61caa84ec
Parents: 5ffaa4c
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 6 14:30:53 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 6 14:43:16 2015 +0300

----------------------------------------------------------------------
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 28 +++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0dac7de/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 6028901..8051172 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
@@ -1766,7 +1766,7 @@ 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);
 
@@ -4522,20 +4522,22 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
                 TcpDiscoveryNode node = ring.node(msg.creatorNodeId());
 
-                try {
-                    Serializable msgObj = marsh.unmarshal(msg.messageBytes(), U.gridClassLoader());
+                if (node != null) {
+                    try {
+                        Serializable msgObj = marsh.unmarshal(msg.messageBytes(), U.gridClassLoader());
 
-                    lsnr.onDiscovery(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
-                        msg.topologyVersion(),
-                        node,
-                        snapshot,
-                        hist,
-                        msgObj);
+                        lsnr.onDiscovery(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
+                            msg.topologyVersion(),
+                            node,
+                            snapshot,
+                            hist,
+                            msgObj);
 
-                    msg.messageBytes(marsh.marshal(msgObj));
-                }
-                catch (IgniteCheckedException e) {
-                    U.error(log, "Failed to unmarshal discovery custom message.", e);
+                        msg.messageBytes(marsh.marshal(msgObj));
+                    }
+                    catch (IgniteCheckedException e) {
+                        U.error(log, "Failed to unmarshal discovery custom message.", e);
+                    }
                 }
             }
         }


[3/3] incubator-ignite git commit: # IGNITE-831 Remove RingEndAwareCustomMessage.

Posted by se...@apache.org.
# IGNITE-831 Remove RingEndAwareCustomMessage.


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

Branch: refs/heads/ignite-836_2
Commit: 657afd09024978d1c50eb1b0a5db19298f0e1edc
Parents: 880b59b
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 6 13:28:59 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 6 14:43:16 2015 +0300

----------------------------------------------------------------------
 .../discovery/DiscoveryCustomMessage.java       |  7 +++++
 .../discovery/RingEndAwareCustomMessage.java    | 31 --------------------
 .../cache/DynamicCacheChangeBatch.java          |  6 ++++
 .../StartRoutineAckDiscoveryMessage.java        |  6 ++++
 .../StartRoutineDiscoveryMessage.java           |  4 +--
 .../StopRoutineAckDiscoveryMessage.java         |  6 ++++
 .../continuous/StopRoutineDiscoveryMessage.java |  4 +--
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  9 ++----
 8 files changed, 32 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/657afd09/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryCustomMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryCustomMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryCustomMessage.java
index dcb0cea..49a791e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryCustomMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryCustomMessage.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.managers.discovery;
 
+import org.jetbrains.annotations.*;
+
 import java.io.*;
 
 /**
@@ -29,4 +31,9 @@ public interface DiscoveryCustomMessage extends Serializable {
      * @return {@code true} if minor topology version should be increased.
      */
     public boolean forwardMinorVersion();
+
+    /**
+     * Called when message passed the ring.
+     */
+    @Nullable public DiscoveryCustomMessage newMessageOnRingEnd();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/657afd09/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/RingEndAwareCustomMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/RingEndAwareCustomMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/RingEndAwareCustomMessage.java
deleted file mode 100644
index 41cee8e..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/RingEndAwareCustomMessage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.managers.discovery;
-
-import org.apache.ignite.spi.*;
-import org.jetbrains.annotations.*;
-
-/**
- *
- */
-public interface RingEndAwareCustomMessage extends DiscoveryCustomMessage {
-    /**
-     *
-     */
-    @Nullable public DiscoveryCustomMessage newMessageOnRingEnd(IgniteSpiContext ctx);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/657afd09/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
index 0257307..330f822 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache;
 import org.apache.ignite.internal.managers.discovery.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
 
 import java.util.*;
 
@@ -77,4 +78,9 @@ public class DynamicCacheChangeBatch implements DiscoveryCustomMessage {
     @Override public boolean forwardMinorVersion() {
         return true;
     }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public DiscoveryCustomMessage newMessageOnRingEnd() {
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/657afd09/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java
index 4e5bb9c..2050811 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.continuous;
 
 import org.apache.ignite.*;
 import org.apache.ignite.internal.managers.discovery.*;
+import org.jetbrains.annotations.*;
 
 import java.util.*;
 
@@ -46,6 +47,11 @@ public class StartRoutineAckDiscoveryMessage implements DiscoveryCustomMessage {
         return false;
     }
 
+    /** {@inheritDoc} */
+    @Nullable @Override public DiscoveryCustomMessage newMessageOnRingEnd() {
+        return null;
+    }
+
     /**
      * @return Routine ID.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/657afd09/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java
index 492a1e7..1866901 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java
@@ -27,7 +27,7 @@ import java.util.*;
 /**
  *
  */
-public class StartRoutineDiscoveryMessage implements RingEndAwareCustomMessage {
+public class StartRoutineDiscoveryMessage implements DiscoveryCustomMessage {
     /** Routine ID. */
     private final UUID routineId;
 
@@ -81,7 +81,7 @@ public class StartRoutineDiscoveryMessage implements RingEndAwareCustomMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public DiscoveryCustomMessage newMessageOnRingEnd(IgniteSpiContext ctx) {
+    @Override public DiscoveryCustomMessage newMessageOnRingEnd() {
         return new StartRoutineAckDiscoveryMessage(routineId, errs);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/657afd09/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineAckDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineAckDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineAckDiscoveryMessage.java
index 755552b..2e3002b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineAckDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineAckDiscoveryMessage.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.continuous;
 
 import org.apache.ignite.internal.managers.discovery.*;
+import org.jetbrains.annotations.*;
 
 import java.util.*;
 
@@ -40,6 +41,11 @@ public class StopRoutineAckDiscoveryMessage implements DiscoveryCustomMessage {
         return false;
     }
 
+    /** {@inheritDoc} */
+    @Nullable @Override public DiscoveryCustomMessage newMessageOnRingEnd() {
+        return null;
+    }
+
     /**
      * @return Routine ID.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/657afd09/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineDiscoveryMessage.java
index 9c480a0..8b08960 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StopRoutineDiscoveryMessage.java
@@ -26,7 +26,7 @@ import java.util.*;
 /**
  *
  */
-public class StopRoutineDiscoveryMessage implements RingEndAwareCustomMessage {
+public class StopRoutineDiscoveryMessage implements DiscoveryCustomMessage {
     /** Routine ID. */
     private final UUID routineId;
 
@@ -50,7 +50,7 @@ public class StopRoutineDiscoveryMessage implements RingEndAwareCustomMessage {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public DiscoveryCustomMessage newMessageOnRingEnd(IgniteSpiContext ctx) {
+    @Nullable @Override public DiscoveryCustomMessage newMessageOnRingEnd() {
         return new StopRoutineAckDiscoveryMessage(routineId);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/657afd09/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 d13a6d8..f8236f1 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
@@ -4481,13 +4481,10 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                     try {
                         DiscoveryCustomMessage msgObj = marsh.unmarshal(msg.messageBytes(), U.gridClassLoader());
 
-                        if (msgObj instanceof RingEndAwareCustomMessage) {
-                            DiscoveryCustomMessage nextMsg = ((RingEndAwareCustomMessage)msgObj)
-                                .newMessageOnRingEnd(getSpiContext());
+                        DiscoveryCustomMessage nextMsg = msgObj.newMessageOnRingEnd();
 
-                            if (nextMsg != null)
-                                addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), marsh.marshal(nextMsg)));
-                        }
+                        if (nextMsg != null)
+                            addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), marsh.marshal(nextMsg)));
                     }
                     catch (IgniteCheckedException e) {
                         U.error(log, "Failed to unmarshal discovery custom message.", e);


[2/3] incubator-ignite git commit: # IGNITE-831 Create DiscoverySpiCustomMessage.

Posted by se...@apache.org.
# IGNITE-831 Create DiscoverySpiCustomMessage.


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

Branch: refs/heads/ignite-836_2
Commit: 5ffaa4cb6f35ead8fc94c563d52e98cc5241acbc
Parents: 657afd0
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 6 14:27:14 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 6 14:43:16 2015 +0300

----------------------------------------------------------------------
 .../discovery/CustomMessageWrapper.java         | 61 ++++++++++++++++++++
 .../discovery/GridDiscoveryManager.java         | 18 +++---
 .../ignite/spi/discovery/DiscoverySpi.java      |  5 +-
 .../discovery/DiscoverySpiCustomMessage.java    | 39 +++++++++++++
 .../discovery/tcp/TcpClientDiscoverySpi.java    |  3 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 17 +++---
 6 files changed, 121 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ffaa4cb/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/CustomMessageWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/CustomMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/CustomMessageWrapper.java
new file mode 100644
index 0000000..f394fe1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/CustomMessageWrapper.java
@@ -0,0 +1,61 @@
+/*
+ * 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.managers.discovery;
+
+import org.apache.ignite.spi.discovery.*;
+import org.jetbrains.annotations.*;
+
+/**
+ *
+ */
+class CustomMessageWrapper implements DiscoverySpiCustomMessage {
+    /** */
+    private final DiscoveryCustomMessage delegate;
+
+    /**
+     * @param delegate Delegate.
+     */
+    CustomMessageWrapper(@NotNull DiscoveryCustomMessage delegate) {
+        this.delegate = delegate;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean forwardMinorVersion() {
+        return delegate.forwardMinorVersion();
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public DiscoverySpiCustomMessage newMessageOnRingEnd() {
+        DiscoveryCustomMessage res = delegate.newMessageOnRingEnd();
+
+        return res == null ? null : new CustomMessageWrapper(res);
+    }
+
+    /**
+     * @return Delegate.
+     */
+    @NotNull
+    public DiscoveryCustomMessage delegate() {
+        return delegate;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return delegate.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ffaa4cb/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 3d35bee..5533fa1 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
@@ -356,7 +356,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
                 if (type == EVT_NODE_METRICS_UPDATED)
                     verChanged = false;
                 else if (type == DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT) {
-                    if (data != null && ((DiscoveryCustomMessage)data).forwardMinorVersion()) {
+                    if (data != null && ((DiscoverySpiCustomMessage)data).forwardMinorVersion()) {
                         minorTopVer++;
 
                         verChanged = true;
@@ -381,16 +381,18 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
 
                 if (type == DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT) {
                     if (data != null) {
-                        for (Class cls = data.getClass(); cls != null; cls = cls.getSuperclass()) {
+                        DiscoveryCustomMessage customMsg = ((CustomMessageWrapper)data).delegate();
+
+                        for (Class cls = customMsg.getClass(); cls != null; cls = cls.getSuperclass()) {
                             List<CustomEventListener<DiscoveryCustomMessage>> list = customEvtLsnrs.get(cls);
 
                             if (list != null) {
                                 for (CustomEventListener<DiscoveryCustomMessage> lsnr : list) {
                                     try {
-                                        lsnr.onCustomEvent(node, (DiscoveryCustomMessage)data);
+                                        lsnr.onCustomEvent(node, customMsg);
                                     }
                                     catch (Exception e) {
-                                        U.error(log, "Failed to notify direct custom event listener: " + data, e);
+                                        U.error(log, "Failed to notify direct custom event listener: " + customMsg, e);
                                     }
                                 }
                             }
@@ -1407,10 +1409,10 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
     }
 
     /**
-     * @param evt Event.
+     * @param msg Custom message.
      */
-    public void sendCustomEvent(DiscoveryCustomMessage evt) {
-        getSpi().sendCustomEvent(evt);
+    public void sendCustomEvent(DiscoveryCustomMessage msg) {
+        getSpi().sendCustomEvent(new CustomMessageWrapper(msg));
     }
 
     /**
@@ -1634,7 +1636,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
             Collection<ClusterNode> topSnapshot,
             @Nullable Serializable data
         ) {
-            assert node != null;
+            assert node != null : data;
 
             evts.add(F.t(type, topVer, node, topSnapshot, data));
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ffaa4cb/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 84a5f41..7836e0f 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
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.managers.discovery.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.*;
 import org.jetbrains.annotations.*;
@@ -142,10 +141,10 @@ public interface DiscoverySpi extends IgniteSpi {
 
     /**
      * Sends custom message across the ring.
-     * @param evt Event.
+     * @param msg Custom message.
      * @throws IgniteException if failed to marshal evt.
      */
-    public void sendCustomEvent(DiscoveryCustomMessage evt) throws IgniteException;
+    public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException;
 
     /**
      * Initiates failure of provided node.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ffaa4cb/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java
new file mode 100644
index 0000000..1550613
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java
@@ -0,0 +1,39 @@
+/*
+ * 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.spi.discovery;
+
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+
+/**
+ *
+ */
+public interface DiscoverySpiCustomMessage extends Serializable {
+    /**
+     * Whether or not minor version of topology should be increased on message receive.
+     *
+     * @return {@code true} if minor topology version should be increased.
+     */
+    public boolean forwardMinorVersion();
+
+    /**
+     * Called when message passed the ring.
+     */
+    @Nullable public DiscoverySpiCustomMessage newMessageOnRingEnd();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ffaa4cb/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 dc89d6a..3e839f8 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
@@ -20,7 +20,6 @@ package org.apache.ignite.spi.discovery.tcp;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.managers.discovery.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
@@ -389,7 +388,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
     }
 
     /** {@inheritDoc} */
-    @Override public void sendCustomEvent(DiscoveryCustomMessage evt) {
+    @Override public void sendCustomEvent(DiscoverySpiCustomMessage evt) {
         if (segmentation)
             throw new IgniteException("Failed to send custom message: client is disconnected");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ffaa4cb/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 f8236f1..6028901 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
@@ -21,10 +21,9 @@ import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.events.*;
-import org.apache.ignite.internal.managers.discovery.*;
 import org.apache.ignite.internal.processors.security.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.future.*;
@@ -38,11 +37,11 @@ import org.apache.ignite.resources.*;
 import org.apache.ignite.spi.*;
 import org.apache.ignite.spi.discovery.*;
 import org.apache.ignite.spi.discovery.tcp.internal.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.spi.discovery.tcp.messages.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
@@ -1249,7 +1248,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
     }
 
     /** {@inheritDoc} */
-    @Override public void sendCustomEvent(DiscoveryCustomMessage evt) {
+    @Override public void sendCustomEvent(DiscoverySpiCustomMessage evt) {
         try {
             msgWorker.addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), marsh.marshal(evt)));
         }
@@ -4479,9 +4478,9 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                     stats.onRingMessageReceived(msg);
 
                     try {
-                        DiscoveryCustomMessage msgObj = marsh.unmarshal(msg.messageBytes(), U.gridClassLoader());
+                        DiscoverySpiCustomMessage msgObj = marsh.unmarshal(msg.messageBytes(), U.gridClassLoader());
 
-                        DiscoveryCustomMessage nextMsg = msgObj.newMessageOnRingEnd();
+                        DiscoverySpiCustomMessage nextMsg = msgObj.newMessageOnRingEnd();
 
                         if (nextMsg != null)
                             addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), marsh.marshal(nextMsg)));