You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "eolivelli (via GitHub)" <gi...@apache.org> on 2023/03/08 18:04:55 UTC
[GitHub] [pulsar] eolivelli commented on a diff in pull request #19754: [fix][meta] Fix deadlock causes session notification is not to work
eolivelli commented on code in PR #19754:
URL: https://github.com/apache/pulsar/pull/19754#discussion_r1129848204
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/coordination/impl/LeaderElectionImpl.java:
##########
@@ -111,13 +112,13 @@ private synchronized CompletableFuture<LeaderElectionState> elect() {
} else {
return tryToBecomeLeader();
}
- }).thenComposeAsync(leaderElectionState -> {
+ }).thenCompose(leaderElectionState -> {
Review Comment:
Using thenCompose makes it basically unpredictable the thread that executed the callback.
This is way CompletableFuture sucks about threading.
If the Future is already completed then the callback is executed immediately.
Sometimes the callback is executed in the thread that completes the future, and something it is executed in any thread that calls 'get'
This fix may work.
I don't have time today to take a more careful look
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org