mattisonchao commented on code in PR #19869:
URL: https://github.com/apache/pulsar/pull/19869#discussion_r1142837929
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/coordination/impl/LeaderElectionImpl.java:
##########
@@ -277,18 +279,18 @@ public Optional<T> getLeaderValueIfPresent() {
private void handleSessionNotification(SessionEvent event) {
// Ensure we're only processing one session event at a time.
- executor.execute(SafeRunnable.safeRun(() -> {
+ sequencer.sequential(() -> FutureUtil.composeAsync(() -> {
if (event == SessionEvent.SessionReestablished) {
log.info("Revalidating leadership for {}", path);
-
- try {
- LeaderElectionState les = elect().get();
- log.info("Resynced leadership for {} - State: {}", path,
les);
- } catch (ExecutionException | InterruptedException e) {
- log.warn("Failure when processing session event", e);
- }
+ return elect().thenAccept(leaderState -> {
Review Comment:
Should we give it a timeout handler for defensive programming?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]