You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2019/06/06 16:07:31 UTC

[GitHub] [ignite] nizhikov commented on a change in pull request #5619: IGNITE-10619: CommunicationSpi support channels initial commit

nizhikov commented on a change in pull request #5619: IGNITE-10619: CommunicationSpi support channels initial commit
URL: https://github.com/apache/ignite/pull/5619#discussion_r291259828
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
 ##########
 @@ -1593,6 +1658,75 @@ public boolean checkNodeLeft(UUID nodeId, IgniteCheckedException sndErr, boolean
             (ping && !ctx.discovery().pingNode(nodeId));
     }
 
+    /**
+     * @param node Destination node to connect to.
+     * @param topic Topic to send the request to.
+     * @param initMsg Channel initialization message.
+     * @return Established {@link Channel} to use.
+     * @throws IgniteCheckedException If fails.
+     */
+    private IgniteInternalFuture<Channel> openChannel(
+        ClusterNode node,
+        Object topic,
+        Message initMsg
+    ) throws IgniteCheckedException {
+        assert node != null;
+        assert topic != null;
+
+        if (locNodeId.equals(node.id()))
+            throw new IgniteCheckedException("Channel cannot be opened to the local node itself " +
+                "[nodeId=" + node.id() + ", topic=" + topic + ']');
+
+        int topicOrd = topic instanceof GridTopic ? ((Enum<GridTopic>)topic).ordinal() : -1;
+
+        GridIoMessage ioMsg = createGridIoMessage(topic, topicOrd, initMsg, PUBLIC_POOL, false, 0, false);
+
+        try {
+            if ((CommunicationSpi)getSpi() instanceof TcpCommunicationSpi) {
 
 Review comment:
   It' will be more readable if we invert condition
   ```
   if (! (instanceOf XXX)) {
      throw new ScaryException("XXX");
   }
   
   return ALL_OK;
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services