SammyVimes commented on a change in pull request #135:
URL: https://github.com/apache/ignite-3/pull/135#discussion_r637374352
##########
File path:
modules/network/src/main/java/org/apache/ignite/network/internal/netty/ConnectionManager.java
##########
@@ -110,21 +125,24 @@ public SocketAddress getLocalAddress() {
/**
* Gets a {@link NettySender}, that sends data from this node to another
node with the specified address.
+ * @param consistentId Another node's consistent id.
* @param address Another node's address.
* @return Sender.
*/
- public CompletableFuture<NettySender> channel(SocketAddress address) {
- NettySender channel = channels.compute(
- address,
- (addr, sender) -> (sender == null || !sender.isOpen()) ? null :
sender
- );
-
- if (channel != null)
- return CompletableFuture.completedFuture(channel);
+ public CompletableFuture<NettySender> channel(@Nullable String
consistentId, SocketAddress address) {
+ if (consistentId != null) {
+ NettySender channel = channels.compute(
+ consistentId,
+ (addr, sender) -> (sender == null || !sender.isOpen()) ? null
: sender
+ );
+
+ if (channel != null)
+ return CompletableFuture.completedFuture(channel);
+ }
NettyClient client = clients.compute(address, (addr, existingClient) ->
existingClient != null && !existingClient.failedToConnect() &&
!existingClient.isDisconnected() ?
- existingClient : connect(addr)
+ existingClient : connect(addr, this::onMessage)
);
return client.sender();
Review comment:
Something is wrong with my IDEA, it stopped warning me about such
things. Definitely needs an assertion, thank you
--
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:
[email protected]