Maybe die before trying to log cause

This commit reorders a maybe die check and a logging statement for the
following reasons:
 - we should die as quickly as possible if the cause is fatal
 - we do not want the JVM to be so broken that when we try to log
   another exception is thrown (maybe another out of memory exception)
   and then the maybe die is never invoked
 - maybe die will log the cause anyway if the cause is fatal so we only
   need to log if the cause is not fatal
This commit is contained in:
Jason Tedor 2017-10-01 09:45:36 -04:00
parent 1084c7b6b2
commit 5869a7482b
1 changed files with 1 additions and 1 deletions

View File

@ -321,8 +321,8 @@ public class Netty4Transport extends TcpTransport<Channel> {
listener.onResponse(channel);
} else {
final Throwable cause = f.cause();
logger.error("write and flush on the network layer failed", cause);
Netty4Utils.maybeDie(cause);
logger.error("write and flush on the network layer failed", cause);
assert cause instanceof Exception;
listener.onFailure((Exception) cause);
}