|
32 | 32 | import java.time.Duration;
|
33 | 33 | import java.util.Map;
|
34 | 34 | import java.util.concurrent.CompletableFuture;
|
35 |
| -import java.util.concurrent.CompletionStage; |
36 | 35 | import java.util.function.Function;
|
37 | 36 |
|
38 | 37 | /**
|
39 | 38 | * Periodically polls the cluster status and caches the result.
|
40 | 39 | *
|
41 | 40 | * Accepts the following messages:
|
42 |
| - * STATUS: Replies with a StatusResponse message containing the service status data |
43 |
| - * HEALTH: Replies with a boolean value |
44 |
| - * ClusterEvent.CurrentClusterState: Updates the cached state of the cluster |
| 41 | + * {@link StatusRequest}: Replies with a StatusResponse message containing the service status data |
| 42 | + * {@link HealthRequest}: Replies with a boolean value, true indicating healthy, false indicating unhealthy |
45 | 43 | *
|
46 | 44 | * Internal-only messages:
|
47 |
| - * POLL: Triggers an update of the cluster data. |
| 45 | + * {@link AssociationErrorEvent}: Evaluates the possibility of the node being quarantined |
48 | 46 | *
|
49 | 47 | * @author Brandon Arp (brandon dot arp at inscopemetrics dot com)
|
50 | 48 | */
|
@@ -93,15 +91,6 @@ public Receive createReceive() {
|
93 | 91 | }
|
94 | 92 | })
|
95 | 93 | .match(HealthRequest.class, message -> {
|
96 |
| - final CompletionStage<ClusterStatusCache.StatusResponse> stateFuture = PatternsCS |
97 |
| - .ask( |
98 |
| - _clusterStatusCache, |
99 |
| - new ClusterStatusCache.GetRequest(), |
100 |
| - Duration.ofSeconds(3)) |
101 |
| - .thenApply(CAST_MAPPER); |
102 |
| - PatternsCS.pipe(stateFuture, context().dispatcher()).to(self(), sender()); |
103 |
| - }) |
104 |
| - .match(ClusterStatusCache.StatusResponse.class, response -> { |
105 | 94 | final boolean healthy = _cluster.readView().self().status() == MemberStatus.up() && !_quarantined;
|
106 | 95 | sender().tell(healthy, getSelf());
|
107 | 96 | })
|
|
0 commit comments