Die if write listener fails due to fatal error

This commit performs a maybe die check after a write listener fails.
This commit is contained in:
Jason Tedor 2017-09-30 18:52:54 -04:00
parent 4f8131026e
commit f79842be6f
1 changed files with 4 additions and 6 deletions

View File

@ -320,12 +320,10 @@ public class Netty4Transport extends TcpTransport<Channel> {
if (f.isSuccess()) {
listener.onResponse(channel);
} else {
Throwable cause = f.cause();
// If the Throwable is an Error something has gone very wrong and Netty4MessageChannelHandler is
// going to cause that to bubble up and kill the process.
if (cause instanceof Exception) {
listener.onFailure((Exception) cause);
}
final Throwable cause = f.cause();
Netty4Utils.maybeDie(cause);
assert cause instanceof Exception;
listener.onFailure((Exception) cause);
}
});
}