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/26 18:17:27 UTC

[1/3] incubator-ignite git commit: # IGNITE-943 Move common methods to TcpDiscoverySpiAdapter

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-943 [created] 2f169f579


# IGNITE-943 Move common methods to TcpDiscoverySpiAdapter


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

Branch: refs/heads/ignite-943
Commit: e5849fe6e08b1292f3055fb2827983e7542bebae
Parents: 2ca18ba
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 26 16:41:25 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 26 16:41:25 2015 +0300

----------------------------------------------------------------------
 .../discovery/tcp/TcpClientDiscoverySpi.java    |  75 ---------
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  90 -----------
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   | 162 +++++++++++++++++++
 3 files changed, 162 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e5849fe6/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 1cf044e..52c9016 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
@@ -187,86 +187,11 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
     }
 
     /** {@inheritDoc} */
-    @Override public long getSocketTimeout() {
-        return sockTimeout;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getAckTimeout() {
-        return ackTimeout;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNetworkTimeout() {
-        return netTimeout;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getThreadPriority() {
-        return threadPri;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getHeartbeatFrequency() {
-        return hbFreq;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getIpFinderFormatted() {
-        return ipFinder.toString();
-    }
-
-    /** {@inheritDoc} */
     @Override public int getMessageWorkerQueueSize() {
         return msgWorker.queueSize();
     }
 
     /** {@inheritDoc} */
-    @Override public long getNodesJoined() {
-        return stats.joinedNodesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNodesLeft() {
-        return stats.leftNodesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNodesFailed() {
-        return stats.failedNodesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getAvgMessageProcessingTime() {
-        return stats.avgMessageProcessingTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getMaxMessageProcessingTime() {
-        return stats.maxMessageProcessingTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalReceivedMessages() {
-        return stats.totalReceivedMessages();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map<String, Integer> getReceivedMessages() {
-        return stats.receivedMessages();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalProcessedMessages() {
-        return stats.totalProcessedMessages();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map<String, Integer> getProcessedMessages() {
-        return stats.processedMessages();
-    }
-
-    /** {@inheritDoc} */
     @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
         startStopwatch();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e5849fe6/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 6bad0f2..2123afc 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
@@ -521,101 +521,11 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
     }
 
     /** {@inheritDoc} */
-    @Override public long getSocketTimeout() {
-        return sockTimeout;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getAckTimeout() {
-        return ackTimeout;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNetworkTimeout() {
-        return netTimeout;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getThreadPriority() {
-        return threadPri;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getHeartbeatFrequency() {
-        return hbFreq;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getIpFinderFormatted() {
-        return ipFinder.toString();
-    }
-
-    /** {@inheritDoc} */
     @Override public int getMessageWorkerQueueSize() {
         return msgWorker.queueSize();
     }
 
     /** {@inheritDoc} */
-    @Override public long getNodesJoined() {
-        return stats.joinedNodesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNodesLeft() {
-        return stats.leftNodesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNodesFailed() {
-        return stats.failedNodesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getPendingMessagesRegistered() {
-        return stats.pendingMessagesRegistered();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getPendingMessagesDiscarded() {
-        return stats.pendingMessagesDiscarded();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getAvgMessageProcessingTime() {
-        return stats.avgMessageProcessingTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getMaxMessageProcessingTime() {
-        return stats.maxMessageProcessingTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalReceivedMessages() {
-        return stats.totalReceivedMessages();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map<String, Integer> getReceivedMessages() {
-        return stats.receivedMessages();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalProcessedMessages() {
-        return stats.totalProcessedMessages();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map<String, Integer> getProcessedMessages() {
-        return stats.processedMessages();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCoordinatorSinceTimestamp() {
-        return stats.coordinatorSinceTimestamp();
-    }
-
-    /** {@inheritDoc} */
     @Nullable @Override public UUID getCoordinator() {
         TcpDiscoveryNode crd = resolveCoordinator();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e5849fe6/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
index 5bfd378..d5ea9f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
@@ -359,6 +359,168 @@ public abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements
         return F.<Object>asList(ipFinder);
     }
 
+    /**
+     * Gets socket timeout.
+     *
+     * @return Socket timeout.
+     */
+    public long getSocketTimeout() {
+        return sockTimeout;
+    }
+
+    /**
+     * Gets message acknowledgement timeout.
+     *
+     * @return Message acknowledgement timeout.
+     */
+    public long getAckTimeout() {
+        return ackTimeout;
+    }
+
+    /**
+     * Gets network timeout.
+     *
+     * @return Network timeout.
+     */
+    public long getNetworkTimeout() {
+        return netTimeout;
+    }
+
+    /**
+     * Gets thread priority. All threads within SPI will be started with it.
+     *
+     * @return Thread priority.
+     */
+    public int getThreadPriority() {
+        return threadPri;
+    }
+
+    /**
+     * Gets delay between heartbeat messages sent by coordinator.
+     *
+     * @return Time period in milliseconds.
+     */
+    public long getHeartbeatFrequency() {
+        return hbFreq;
+    }
+
+    /**
+     * Gets {@link org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} (string representation).
+     *
+     * @return IPFinder (string representation).
+     */
+    public String getIpFinderFormatted() {
+        return ipFinder.toString();
+    }
+
+    /**
+     * Gets joined nodes count.
+     *
+     * @return Nodes joined count.
+     */
+    public long getNodesJoined() {
+        return stats.joinedNodesCount();
+    }
+
+    /**
+     * Gets left nodes count.
+     *
+     * @return Left nodes count.
+     */
+    public long getNodesLeft() {
+        return stats.leftNodesCount();
+    }
+
+    /**
+     * Gets failed nodes count.
+     *
+     * @return Failed nodes count.
+     */
+    public long getNodesFailed() {
+        return stats.failedNodesCount();
+    }
+
+    /**
+     * Gets pending messages registered count.
+     *
+     * @return Pending messages registered count.
+     */
+    public long getPendingMessagesRegistered() {
+        return stats.pendingMessagesRegistered();
+    }
+
+    /**
+     * Gets pending messages discarded count.
+     *
+     * @return Pending messages registered count.
+     */
+    public long getPendingMessagesDiscarded() {
+        return stats.pendingMessagesDiscarded();
+    }
+
+    /**
+     * Gets avg message processing time.
+     *
+     * @return Avg message processing time.
+     */
+    public long getAvgMessageProcessingTime() {
+        return stats.avgMessageProcessingTime();
+    }
+
+    /**
+     * Gets max message processing time.
+     *
+     * @return Max message processing time.
+     */
+    public long getMaxMessageProcessingTime() {
+        return stats.maxMessageProcessingTime();
+    }
+
+    /**
+     * Gets total received messages count.
+     *
+     * @return Total received messages count.
+     */
+    public int getTotalReceivedMessages() {
+        return stats.totalReceivedMessages();
+    }
+
+    /**
+     * Gets received messages counts (grouped by type).
+     *
+     * @return Map containing message types and respective counts.
+     */
+    public Map<String, Integer> getReceivedMessages() {
+        return stats.receivedMessages();
+    }
+
+    /**
+     * Gets total processed messages count.
+     *
+     * @return Total processed messages count.
+     */
+    public int getTotalProcessedMessages() {
+        return stats.totalProcessedMessages();
+    }
+
+    /**
+     * Gets processed messages counts (grouped by type).
+     *
+     * @return Map containing message types and respective counts.
+     */
+    public Map<String, Integer> getProcessedMessages() {
+        return stats.processedMessages();
+    }
+
+    /**
+     * Gets time local node has been coordinator since.
+     *
+     * @return Time local node is coordinator since.
+     */
+    public long getCoordinatorSinceTimestamp() {
+        return stats.coordinatorSinceTimestamp();
+    }
+
     /** {@inheritDoc} */
     @Override protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException {
         super.onContextInitialized0(spiCtx);


[2/3] incubator-ignite git commit: # IGNITE-943 Move TcpDiscoverySpiAdapter.MessageWorkerAdapter to TcpDiscoverySpi

Posted by se...@apache.org.
# IGNITE-943 Move TcpDiscoverySpiAdapter.MessageWorkerAdapter to TcpDiscoverySpi


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

Branch: refs/heads/ignite-943
Commit: f43cbbbb915da375fa89edf3120a0c8d52c26bfe
Parents: e5849fe
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 26 16:57:22 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 26 16:57:22 2015 +0300

----------------------------------------------------------------------
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 91 ++++++++++++++++++++
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   | 90 -------------------
 2 files changed, 91 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f43cbbbb/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 2123afc..37a07d6 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
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.events.*;
 import org.apache.ignite.internal.processors.security.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.future.*;
+import org.apache.ignite.internal.util.io.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -5321,4 +5322,94 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
             U.closeQuiet(sock);
         }
     }
+
+    /**
+     * Base class for message workers.
+     */
+    protected abstract class MessageWorkerAdapter extends IgniteSpiThread {
+        /** Pre-allocated output stream (100K). */
+        private final GridByteArrayOutputStream bout = new GridByteArrayOutputStream(100 * 1024);
+
+        /** Message queue. */
+        private final BlockingDeque<TcpDiscoveryAbstractMessage> queue = new LinkedBlockingDeque<>();
+
+        /** Backed interrupted flag. */
+        private volatile boolean interrupted;
+
+        /**
+         * @param name Thread name.
+         */
+        protected MessageWorkerAdapter(String name) {
+            super(gridName, name, log);
+
+            setPriority(threadPri);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected void body() throws InterruptedException {
+            if (log.isDebugEnabled())
+                log.debug("Message worker started [locNodeId=" + getLocalNodeId() + ']');
+
+            while (!isInterrupted()) {
+                TcpDiscoveryAbstractMessage msg = queue.poll(2000, TimeUnit.MILLISECONDS);
+
+                if (msg == null)
+                    continue;
+
+                processMessage(msg);
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public void interrupt() {
+            interrupted = true;
+
+            super.interrupt();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isInterrupted() {
+            return interrupted || super.isInterrupted();
+        }
+
+        /**
+         * @return Current queue size.
+         */
+        int queueSize() {
+            return queue.size();
+        }
+
+        /**
+         * Adds message to queue.
+         *
+         * @param msg Message to add.
+         */
+        void addMessage(TcpDiscoveryAbstractMessage msg) {
+            if (msg.highPriority())
+                queue.addFirst(msg);
+            else
+                queue.add(msg);
+
+            if (log.isDebugEnabled())
+                log.debug("Message has been added to queue: " + msg);
+        }
+
+        /**
+         * @param msg Message.
+         */
+        protected abstract void processMessage(TcpDiscoveryAbstractMessage msg);
+
+        /**
+         * @param sock Socket.
+         * @param msg Message.
+         * @throws IOException If IO failed.
+         * @throws IgniteCheckedException If marshalling failed.
+         */
+        protected final void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg)
+            throws IOException, IgniteCheckedException {
+            bout.reset();
+
+            TcpDiscoverySpi.this.writeToSocket(sock, msg, bout);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f43cbbbb/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
index d5ea9f2..4349ebc 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
@@ -1185,96 +1185,6 @@ public abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements
     }
 
     /**
-     * Base class for message workers.
-     */
-    protected abstract class MessageWorkerAdapter extends IgniteSpiThread {
-        /** Pre-allocated output stream (100K). */
-        private final GridByteArrayOutputStream bout = new GridByteArrayOutputStream(100 * 1024);
-
-        /** Message queue. */
-        private final BlockingDeque<TcpDiscoveryAbstractMessage> queue = new LinkedBlockingDeque<>();
-
-        /** Backed interrupted flag. */
-        private volatile boolean interrupted;
-
-        /**
-         * @param name Thread name.
-         */
-        protected MessageWorkerAdapter(String name) {
-            super(gridName, name, log);
-
-            setPriority(threadPri);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected void body() throws InterruptedException {
-            if (log.isDebugEnabled())
-                log.debug("Message worker started [locNodeId=" + getLocalNodeId() + ']');
-
-            while (!isInterrupted()) {
-                TcpDiscoveryAbstractMessage msg = queue.poll(2000, TimeUnit.MILLISECONDS);
-
-                if (msg == null)
-                    continue;
-
-                processMessage(msg);
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void interrupt() {
-            interrupted = true;
-
-            super.interrupt();
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean isInterrupted() {
-            return interrupted || super.isInterrupted();
-        }
-
-        /**
-         * @return Current queue size.
-         */
-        int queueSize() {
-            return queue.size();
-        }
-
-        /**
-         * Adds message to queue.
-         *
-         * @param msg Message to add.
-         */
-        void addMessage(TcpDiscoveryAbstractMessage msg) {
-            if (msg.highPriority())
-                queue.addFirst(msg);
-            else
-                queue.add(msg);
-
-            if (log.isDebugEnabled())
-                log.debug("Message has been added to queue: " + msg);
-        }
-
-        /**
-         * @param msg Message.
-         */
-        protected abstract void processMessage(TcpDiscoveryAbstractMessage msg);
-
-        /**
-         * @param sock Socket.
-         * @param msg Message.
-         * @throws IOException If IO failed.
-         * @throws IgniteCheckedException If marshalling failed.
-         */
-        protected final void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg)
-            throws IOException, IgniteCheckedException {
-            bout.reset();
-
-            TcpDiscoverySpiAdapter.this.writeToSocket(sock, msg, bout);
-        }
-    }
-
-    /**
      * Allow to connect to addresses parallel.
      */
     protected class SocketMultiConnector implements AutoCloseable {


[3/3] incubator-ignite git commit: # IGNITE-943 Extract SocketMultiConnector class.

Posted by se...@apache.org.
# IGNITE-943 Extract SocketMultiConnector class.


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

Branch: refs/heads/ignite-943
Commit: 2f169f5799fe9fca46b022f9c7f55dc37b816a74
Parents: f43cbbb
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 26 19:16:43 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 26 19:16:43 2015 +0300

----------------------------------------------------------------------
 .../spi/discovery/tcp/SocketMultiConnector.java | 144 +++++++++++++++++++
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   2 +-
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   | 116 ---------------
 3 files changed, 145 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f169f57/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/SocketMultiConnector.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/SocketMultiConnector.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/SocketMultiConnector.java
new file mode 100644
index 0000000..b988ceb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/SocketMultiConnector.java
@@ -0,0 +1,144 @@
+/*
+ * 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.tcp;
+
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.spi.*;
+import org.jetbrains.annotations.*;
+
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Allow to connect to addresses parallel.
+ */
+class SocketMultiConnector implements AutoCloseable {
+    /** */
+    private int connInProgress;
+
+    /** */
+    private final ExecutorService executor;
+
+    /** */
+    private final CompletionService<GridTuple3<InetSocketAddress, Socket, Exception>> completionSrvc;
+
+    /**
+     * @param spi Discovery SPI.
+     * @param addrs Addresses.
+     * @param retryCnt Retry count.
+     */
+    SocketMultiConnector(final TcpDiscoverySpiAdapter spi, Collection<InetSocketAddress> addrs,
+        final int retryCnt) {
+        connInProgress = addrs.size();
+
+        executor = Executors.newFixedThreadPool(Math.min(1, addrs.size()));
+
+        completionSrvc = new ExecutorCompletionService<>(executor);
+
+        for (final InetSocketAddress addr : addrs) {
+            completionSrvc.submit(new Callable<GridTuple3<InetSocketAddress, Socket, Exception>>() {
+                @Override public GridTuple3<InetSocketAddress, Socket, Exception> call() {
+                    Exception ex = null;
+                    Socket sock = null;
+
+                    for (int i = 0; i < retryCnt; i++) {
+                        if (Thread.currentThread().isInterrupted())
+                            return null; // Executor is shutdown.
+
+                        try {
+                            sock = spi.openSocket(addr);
+
+                            break;
+                        }
+                        catch (Exception e) {
+                            ex = e;
+                        }
+                    }
+
+                    return new GridTuple3<>(addr, sock, ex);
+                }
+            });
+        }
+    }
+
+    /**
+     *
+     */
+    @Nullable public GridTuple3<InetSocketAddress, Socket, Exception> next() {
+        if (connInProgress == 0)
+            return null;
+
+        try {
+            Future<GridTuple3<InetSocketAddress, Socket, Exception>> fut = completionSrvc.take();
+
+            connInProgress--;
+
+            return fut.get();
+        }
+        catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+
+            throw new IgniteSpiException("Thread has been interrupted.", e);
+        }
+        catch (ExecutionException e) {
+            throw new IgniteSpiException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() {
+        List<Runnable> unstartedTasks = executor.shutdownNow();
+
+        connInProgress -= unstartedTasks.size();
+
+        if (connInProgress > 0) {
+            Thread thread = new Thread(new Runnable() {
+                @Override public void run() {
+                    try {
+                        executor.awaitTermination(5, TimeUnit.MINUTES);
+
+                        Future<GridTuple3<InetSocketAddress, Socket, Exception>> fut;
+
+                        while ((fut = completionSrvc.poll()) != null) {
+                            try {
+                                GridTuple3<InetSocketAddress, Socket, Exception> tuple3 = fut.get();
+
+                                if (tuple3 != null)
+                                    IgniteUtils.closeQuiet(tuple3.get2());
+                            }
+                            catch (ExecutionException ignore) {
+
+                            }
+                        }
+                    }
+                    catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+
+                        throw new RuntimeException(e);
+                    }
+                }
+            });
+
+            thread.setDaemon(true);
+
+            thread.start();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f169f57/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 37a07d6..8ceac1c 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
@@ -1344,7 +1344,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
             boolean retry = false;
             Collection<Exception> errs = new ArrayList<>();
 
-            try (SocketMultiConnector multiConnector = new SocketMultiConnector(addrs, 2)) {
+            try (SocketMultiConnector multiConnector = new SocketMultiConnector(this, addrs, 2)) {
                 GridTuple3<InetSocketAddress, Socket, Exception> tuple;
 
                 while ((tuple = multiConnector.next()) != null) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f169f57/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
index 4349ebc..ddbea0c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
@@ -22,7 +22,6 @@ import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.io.*;
-import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
@@ -39,7 +38,6 @@ import org.jetbrains.annotations.*;
 import java.io.*;
 import java.net.*;
 import java.util.*;
-import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
 /**
@@ -1184,118 +1182,4 @@ public abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements
         }
     }
 
-    /**
-     * Allow to connect to addresses parallel.
-     */
-    protected class SocketMultiConnector implements AutoCloseable {
-        /** */
-        private int connInProgress;
-
-        /** */
-        private final ExecutorService executor;
-
-        /** */
-        private final CompletionService<GridTuple3<InetSocketAddress, Socket, Exception>> completionSrvc;
-
-        /**
-         * @param addrs Addresses.
-         * @param retryCnt Retry count.
-         */
-        public SocketMultiConnector(Collection<InetSocketAddress> addrs, final int retryCnt) {
-            connInProgress = addrs.size();
-
-            executor = Executors.newFixedThreadPool(Math.min(1, addrs.size()));
-
-            completionSrvc = new ExecutorCompletionService<>(executor);
-
-            for (final InetSocketAddress addr : addrs) {
-                completionSrvc.submit(new Callable<GridTuple3<InetSocketAddress, Socket, Exception>>() {
-                    @Override public GridTuple3<InetSocketAddress, Socket, Exception> call() {
-                        Exception ex = null;
-                        Socket sock = null;
-
-                        for (int i = 0; i < retryCnt; i++) {
-                            if (Thread.currentThread().isInterrupted())
-                                return null; // Executor is shutdown.
-
-                            try {
-                                sock = openSocket(addr);
-
-                                break;
-                            }
-                            catch (Exception e) {
-                                ex = e;
-                            }
-                        }
-
-                        return new GridTuple3<>(addr, sock, ex);
-                    }
-                });
-            }
-        }
-
-        /**
-         *
-         */
-        @Nullable public GridTuple3<InetSocketAddress, Socket, Exception> next() {
-            if (connInProgress == 0)
-                return null;
-
-            try {
-                Future<GridTuple3<InetSocketAddress, Socket, Exception>> fut = completionSrvc.take();
-
-                connInProgress--;
-
-                return fut.get();
-            }
-            catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-
-                throw new IgniteSpiException("Thread has been interrupted.", e);
-            }
-            catch (ExecutionException e) {
-                throw new IgniteSpiException(e);
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void close() {
-            List<Runnable> unstartedTasks = executor.shutdownNow();
-
-            connInProgress -= unstartedTasks.size();
-
-            if (connInProgress > 0) {
-                Thread thread = new Thread(new Runnable() {
-                    @Override public void run() {
-                        try {
-                            executor.awaitTermination(5, TimeUnit.MINUTES);
-
-                            Future<GridTuple3<InetSocketAddress, Socket, Exception>> fut;
-
-                            while ((fut = completionSrvc.poll()) != null) {
-                                try {
-                                    GridTuple3<InetSocketAddress, Socket, Exception> tuple3 = fut.get();
-
-                                    if (tuple3 != null)
-                                        IgniteUtils.closeQuiet(tuple3.get2());
-                                }
-                                catch (ExecutionException ignore) {
-
-                                }
-                            }
-                        }
-                        catch (InterruptedException e) {
-                            Thread.currentThread().interrupt();
-
-                            throw new RuntimeException(e);
-                        }
-                    }
-                });
-
-                thread.setDaemon(true);
-
-                thread.start();
-            }
-        }
-    }
 }