sashapolo commented on a change in pull request #161:
URL: https://github.com/apache/ignite-3/pull/161#discussion_r645422821
##########
File path:
modules/network/src/main/java/org/apache/ignite/network/internal/netty/HandshakeHandler.java
##########
@@ -41,31 +44,38 @@ public HandshakeHandler(HandshakeManager manager) {
}
/** {@inheritDoc} */
- @Override public void handlerAdded(ChannelHandlerContext ctx) throws
Exception {
+ @Override public void handlerAdded(ChannelHandlerContext ctx) {
HandshakeAction handshakeAction = manager.init(ctx.channel());
handleHandshakeAction(handshakeAction, ctx);
}
/** {@inheritDoc} */
- @Override public void channelActive(ChannelHandlerContext ctx) throws
Exception {
+ @Override public void channelActive(ChannelHandlerContext ctx) {
HandshakeAction handshakeAction =
manager.onConnectionOpen(ctx.channel());
+ manager.handshakeFuture().whenComplete((unused, throwable) -> {
+ if (throwable != null) {
+ LOG.error("Error when performing handshake", throwable);
+ ctx.close();
+ }
+ });
Review comment:
`exceptionally` is intended to be used as a recovery from an exception
(it returns a value). I think that `whenComplete` better suites this particular
use case
--
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]