@Override public CompletableFuture<Void> start() { registerListeners(); return memberGroupService.start().thenCompose(v -> { MemberGroup group = memberGroupService.getMemberGroup(clusterMembershipService.getLocalMember()); if (group != null) { return primaryElection.enter(new GroupMember(clusterMembershipService.getLocalMember().id(), group.id())); } return CompletableFuture.completedFuture(null); }).thenApply(v -> { started.set(true); return null; }); }
@Override public CompletableFuture<Void> start() { registerListeners(); compactTimer = threadContext.schedule(Duration.ofSeconds(30), this::compact); return memberGroupService.start().thenComposeAsync(v -> { MemberGroup group = memberGroupService.getMemberGroup(clusterMembershipService.getLocalMember()); primaryElection.addListener(primaryElectionListener); if (group != null) { return primaryElection.enter(new GroupMember(clusterMembershipService.getLocalMember().id(), group.id())) .thenApply(term -> { changeRole(term); return null; }); } return CompletableFuture.completedFuture(null); }, threadContext).thenApply(v -> { started.set(true); return null; }); }
@Override public CompletableFuture<Void> start() { registerListeners(); compactTimer = threadContext.schedule(Duration.ofSeconds(30), this::compact); return memberGroupService.start().thenComposeAsync(v -> { MemberGroup group = memberGroupService.getMemberGroup(clusterMembershipService.getLocalMember()); primaryElection.addListener(primaryElectionListener); if (group != null) { return primaryElection.enter(new GroupMember(clusterMembershipService.getLocalMember().id(), group.id())) .thenApply(term -> { changeRole(term); return null; }); } return CompletableFuture.completedFuture(null); }, threadContext).thenApply(v -> { started.set(true); return null; }); }