Log the rejected listener notification task under a dedicated logger name.

- Fixes #2166
- Some user applications are fine with the failure of notification
This commit is contained in:
Trustin Lee 2014-02-07 10:22:04 -08:00
parent 96216a9657
commit 2ba00cd358

View File

@ -31,6 +31,8 @@ import static java.util.concurrent.TimeUnit.*;
public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(DefaultPromise.class);
private static final InternalLogger rejectedExecutionLogger =
InternalLoggerFactory.getInstance(DefaultPromise.class.getName() + ".rejectedExecution");
private static final int MAX_LISTENER_STACK_DEPTH = 8;
private static final ThreadLocal<Integer> LISTENER_STACK_DEPTH = new ThreadLocal<Integer>() {
@ -574,7 +576,6 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
}
}
try {
if (listeners instanceof DefaultFutureListeners) {
final DefaultFutureListeners dfl = (DefaultFutureListeners) listeners;
execute(executor, new Runnable() {
@ -596,9 +597,6 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
}
});
}
} catch (Throwable t) {
logger.error("Failed to notify listener(s). Event loop shut down?", t);
}
}
private static void notifyListeners0(Future<?> future, DefaultFutureListeners listeners) {
@ -671,7 +669,7 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
try {
executor.execute(task);
} catch (Throwable t) {
logger.error("Failed to notify a listener. Event loop shut down?", t);
rejectedExecutionLogger.error("Failed to submit a listener notification task. Event loop shut down?", t);
}
}