http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryDiscardMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryDiscardMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryDiscardMessage.java
deleted file mode 100644
index 3211f8d..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryDiscardMessage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.apache.ignite.lang.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Message sent by coordinator when some operation handling is over. All 
receiving
- * nodes should discard this and all preceding messages in local buffers.
- */
-public class GridTcpDiscoveryDiscardMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** ID of the message to discard (this and all preceding). */
-    private IgniteUuid msgId;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryDiscardMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node ID.
-     * @param msgId Message ID.
-     */
-    public GridTcpDiscoveryDiscardMessage(UUID creatorNodeId, IgniteUuid 
msgId) {
-        super(creatorNodeId);
-
-        this.msgId = msgId;
-    }
-
-    /**
-     * Gets message ID to discard (this and all preceding).
-     *
-     * @return Message ID.
-     */
-    public IgniteUuid msgId() {
-        return msgId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        U.writeGridUuid(out, msgId);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        msgId = U.readGridUuid(in);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryDiscardMessage.class, this, "super", 
super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryDuplicateIdMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryDuplicateIdMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryDuplicateIdMessage.java
deleted file mode 100644
index 7dba08a..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryDuplicateIdMessage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.spi.discovery.tcp.internal.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Message telling joining node that new topology already contain
- * different node with same ID.
- */
-public class GridTcpDiscoveryDuplicateIdMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Node with duplicate ID. */
-    private TcpDiscoveryNode node;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryDuplicateIdMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node ID.
-     * @param node Node with same ID.
-     */
-    public GridTcpDiscoveryDuplicateIdMessage(UUID creatorNodeId, 
TcpDiscoveryNode node) {
-        super(creatorNodeId);
-
-        assert node != null;
-
-        this.node = node;
-    }
-
-    /**
-     * @return Node with duplicate ID.
-     */
-    public TcpDiscoveryNode node() {
-        return node;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeObject(node);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        node = (TcpDiscoveryNode)in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryDuplicateIdMessage.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryEnsureDelivery.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryEnsureDelivery.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryEnsureDelivery.java
deleted file mode 100644
index 1bf0ca1..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryEnsureDelivery.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import java.lang.annotation.*;
-
-/**
- * Message classes with this annotation attached are processed in a special 
way to
- * ensure messages delivery.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface GridTcpDiscoveryEnsureDelivery {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHandshakeRequest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHandshakeRequest.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHandshakeRequest.java
deleted file mode 100644
index c1a38d9..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHandshakeRequest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Handshake request.
- */
-public class GridTcpDiscoveryHandshakeRequest extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryHandshakeRequest() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node ID.
-     */
-    public GridTcpDiscoveryHandshakeRequest(UUID creatorNodeId) {
-        super(creatorNodeId);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryHandshakeRequest.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHandshakeResponse.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHandshakeResponse.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHandshakeResponse.java
deleted file mode 100644
index d8661e4..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHandshakeResponse.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Handshake response.
- */
-public class GridTcpDiscoveryHandshakeResponse extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private long order;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryHandshakeResponse() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node ID.
-     * @param locNodeOrder Local node order.
-     */
-    public GridTcpDiscoveryHandshakeResponse(UUID creatorNodeId, long 
locNodeOrder) {
-        super(creatorNodeId);
-
-        order = locNodeOrder;
-    }
-
-    /**
-     * Gets order of the node sent the response.
-     *
-     * @return Order of the node sent the response.
-     */
-    public long order() {
-        return order;
-    }
-
-    /**
-     * Sets order of the node sent the response.
-     *
-     * @param order Order of the node sent the response.
-     */
-    public void order(long order) {
-        this.order = order;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeLong(order);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        order = in.readLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryHandshakeResponse.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHeartbeatMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHeartbeatMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHeartbeatMessage.java
deleted file mode 100644
index 5870231..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryHeartbeatMessage.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.apache.ignite.cluster.*;
-import org.gridgain.grid.spi.discovery.*;
-import org.gridgain.grid.util.tostring.*;
-import org.gridgain.grid.util.typedef.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-import static org.gridgain.grid.spi.discovery.DiscoveryMetricsHelper.*;
-
-/**
- * Heartbeat message.
- * <p>
- * It is sent by coordinator node across the ring once a configured period.
- * Message makes two passes:
- * <ol>
- *      <li>During first pass, all nodes add their metrics to the message and
- *          update local metrics with metrics currently present in the 
message.</li>
- *      <li>During second pass, all nodes update all metrics present in the 
message
- *          and remove their own metrics from the message.</li>
- * </ol>
- * When message reaches coordinator second time it is discarded (it finishes 
the
- * second pass).
- */
-@GridTcpDiscoveryRedirectToClient
-public class GridTcpDiscoveryHeartbeatMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Map to store nodes metrics. */
-    @GridToStringExclude
-    private Map<UUID, MetricsSet> metrics;
-
-    /** Client node IDs. */
-    private Collection<UUID> clientNodeIds;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryHeartbeatMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node.
-     */
-    public GridTcpDiscoveryHeartbeatMessage(UUID creatorNodeId) {
-        super(creatorNodeId);
-
-        metrics = U.newHashMap(1);
-        clientNodeIds = new HashSet<>();
-    }
-
-    /**
-     * Sets metrics for particular node.
-     *
-     * @param nodeId Node ID.
-     * @param metrics Node metrics.
-     */
-    public void setMetrics(UUID nodeId, ClusterNodeMetrics metrics) {
-        assert nodeId != null;
-        assert metrics != null;
-        assert !this.metrics.containsKey(nodeId);
-
-        this.metrics.put(nodeId, new MetricsSet(metrics));
-    }
-
-    /**
-     * Sets metrics for a client node.
-     *
-     * @param nodeId Server node ID.
-     * @param clientNodeId Client node ID.
-     * @param metrics Node metrics.
-     */
-    public void setClientMetrics(UUID nodeId, UUID clientNodeId, 
ClusterNodeMetrics metrics) {
-        assert nodeId != null;
-        assert clientNodeId != null;
-        assert metrics != null;
-        assert this.metrics.containsKey(nodeId);
-
-        this.metrics.get(nodeId).addClientMetrics(clientNodeId, metrics);
-    }
-
-    /**
-     * Removes metrics for particular node from the message.
-     *
-     * @param nodeId Node ID.
-     */
-    public void removeMetrics(UUID nodeId) {
-        assert nodeId != null;
-
-        metrics.remove(nodeId);
-    }
-
-    /**
-     * Gets metrics map.
-     *
-     * @return Metrics map.
-     */
-    public Map<UUID, MetricsSet> metrics() {
-        return metrics;
-    }
-
-    /**
-     * @return {@code True} if this message contains metrics.
-     */
-    public boolean hasMetrics() {
-        return !metrics.isEmpty();
-    }
-
-    /**
-     * @return {@code True} if this message contains metrics.
-     */
-    public boolean hasMetrics(UUID nodeId) {
-        assert nodeId != null;
-
-        return metrics.get(nodeId) != null;
-    }
-
-    /**
-     * Gets client node IDs for  particular node.
-     *
-     * @return Client node IDs.
-     */
-    public Collection<UUID> clientNodeIds() {
-        return clientNodeIds;
-    }
-
-    /**
-     * Adds client node ID.
-     *
-     * @param clientNodeId Client node ID.
-     */
-    public void addClientNodeId(UUID clientNodeId) {
-        clientNodeIds.add(clientNodeId);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeInt(metrics.size());
-
-        if (!metrics.isEmpty()) {
-            for (Map.Entry<UUID, MetricsSet> e : metrics.entrySet()) {
-                U.writeUuid(out, e.getKey());
-                out.writeObject(e.getValue());
-            }
-        }
-
-        U.writeCollection(out, clientNodeIds);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        int metricsSize = in.readInt();
-
-        metrics = U.newHashMap(metricsSize);
-
-        for (int i = 0; i < metricsSize; i++)
-            metrics.put(U.readUuid(in), (MetricsSet)in.readObject());
-
-        clientNodeIds = U.readCollection(in);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryHeartbeatMessage.class, this, 
"super", super.toString());
-    }
-
-    /**
-     * @param metrics Metrics.
-     * @return Serialized metrics.
-     */
-    private static byte[] serializeMetrics(ClusterNodeMetrics metrics) {
-        assert metrics != null;
-
-        byte[] buf = new byte[DiscoveryMetricsHelper.METRICS_SIZE];
-
-        serialize(buf, 0, metrics);
-
-        return buf;
-    }
-
-    /**
-     * @param nodeId Node ID.
-     * @param metrics Metrics.
-     * @return Serialized metrics.
-     */
-    private static byte[] serializeMetrics(UUID nodeId, ClusterNodeMetrics 
metrics) {
-        assert nodeId != null;
-        assert metrics != null;
-
-        byte[] buf = new byte[16 + DiscoveryMetricsHelper.METRICS_SIZE];
-
-        U.longToBytes(nodeId.getMostSignificantBits(), buf, 0);
-        U.longToBytes(nodeId.getLeastSignificantBits(), buf, 8);
-
-        serialize(buf, 16, metrics);
-
-        return buf;
-    }
-
-    /**
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class MetricsSet implements Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** Metrics. */
-        private byte[] metrics;
-
-        /** Client metrics. */
-        private Collection<byte[]> clientMetrics;
-
-        /**
-         */
-        public MetricsSet() {
-            // No-op.
-        }
-
-        /**
-         * @param metrics Metrics.
-         */
-        public MetricsSet(ClusterNodeMetrics metrics) {
-            assert metrics != null;
-
-            this.metrics = serializeMetrics(metrics);
-        }
-
-        /**
-         * @return Deserialized metrics.
-         */
-        public ClusterNodeMetrics metrics() {
-            return deserialize(metrics, 0);
-        }
-
-        /**
-         * @return Client metrics.
-         */
-        public Collection<T2<UUID, ClusterNodeMetrics>> clientMetrics() {
-            return F.viewReadOnly(clientMetrics, new C1<byte[], T2<UUID, 
ClusterNodeMetrics>>() {
-                @Override public T2<UUID, ClusterNodeMetrics> apply(byte[] 
bytes) {
-                    UUID nodeId = new UUID(U.bytesToLong(bytes, 0), 
U.bytesToLong(bytes, 8));
-
-                    return new T2<>(nodeId, deserialize(bytes, 16));
-                }
-            });
-        }
-
-        /**
-         * @param nodeId Client node ID.
-         * @param metrics Client metrics.
-         */
-        private void addClientMetrics(UUID nodeId, ClusterNodeMetrics metrics) 
{
-            assert nodeId != null;
-            assert metrics != null;
-
-            if (clientMetrics == null)
-                clientMetrics = new ArrayList<>();
-
-            clientMetrics.add(serializeMetrics(nodeId, metrics));
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws 
IOException {
-            U.writeByteArray(out, metrics);
-
-            out.writeInt(clientMetrics != null ? clientMetrics.size() : -1);
-
-            if (clientMetrics != null) {
-                for (byte[] arr : clientMetrics)
-                    U.writeByteArray(out, arr);
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-            metrics = U.readByteArray(in);
-
-            int clientMetricsSize = in.readInt();
-
-            if (clientMetricsSize >= 0) {
-                clientMetrics = new ArrayList<>(clientMetricsSize);
-
-                for (int i = 0; i < clientMetricsSize; i++)
-                    clientMetrics.add(U.readByteArray(in));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryJoinRequestMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryJoinRequestMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryJoinRequestMessage.java
deleted file mode 100644
index ac3b1ea..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryJoinRequestMessage.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.spi.discovery.tcp.internal.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Initial message sent by a node that wants to enter topology.
- * Sent to random node during SPI start. Then forwarded directly to 
coordinator.
- */
-public class GridTcpDiscoveryJoinRequestMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** New node that wants to join the topology. */
-    private TcpDiscoveryNode node;
-
-    /** Discovery data. */
-    private List<Object> discoData;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryJoinRequestMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param node New node that wants to join.
-     * @param discoData Discovery data.
-     */
-    public GridTcpDiscoveryJoinRequestMessage(TcpDiscoveryNode node, 
List<Object> discoData) {
-        super(node.id());
-
-        this.node = node;
-        this.discoData = discoData;
-    }
-
-    /**
-     * Gets new node that wants to join the topology.
-     *
-     * @return Node that wants to join the topology.
-     */
-    public TcpDiscoveryNode node() {
-        return node;
-    }
-
-    /**
-     * @return Discovery data.
-     */
-    public List<Object> discoveryData() {
-        return discoData;
-    }
-
-    /**
-     * @return {@code true} flag.
-     */
-    public boolean responded() {
-        return getFlag(RESPONDED_FLAG_POS);
-    }
-
-    /**
-     * @param responded Responded flag.
-     */
-    public void responded(boolean responded) {
-        setFlag(RESPONDED_FLAG_POS, responded);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeObject(node);
-        U.writeCollection(out, discoData);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        node = (TcpDiscoveryNode)in.readObject();
-        discoData = U.readList(in);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryJoinRequestMessage.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryLoopbackProblemMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryLoopbackProblemMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryLoopbackProblemMessage.java
deleted file mode 100644
index f2265e0..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryLoopbackProblemMessage.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Message telling joining node that it has loopback problem 
(misconfiguration).
- * This means that remote node is configured to use loopback address, but 
joining node is not, or vise versa.
- */
-public class GridTcpDiscoveryLoopbackProblemMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Remote node addresses. */
-    private Collection<String> addrs;
-
-    /** Remote node host names. */
-    private Collection<String> hostNames;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryLoopbackProblemMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node ID.
-     * @param addrs Remote node addresses.
-     * @param hostNames Remote node host names.
-     */
-    public GridTcpDiscoveryLoopbackProblemMessage(UUID creatorNodeId, 
Collection<String> addrs,
-        Collection<String> hostNames) {
-        super(creatorNodeId);
-
-        this.addrs = addrs;
-        this.hostNames = hostNames;
-    }
-
-    /**
-     * @return Remote node addresses.
-     */
-    public Collection<String> addresses() {
-        return addrs;
-    }
-
-    /**
-     * @return Remote node host names.
-     */
-    public Collection<String> hostNames() {
-        return hostNames;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        U.writeCollection(out, addrs);
-        U.writeCollection(out, hostNames);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        addrs = U.readCollection(in);
-        hostNames = U.readCollection(in);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryLoopbackProblemMessage.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeAddFinishedMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeAddFinishedMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeAddFinishedMessage.java
deleted file mode 100644
index 84e19a6..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeAddFinishedMessage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Sent by coordinator across the ring to finish node add process.
- */
-@GridTcpDiscoveryEnsureDelivery
-@GridTcpDiscoveryRedirectToClient
-public class GridTcpDiscoveryNodeAddFinishedMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Added node ID. */
-    private UUID nodeId;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryNodeAddFinishedMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId ID of the creator node (coordinator).
-     * @param nodeId Added node ID.
-     */
-    public GridTcpDiscoveryNodeAddFinishedMessage(UUID creatorNodeId, UUID 
nodeId) {
-        super(creatorNodeId);
-
-        this.nodeId = nodeId;
-    }
-
-    /**
-     * Gets ID of the node added.
-     *
-     * @return ID of the node added.
-     */
-    public UUID nodeId() {
-        return nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        U.writeUuid(out, nodeId);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        nodeId = U.readUuid(in);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryNodeAddFinishedMessage.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeAddedMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeAddedMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeAddedMessage.java
deleted file mode 100644
index 72e4d15..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeAddedMessage.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.lang.*;
-import org.gridgain.grid.spi.discovery.tcp.internal.*;
-import org.gridgain.grid.util.typedef.internal.*;
-import org.gridgain.grid.util.tostring.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Message telling nodes that new node should be added to topology.
- * When newly added node receives the message it connects to its next and 
finishes
- * join process.
- */
-@GridTcpDiscoveryEnsureDelivery
-@GridTcpDiscoveryRedirectToClient
-public class GridTcpDiscoveryNodeAddedMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Added node. */
-    private TcpDiscoveryNode node;
-
-    /** Pending messages from previous node. */
-    private Collection<GridTcpDiscoveryAbstractMessage> msgs;
-
-    /** Discarded message ID. */
-    private IgniteUuid discardMsgId;
-
-    /** Current topology. Initialized by coordinator. */
-    @GridToStringInclude
-    private Collection<TcpDiscoveryNode> top;
-
-    /** Topology snapshots history. */
-    private Map<Long, Collection<ClusterNode>> topHist;
-
-    /** Discovery data from new node. */
-    private List<Object> newNodeDiscoData;
-
-    /** Discovery data from old nodes. */
-    private Collection<List<Object>> oldNodesDiscoData;
-
-    /** Start time of the first grid node. */
-    private long gridStartTime;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryNodeAddedMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node ID.
-     * @param node Node to add to topology.
-     * @param newNodeDiscoData New Node discovery data.
-     * @param gridStartTime Start time of the first grid node.
-     */
-    public GridTcpDiscoveryNodeAddedMessage(UUID creatorNodeId, 
TcpDiscoveryNode node,
-        List<Object> newNodeDiscoData, long gridStartTime) {
-        super(creatorNodeId);
-
-        assert node != null;
-        assert gridStartTime > 0;
-
-        this.node = node;
-        this.newNodeDiscoData = newNodeDiscoData;
-        this.gridStartTime = gridStartTime;
-
-        oldNodesDiscoData = new LinkedList<>();
-    }
-
-    /**
-     * Gets newly added node.
-     *
-     * @return New node.
-     */
-    public TcpDiscoveryNode node() {
-        return node;
-    }
-
-    /**
-     * Gets pending messages sent to new node by its previous.
-     *
-     * @return Pending messages from previous node.
-     */
-    @Nullable public Collection<GridTcpDiscoveryAbstractMessage> messages() {
-        return msgs;
-    }
-
-    /**
-     * Gets discarded message ID.
-     *
-     * @return Discarded message ID.
-     */
-    @Nullable public IgniteUuid discardedMessageId() {
-        return discardMsgId;
-    }
-
-    /**
-     * Sets pending messages to send to new node.
-     *
-     * @param msgs Pending messages to send to new node.
-     * @param discardMsgId Discarded message ID.
-     */
-    public void messages(@Nullable Collection<GridTcpDiscoveryAbstractMessage> 
msgs, @Nullable IgniteUuid discardMsgId) {
-        this.msgs = msgs;
-        this.discardMsgId = discardMsgId;
-    }
-
-    /**
-     * Gets topology.
-     *
-     * @return Current topology.
-     */
-    @Nullable public Collection<TcpDiscoveryNode> topology() {
-        return top;
-    }
-
-    /**
-     * Sets topology.
-     *
-     * @param top Current topology.
-     */
-    public void topology(@Nullable Collection<TcpDiscoveryNode> top) {
-        this.top = top;
-    }
-
-    /**
-     * Gets topology snapshots history.
-     *
-     * @return Map with topology snapshots history.
-     */
-    @Nullable public Map<Long, Collection<ClusterNode>> topologyHistory() {
-        return topHist;
-    }
-
-    /**
-     * Sets topology snapshots history.
-     *
-     * @param topHist Map with topology snapshots history.
-     */
-    public void topologyHistory(@Nullable Map<Long, Collection<ClusterNode>> 
topHist) {
-        this.topHist = topHist;
-    }
-
-    /**
-     * @return Discovery data from new node.
-     */
-    public List<Object> newNodeDiscoveryData() {
-        return newNodeDiscoData;
-    }
-
-    /**
-     * @return Discovery data from old nodes.
-     */
-    public Collection<List<Object>> oldNodesDiscoveryData() {
-        return oldNodesDiscoData;
-    }
-
-    /**
-     * @param discoData Discovery data to add.
-     */
-    public void addDiscoveryData(List<Object> discoData) {
-        // Old nodes disco data may be null if message
-        // makes more than 1 pass due to stopping of the nodes in topology.
-        if (oldNodesDiscoData != null)
-            oldNodesDiscoData.add(discoData);
-    }
-
-    /**
-     * Clears discovery data to minimize message size.
-     */
-    public void clearDiscoveryData() {
-        newNodeDiscoData = null;
-        oldNodesDiscoData = null;
-    }
-
-    /**
-     * @return First grid node start time.
-     */
-    public long gridStartTime() {
-        return gridStartTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeObject(node);
-        U.writeCollection(out, msgs);
-        U.writeGridUuid(out, discardMsgId);
-        U.writeCollection(out, top);
-        U.writeMap(out, topHist);
-        out.writeLong(gridStartTime);
-        U.writeCollection(out, newNodeDiscoData);
-
-        out.writeInt(oldNodesDiscoData != null ? oldNodesDiscoData.size() : 
-1);
-
-        if (oldNodesDiscoData != null) {
-            for (List<Object> list : oldNodesDiscoData)
-                U.writeCollection(out, list);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        node = (TcpDiscoveryNode)in.readObject();
-        msgs = U.readCollection(in);
-        discardMsgId = U.readGridUuid(in);
-        top = U.readCollection(in);
-        topHist = U.readTreeMap(in);
-        gridStartTime = in.readLong();
-        newNodeDiscoData = U.readList(in);
-
-        int oldNodesDiscoDataSize = in.readInt();
-
-        if (oldNodesDiscoDataSize >= 0) {
-            oldNodesDiscoData = new ArrayList<>(oldNodesDiscoDataSize);
-
-            for (int i = 0; i < oldNodesDiscoDataSize; i++)
-                oldNodesDiscoData.add(U.readList(in));
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryNodeAddedMessage.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeFailedMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeFailedMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeFailedMessage.java
deleted file mode 100644
index de9ee67..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeFailedMessage.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Sent by node that has detected node failure to coordinator across the ring,
- * then sent by coordinator across the ring.
- */
-@GridTcpDiscoveryEnsureDelivery
-@GridTcpDiscoveryRedirectToClient
-public class GridTcpDiscoveryNodeFailedMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** ID of the failed node. */
-    private UUID failedNodeId;
-
-    /** Internal order of the failed node. */
-    private long order;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryNodeFailedMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId ID of the node that detects nodes failure.
-     * @param failedNodeId ID of the failed nodes.
-     * @param order Order of the failed node.
-     */
-    public GridTcpDiscoveryNodeFailedMessage(UUID creatorNodeId, UUID 
failedNodeId, long order) {
-        super(creatorNodeId);
-
-        assert failedNodeId != null;
-        assert order > 0;
-
-        this.failedNodeId = failedNodeId;
-        this.order = order;
-    }
-
-    /**
-     * Gets ID of the failed node.
-     *
-     * @return ID of the failed node.
-     */
-    public UUID failedNodeId() {
-        return failedNodeId;
-    }
-
-    /**
-     * @return Internal order of the failed node.
-     */
-    public long order() {
-        return order;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        U.writeUuid(out, failedNodeId);
-        out.writeLong(order);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        failedNodeId = U.readUuid(in);
-        order = in.readLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryNodeFailedMessage.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeLeftMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeLeftMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeLeftMessage.java
deleted file mode 100644
index efef8f3..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryNodeLeftMessage.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Sent by node that is stopping to coordinator across the ring,
- * then sent by coordinator across the ring.
- */
-@GridTcpDiscoveryEnsureDelivery
-@GridTcpDiscoveryRedirectToClient
-public class GridTcpDiscoveryNodeLeftMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryNodeLeftMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId ID of the node that is about to leave the topology.
-     */
-    public GridTcpDiscoveryNodeLeftMessage(UUID creatorNodeId) {
-        super(creatorNodeId);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryNodeLeftMessage.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryPingRequest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryPingRequest.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryPingRequest.java
deleted file mode 100644
index 025f58e..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryPingRequest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Ping request.
- */
-public class GridTcpDiscoveryPingRequest extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Pinged client node ID. */
-    private UUID clientNodeId;
-
-    /**
-     * For {@link Externalizable}.
-     */
-    public GridTcpDiscoveryPingRequest() {
-        // No-op.
-    }
-
-    /**
-     * @param creatorNodeId Creator node ID.
-     * @param clientNodeId Pinged client node ID.
-     */
-    public GridTcpDiscoveryPingRequest(UUID creatorNodeId, @Nullable UUID 
clientNodeId) {
-        super(creatorNodeId);
-
-        this.clientNodeId = clientNodeId;
-    }
-
-    /**
-     * @return Pinged client node ID.
-     */
-    @Nullable public UUID clientNodeId() {
-        return clientNodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        U.writeUuid(out, clientNodeId);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        clientNodeId = U.readUuid(in);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryPingResponse.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryPingResponse.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryPingResponse.java
deleted file mode 100644
index 10373f8..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryPingResponse.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Ping response.
- */
-public class GridTcpDiscoveryPingResponse extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Whether pinged client exists. */
-    private boolean clientExists;
-
-    /**
-     * For {@link Externalizable}.
-     */
-    public GridTcpDiscoveryPingResponse() {
-        // No-op.
-    }
-
-    /**
-     * @param creatorNodeId Creator node ID.
-     */
-    public GridTcpDiscoveryPingResponse(UUID creatorNodeId) {
-        super(creatorNodeId);
-    }
-
-    /**
-     * @param clientExists Whether pinged client exists.
-     */
-    public void clientExists(boolean clientExists) {
-        this.clientExists = clientExists;
-    }
-
-    /**
-     * @return Whether pinged client exists.
-     */
-    public boolean clientExists() {
-        return clientExists;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeBoolean(clientExists);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        clientExists = in.readBoolean();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryRedirectToClient.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryRedirectToClient.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryRedirectToClient.java
deleted file mode 100644
index 19f345b..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryRedirectToClient.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import java.lang.annotation.*;
-
-/**
- * Message classes with this annotation attached will be
- * redirected to client nodes when going through ring.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface GridTcpDiscoveryRedirectToClient {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryStatusCheckMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryStatusCheckMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryStatusCheckMessage.java
deleted file mode 100644
index 4baebab..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/GridTcpDiscoveryStatusCheckMessage.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.discovery.tcp.messages;
-
-import org.gridgain.grid.spi.discovery.tcp.internal.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Message sent by node to its next to ensure that next node and
- * connection to it are alive. Receiving node should send it across the ring,
- * until message does not reach coordinator. Coordinator responds directly to 
node.
- * <p>
- * If a failed node id is specified then the message is sent across the ring 
up to the sender node
- * to ensure that the failed node is actually failed.
- */
-public class GridTcpDiscoveryStatusCheckMessage extends 
GridTcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Status OK. */
-    public static final int STATUS_OK = 1;
-
-    /** Status RECONNECT. */
-    public static final int STATUS_RECON = 2;
-
-    /** Creator node. */
-    private TcpDiscoveryNode creatorNode;
-
-    /** Failed node id. */
-    private UUID failedNodeId;
-
-    /** Creator node status (initialized by coordinator). */
-    private int status;
-
-    /**
-     * Public default no-arg constructor for {@link Externalizable} interface.
-     */
-    public GridTcpDiscoveryStatusCheckMessage() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNode Creator node.
-     * @param failedNodeId Failed node id.
-     */
-    public GridTcpDiscoveryStatusCheckMessage(TcpDiscoveryNode creatorNode, 
UUID failedNodeId) {
-        super(creatorNode.id());
-
-        this.creatorNode = creatorNode;
-        this.failedNodeId = failedNodeId;
-    }
-
-    /**
-     * Gets creator node.
-     *
-     * @return Creator node.
-     */
-    public TcpDiscoveryNode creatorNode() {
-        return creatorNode;
-    }
-
-    /**
-     * Gets failed node id.
-     *
-     * @return Failed node id.
-     */
-    public UUID failedNodeId() {
-        return failedNodeId;
-    }
-
-    /**
-     * Gets creator status.
-     *
-     * @return Creator node status.
-     */
-    public int status() {
-        return status;
-    }
-
-    /**
-     * Sets creator node status (should be set by coordinator).
-     *
-     * @param status Creator node status.
-     */
-    public void status(int status) {
-        this.status = status;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeObject(creatorNode);
-        U.writeUuid(out, failedNodeId);
-        out.writeInt(status);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        super.readExternal(in);
-
-        creatorNode = (TcpDiscoveryNode)in.readObject();
-        failedNodeId = U.readUuid(in);
-        status = in.readInt();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridTcpDiscoveryStatusCheckMessage.class, this, 
"super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
new file mode 100644
index 0000000..70a705b
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
@@ -0,0 +1,266 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import org.apache.ignite.lang.*;
+import org.gridgain.grid.util.tostring.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Base class to implement discovery messages.
+ */
+public abstract class TcpDiscoveryAbstractMessage implements Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    protected static final int CLIENT_FLAG_POS = 0;
+
+    /** */
+    protected static final int RESPONDED_FLAG_POS = 1;
+
+    /** */
+    protected static final int CLIENT_RECON_SUCCESS_FLAG_POS = 2;
+
+    /** Sender of the message (transient). */
+    private UUID senderNodeId;
+
+    /** Message ID. */
+    private IgniteUuid id;
+
+    /** Verifier node ID. */
+    private UUID verifierNodeId;
+
+    /** Topology version. */
+    private long topVer;
+
+    /** Destination client node ID. */
+    private UUID destClientNodeId;
+
+    /** Flags. */
+    @GridToStringExclude
+    private int flags;
+
+    /** Pending message index. */
+    private short pendingIdx;
+
+    /**
+     * Default no-arg constructor for {@link Externalizable} interface.
+     */
+    protected TcpDiscoveryAbstractMessage() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node ID.
+     */
+    protected TcpDiscoveryAbstractMessage(UUID creatorNodeId) {
+        id = IgniteUuid.fromUuid(creatorNodeId);
+    }
+
+    /**
+     * Gets creator node.
+     *
+     * @return Creator node ID.
+     */
+    public UUID creatorNodeId() {
+        return id.globalId();
+    }
+
+    /**
+     * Gets message ID.
+     *
+     * @return Message ID.
+     */
+    public IgniteUuid id() {
+        return id;
+    }
+
+    /**
+     * Gets sender node ID.
+     *
+     * @return Sender node ID.
+     */
+    public UUID senderNodeId() {
+        return senderNodeId;
+    }
+
+    /**
+     * Sets sender node ID.
+     *
+     * @param senderNodeId Sender node ID.
+     */
+    public void senderNodeId(UUID senderNodeId) {
+        this.senderNodeId = senderNodeId;
+    }
+
+    /**
+     * Checks whether message is verified.
+     *
+     * @return {@code true} if message was verified.
+     */
+    public boolean verified() {
+        return verifierNodeId != null;
+    }
+
+    /**
+     * Gets verifier node ID.
+     *
+     * @return verifier node ID.
+     */
+    public UUID verifierNodeId() {
+        return verifierNodeId;
+    }
+
+    /**
+     * Verifies the message and stores verifier ID.
+     *
+     * @param verifierNodeId Verifier node ID.
+     */
+    public void verify(UUID verifierNodeId) {
+        this.verifierNodeId = verifierNodeId;
+    }
+
+    /**
+     * Gets topology version.
+     *
+     * @return Topology version.
+     */
+    public long topologyVersion() {
+        return topVer;
+    }
+
+    /**
+     * Sets topology version.
+     *
+     * @param topVer Topology version.
+     */
+    public void topologyVersion(long topVer) {
+        this.topVer = topVer;
+    }
+
+    /**
+     * Get client node flag.
+     *
+     * @return Client node flag.
+     */
+    public boolean client() {
+        return getFlag(CLIENT_FLAG_POS);
+    }
+
+    /**
+     * Sets client node flag.
+     *
+     * @param client Client node flag.
+     */
+    public void client(boolean client) {
+        setFlag(CLIENT_FLAG_POS, client);
+    }
+
+    /**
+     * @return Destination client node ID.
+     */
+    public UUID destinationClientNodeId() {
+        return destClientNodeId;
+    }
+
+    /**
+     * @param destClientNodeId Destination client node ID.
+     */
+    public void destinationClientNodeId(UUID destClientNodeId) {
+        this.destClientNodeId = destClientNodeId;
+    }
+
+    /**
+     * @return Pending message index.
+     */
+    public short pendingIndex() {
+        return pendingIdx;
+    }
+
+    /**
+     * @param pendingIdx Pending message index.
+     */
+    public void pendingIndex(short pendingIdx) {
+        this.pendingIdx = pendingIdx;
+    }
+
+    /**
+     * @param pos Flag position.
+     * @return Flag value.
+     */
+    protected boolean getFlag(int pos) {
+        assert pos >= 0 && pos < 32;
+
+        int mask = 1 << pos;
+
+        return (flags & mask) == mask;
+    }
+
+    /**
+     * @param pos Flag position.
+     * @param val Flag value.
+     */
+    protected void setFlag(int pos, boolean val) {
+        assert pos >= 0 && pos < 32;
+
+        int mask = 1 << pos;
+
+        if (val)
+            flags |= mask;
+        else
+            flags &= ~mask;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        U.writeGridUuid(out, id);
+        U.writeUuid(out, verifierNodeId);
+        out.writeLong(topVer);
+        U.writeUuid(out, destClientNodeId);
+        out.writeInt(flags);
+        out.writeShort(pendingIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        id = U.readGridUuid(in);
+        verifierNodeId = U.readUuid(in);
+        topVer = in.readLong();
+        destClientNodeId = U.readUuid(in);
+        flags = in.readInt();
+        pendingIdx = in.readShort();
+    }
+
+    /** {@inheritDoc} */
+    @Override public final boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        else if (obj instanceof TcpDiscoveryAbstractMessage)
+            return id.equals(((TcpDiscoveryAbstractMessage)obj).id);
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public final int hashCode() {
+        return id.hashCode();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryAbstractMessage.class, this, "isClient", 
getFlag(CLIENT_FLAG_POS));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
new file mode 100644
index 0000000..906b687
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
@@ -0,0 +1,72 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Message telling joining node that its authentication failed on coordinator.
+ */
+public class TcpDiscoveryAuthFailedMessage extends TcpDiscoveryAbstractMessage 
{
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Coordinator address. */
+    private InetAddress addr;
+
+    /**
+     * Public default no-arg constructor for {@link Externalizable} interface.
+     */
+    public TcpDiscoveryAuthFailedMessage() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node ID.
+     * @param addr Coordinator address.
+     */
+    public TcpDiscoveryAuthFailedMessage(UUID creatorNodeId, InetAddress addr) 
{
+        super(creatorNodeId);
+
+        this.addr = addr;
+    }
+
+    /**
+     * @return Coordinator address.
+     */
+    public InetAddress address() {
+        return addr;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        U.writeByteArray(out, addr.getAddress());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        super.readExternal(in);
+
+        addr = InetAddress.getByAddress(U.readByteArray(in));
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryAuthFailedMessage.class, this, "super", 
super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java
new file mode 100644
index 0000000..9247b68
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java
@@ -0,0 +1,71 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Message telling joining node that it failed coordinator's validation check.
+ */
+public class TcpDiscoveryCheckFailedMessage extends 
TcpDiscoveryAbstractMessage {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Coordinator version. */
+    private String err;
+
+    /**
+     * Public default no-arg constructor for {@link Externalizable} interface.
+     */
+    public TcpDiscoveryCheckFailedMessage() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node ID.
+     * @param err Error message from coordinator.
+     */
+    public TcpDiscoveryCheckFailedMessage(UUID creatorNodeId, String err) {
+        super(creatorNodeId);
+
+        this.err = err;
+    }
+
+    /**
+     * @return Error message from coordinator.
+     */
+    public String error() {
+        return err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        U.writeString(out, err);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        super.readExternal(in);
+
+        err = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryCheckFailedMessage.class, this, "super", 
super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
new file mode 100644
index 0000000..4951f5b
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
@@ -0,0 +1,119 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import org.apache.ignite.lang.*;
+import org.gridgain.grid.util.tostring.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Message telling that client node is reconnecting to topology.
+ */
+public class TcpDiscoveryClientReconnectMessage extends 
TcpDiscoveryAbstractMessage {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** New router nodeID. */
+    private UUID routerNodeId;
+
+    /** Last message ID. */
+    private IgniteUuid lastMsgId;
+
+    /** Pending messages. */
+    @GridToStringExclude
+    private Collection<TcpDiscoveryAbstractMessage> msgs;
+
+    /**
+     * For {@link Externalizable}.
+     */
+    public TcpDiscoveryClientReconnectMessage() {
+        // No-op.
+    }
+
+    /**
+     * @param creatorNodeId Creator node ID.
+     * @param routerNodeId New router node ID.
+     * @param lastMsgId Last message ID.
+     */
+    public TcpDiscoveryClientReconnectMessage(UUID creatorNodeId, UUID 
routerNodeId, IgniteUuid lastMsgId) {
+        super(creatorNodeId);
+
+        this.routerNodeId = routerNodeId;
+        this.lastMsgId = lastMsgId;
+    }
+
+    /**
+     * @return New router node ID.
+     */
+    public UUID routerNodeId() {
+        return routerNodeId;
+    }
+
+    /**
+     * @return Last message ID.
+     */
+    public IgniteUuid lastMessageId() {
+        return lastMsgId;
+    }
+
+    /**
+     * @param msgs Pending messages.
+     */
+    public void pendingMessages(Collection<TcpDiscoveryAbstractMessage> msgs) {
+        this.msgs = msgs;
+    }
+
+    /**
+     * @return Pending messages.
+     */
+    public Collection<TcpDiscoveryAbstractMessage> pendingMessages() {
+        return msgs;
+    }
+
+    /**
+     * @param success Success flag.
+     */
+    public void success(boolean success) {
+        setFlag(CLIENT_RECON_SUCCESS_FLAG_POS, success);
+    }
+
+    /**
+     * @return Success flag.
+     */
+    public boolean success() {
+        return getFlag(CLIENT_RECON_SUCCESS_FLAG_POS);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        U.writeUuid(out, routerNodeId);
+        U.writeGridUuid(out, lastMsgId);
+        U.writeCollection(out, msgs);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        super.readExternal(in);
+
+        routerNodeId = U.readUuid(in);
+        lastMsgId = U.readGridUuid(in);
+        msgs = U.readCollection(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryClientReconnectMessage.class, this, 
"super", super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
new file mode 100644
index 0000000..a607285
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
@@ -0,0 +1,75 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import org.apache.ignite.lang.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Message sent by coordinator when some operation handling is over. All 
receiving
+ * nodes should discard this and all preceding messages in local buffers.
+ */
+public class TcpDiscoveryDiscardMessage extends TcpDiscoveryAbstractMessage {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** ID of the message to discard (this and all preceding). */
+    private IgniteUuid msgId;
+
+    /**
+     * Public default no-arg constructor for {@link Externalizable} interface.
+     */
+    public TcpDiscoveryDiscardMessage() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node ID.
+     * @param msgId Message ID.
+     */
+    public TcpDiscoveryDiscardMessage(UUID creatorNodeId, IgniteUuid msgId) {
+        super(creatorNodeId);
+
+        this.msgId = msgId;
+    }
+
+    /**
+     * Gets message ID to discard (this and all preceding).
+     *
+     * @return Message ID.
+     */
+    public IgniteUuid msgId() {
+        return msgId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        U.writeGridUuid(out, msgId);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        super.readExternal(in);
+
+        msgId = U.readGridUuid(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryDiscardMessage.class, this, "super", 
super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java
new file mode 100644
index 0000000..755f10e
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java
@@ -0,0 +1,75 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import org.gridgain.grid.spi.discovery.tcp.internal.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Message telling joining node that new topology already contain
+ * different node with same ID.
+ */
+public class TcpDiscoveryDuplicateIdMessage extends 
TcpDiscoveryAbstractMessage {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Node with duplicate ID. */
+    private TcpDiscoveryNode node;
+
+    /**
+     * Public default no-arg constructor for {@link Externalizable} interface.
+     */
+    public TcpDiscoveryDuplicateIdMessage() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node ID.
+     * @param node Node with same ID.
+     */
+    public TcpDiscoveryDuplicateIdMessage(UUID creatorNodeId, TcpDiscoveryNode 
node) {
+        super(creatorNodeId);
+
+        assert node != null;
+
+        this.node = node;
+    }
+
+    /**
+     * @return Node with duplicate ID.
+     */
+    public TcpDiscoveryNode node() {
+        return node;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeObject(node);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        super.readExternal(in);
+
+        node = (TcpDiscoveryNode)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryDuplicateIdMessage.class, this, "super", 
super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryEnsureDelivery.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryEnsureDelivery.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryEnsureDelivery.java
new file mode 100644
index 0000000..d6b90da
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryEnsureDelivery.java
@@ -0,0 +1,23 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import java.lang.annotation.*;
+
+/**
+ * Message classes with this annotation attached are processed in a special 
way to
+ * ensure messages delivery.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface TcpDiscoveryEnsureDelivery {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java
new file mode 100644
index 0000000..5fc78dd
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java
@@ -0,0 +1,44 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Handshake request.
+ */
+public class TcpDiscoveryHandshakeRequest extends TcpDiscoveryAbstractMessage {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Public default no-arg constructor for {@link Externalizable} interface.
+     */
+    public TcpDiscoveryHandshakeRequest() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node ID.
+     */
+    public TcpDiscoveryHandshakeRequest(UUID creatorNodeId) {
+        super(creatorNodeId);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryHandshakeRequest.class, this, "super", 
super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdb10bc1/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java
 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java
new file mode 100644
index 0000000..0413216
--- /dev/null
+++ 
b/modules/core/src/main/java/org/gridgain/grid/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java
@@ -0,0 +1,82 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.discovery.tcp.messages;
+
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Handshake response.
+ */
+public class TcpDiscoveryHandshakeResponse extends TcpDiscoveryAbstractMessage 
{
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private long order;
+
+    /**
+     * Public default no-arg constructor for {@link Externalizable} interface.
+     */
+    public TcpDiscoveryHandshakeResponse() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node ID.
+     * @param locNodeOrder Local node order.
+     */
+    public TcpDiscoveryHandshakeResponse(UUID creatorNodeId, long 
locNodeOrder) {
+        super(creatorNodeId);
+
+        order = locNodeOrder;
+    }
+
+    /**
+     * Gets order of the node sent the response.
+     *
+     * @return Order of the node sent the response.
+     */
+    public long order() {
+        return order;
+    }
+
+    /**
+     * Sets order of the node sent the response.
+     *
+     * @param order Order of the node sent the response.
+     */
+    public void order(long order) {
+        this.order = order;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeLong(order);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        super.readExternal(in);
+
+        order = in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryHandshakeResponse.class, this, "super", 
super.toString());
+    }
+}

Reply via email to