Created
November 29, 2016 14:31
-
-
Save johnou/4b8d0d82cc80b0efd48a1882f24e8db7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: transport/src/main/java/io/netty/channel/DefaultChannelPromise.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- transport/src/main/java/io/netty/channel/DefaultChannelPromise.java (date 1476448287000) | |
+++ transport/src/main/java/io/netty/channel/DefaultChannelPromise.java (revision ) | |
@@ -20,6 +20,8 @@ | |
import io.netty.util.concurrent.EventExecutor; | |
import io.netty.util.concurrent.Future; | |
import io.netty.util.concurrent.GenericFutureListener; | |
+import io.netty.util.internal.logging.InternalLogger; | |
+import io.netty.util.internal.logging.InternalLoggerFactory; | |
/** | |
* The default {@link ChannelPromise} implementation. It is recommended to use {@link Channel#newPromise()} to create | |
@@ -27,6 +29,8 @@ | |
*/ | |
public class DefaultChannelPromise extends DefaultPromise<Void> implements ChannelPromise, FlushCheckpoint { | |
+ static final InternalLogger logger = InternalLoggerFactory.getInstance(DefaultChannelPromise.class); | |
+ | |
private final Channel channel; | |
private long checkpoint; | |
@@ -71,10 +75,25 @@ | |
return setSuccess(null); | |
} | |
+ private Exception stacktrace; | |
+ | |
@Override | |
public ChannelPromise setSuccess(Void result) { | |
super.setSuccess(result); | |
+ if (logger.isDebugEnabled()) { | |
+ stacktrace = new Exception(); | |
+ } | |
return this; | |
+ } | |
+ | |
+ @Override | |
+ public boolean tryFailure(Throwable cause) { | |
+ boolean result = super.tryFailure(cause); | |
+ if (!result && stacktrace != null) { | |
+ logger.error("Trace of success marker", stacktrace); | |
+ logger.error("Trace of failure", new Exception()); | |
+ } | |
+ return result; | |
} | |
@Override |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment