Fix a bug in DefaultPromise.notifyLateListener() where the listener is not notified

Motivation:

When (listeners == null && lateListeners == null) and (stackDepth >= MAX_LISTENER_STACK_DEPTH), the listener is not notified at all. The discard client does not work.

Modification:

Make sure to submit the notification task.

Result:

The discard client works again and all listeners are notified.
This commit is contained in:
Trustin Lee 2014-05-23 09:47:22 +09:00
parent 60a83fc6ac
commit c7825f63c0

View File

@ -624,6 +624,7 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
} finally {
LISTENER_STACK_DEPTH.set(stackDepth);
}
return;
}
} else {
LateListeners lateListeners = this.lateListeners;
@ -632,13 +633,14 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
}
lateListeners.add(l);
execute(executor, lateListeners);
return;
}
} else {
// Add the late listener to lateListeners in the executor thread for thread safety.
// We could just make LateListeners extend ConcurrentLinkedQueue, but it's an overkill considering
// that most asynchronous applications won't execute this code path.
execute(executor, new LateListenerNotifier(l));
}
// Add the late listener to lateListeners in the executor thread for thread safety.
// We could just make LateListeners extend ConcurrentLinkedQueue, but it's an overkill considering
// that most asynchronous applications won't execute this code path.
execute(executor, new LateListenerNotifier(l));
}
protected static void notifyListener(