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:
parent
2e064ee87f
commit
78cf0e37e2
@ -31,6 +31,8 @@ import static java.util.concurrent.TimeUnit.*;
|
|||||||
public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
|
public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
|
||||||
|
|
||||||
private static final InternalLogger logger = InternalLoggerFactory.getInstance(DefaultPromise.class);
|
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 int MAX_LISTENER_STACK_DEPTH = 8;
|
||||||
private static final ThreadLocal<Integer> LISTENER_STACK_DEPTH = new ThreadLocal<Integer>() {
|
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) {
|
if (listeners instanceof DefaultFutureListeners) {
|
||||||
final DefaultFutureListeners dfl = (DefaultFutureListeners) listeners;
|
final DefaultFutureListeners dfl = (DefaultFutureListeners) listeners;
|
||||||
execute(executor, new Runnable() {
|
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) {
|
private static void notifyListeners0(Future<?> future, DefaultFutureListeners listeners) {
|
||||||
@ -671,7 +669,7 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
|
|||||||
try {
|
try {
|
||||||
executor.execute(task);
|
executor.execute(task);
|
||||||
} catch (Throwable t) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user