Die if write listener fails due to fatal error
This commit performs a maybe die check after a write listener fails.
@@ -320,13 +320,11 @@ 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) {
+ final Throwable cause = f.cause();
+ Netty4Utils.maybeDie(cause);
+ assert cause instanceof Exception;
listener.onFailure((Exception) cause);
}
- }
});
}
