use of com.hazelcast.cp.internal.datastructures.spi.RaftManagedService in project hazelcast by hazelcast.
the class RaftService method resetLocalRaftState.
private void resetLocalRaftState() {
// node.forceSetTerminatedStatus() will trigger RaftNodeLifecycleAwareService.onRaftGroupDestroyed()
// which will attempt to acquire the read lock on nodeLock. In order to prevent it, we first
// add group ids into destroyedGroupIds to short-cut RaftNodeLifecycleAwareService.onRaftGroupDestroyed()
List<InternalCompletableFuture> futures = new ArrayList<>(nodes.size());
destroyedGroupIds.addAll(nodes.keySet());
for (RaftNode node : nodes.values()) {
InternalCompletableFuture f = node.forceSetTerminatedStatus();
futures.add(f);
}
for (InternalCompletableFuture future : futures) {
try {
future.get();
} catch (Exception e) {
logger.warning(e);
}
}
nodes.clear();
for (ServiceInfo serviceInfo : nodeEngine.getServiceInfos(RaftRemoteService.class)) {
if (serviceInfo.getService() instanceof RaftManagedService) {
((RaftManagedService) serviceInfo.getService()).onCPSubsystemRestart();
}
}
nodeMetrics.clear();
missingMembers.clear();
invocationManager.reset();
}
Aggregations