You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/02/14 13:53:49 UTC

[ignite] 02/02: IGNITE-10748 Changes after removal dead code: code style & inspections fix

This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 3af0c944dafa37eaa2171b0e98d9a1dd75c50768
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Thu Feb 14 16:53:38 2019 +0300

    IGNITE-10748 Changes after removal dead code: code style & inspections fix
---
 .../spi/communication/tcp/TcpCommunicationSpi.java | 43 +++++++++++-----------
 1 file changed, 21 insertions(+), 22 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index de029f7..0f0d0d4 100755
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -34,7 +34,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.BitSet;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
@@ -3218,7 +3217,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
 
             boolean sameHost = U.sameMacs(getSpiContext().localNode(), node);
 
-            Collections.sort(addrs0, U.inetAddressesComparator(sameHost));
+            addrs0.sort(U.inetAddressesComparator(sameHost));
 
             addrs = new LinkedHashSet<>(addrs0);
         }
@@ -3277,10 +3276,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
      * @throws IgniteCheckedException If failed.
      */
     protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx) throws IgniteCheckedException {
-        GridNioSession session = createNioSession(node, connIdx);
+        GridNioSession ses = createNioSession(node, connIdx);
 
-        return session == null ?
-            null : new GridTcpNioCommunicationClient(connIdx, session, log);
+        return ses == null ?
+            null : new GridTcpNioCommunicationClient(connIdx, ses, log);
     }
 
     /**
@@ -3315,7 +3314,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
     private GridNioSession createNioSession(ClusterNode node, int connIdx) throws IgniteCheckedException {
         Collection<InetSocketAddress> addrs = nodeAddresses(node);
 
-        GridNioSession session = null;
+        GridNioSession ses = null;
         IgniteCheckedException errs = null;
 
         long totalTimeout;
@@ -3337,7 +3336,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
                 maxConnTimeout
             );
 
-            while (session == null) { // Reconnection on handshake timeout.
+            while (ses == null) { // Reconnection on handshake timeout.
                 if (stopping)
                     throw new IgniteSpiException("Node is stopping.");
 
@@ -3377,11 +3376,11 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
                         U.closeQuiet(ch);
 
                         // Ensure the session is closed.
-                        GridNioSession ses = recoveryDesc.session();
+                        GridNioSession sesFromRecovery = recoveryDesc.session();
 
-                        if (ses != null) {
-                            while (ses.closeTime() == 0)
-                                ses.close();
+                        if (sesFromRecovery != null) {
+                            while (sesFromRecovery.closeTime() == 0)
+                                sesFromRecovery.close();
                         }
 
                         return null;
@@ -3468,10 +3467,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
                         meta.put(CONN_IDX_META, connKey);
                         meta.put(GridNioServer.RECOVERY_DESC_META_KEY, recoveryDesc);
 
-                        session = nioSrvr.createSession(ch, meta, false, null).get();
+                        ses = nioSrvr.createSession(ch, meta, false, null).get();
                     }
                     finally {
-                        if (session == null) {
+                        if (ses == null) {
                             U.closeQuiet(ch);
 
                             if (recoveryDesc != null)
@@ -3480,10 +3479,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
                     }
                 }
                 catch (IgniteSpiOperationTimeoutException e) { // Handshake is timed out.
-                    if (session != null) {
-                        session.close();
+                    if (ses != null) {
+                        ses.close();
 
-                        session = null;
+                        ses = null;
                     }
 
                     onException("Handshake timed out (will retry with increased timeout) [connTimeoutStrategy=" + connTimeoutStgy +
@@ -3519,10 +3518,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
                 }
                 catch (Exception e) {
                     // Most probably IO error on socket connect or handshake.
-                    if (session != null) {
-                        session.close();
+                    if (ses != null) {
+                        ses.close();
 
-                        session = null;
+                        ses = null;
                     }
 
                     onException("Client creation failed [addr=" + addr + ", err=" + e + ']', e);
@@ -3569,14 +3568,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
                 }
             }
 
-            if (session != null)
+            if (ses != null)
                 break;
         }
 
-        if (session == null)
+        if (ses == null)
             processSessionCreationError(node, addrs, errs == null ? new IgniteCheckedException("No session found") : errs);
 
-        return session;
+        return ses;
     }
 
     /**