Skip to content

Commit

Permalink
Fix a bug in DefaultPromise.notifyLateListener() where the listener i…
Browse files Browse the repository at this point in the history
…s 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.
  • Loading branch information
trustin committed May 23, 2014
1 parent 53e3548 commit 47f961b
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ private void notifyLateListener(final GenericFutureListener<?> l) {
} finally {
LISTENER_STACK_DEPTH.set(stackDepth);
}
return;
}
} else {
LateListeners lateListeners = this.lateListeners;
Expand All @@ -632,13 +633,14 @@ private void notifyLateListener(final GenericFutureListener<?> l) {
}
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(
Expand Down

0 comments on commit 47f961b

Please sign in to comment.