use of com.hazelcast.spi.impl.servicemanager.ServiceInfo 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();
}
use of com.hazelcast.spi.impl.servicemanager.ServiceInfo in project hazelcast by hazelcast.
the class ServiceManagerImplTest method getServiceInfo.
// ===================== getServiceInfo ================================
@Test
public void getServiceInfo() {
ServiceInfo result = serviceManager.getServiceInfo(MapService.SERVICE_NAME);
assertNotNull(result);
assertEquals(MapService.SERVICE_NAME, result.getName());
assertInstanceOf(MapService.class, result.getService());
}
use of com.hazelcast.spi.impl.servicemanager.ServiceInfo in project hazelcast by hazelcast.
the class ServiceManagerImplTest method getServiceInfo_notExisting.
@Test
public void getServiceInfo_notExisting() {
ServiceInfo result = serviceManager.getServiceInfo("notexisting");
assertNull(result);
}
use of com.hazelcast.spi.impl.servicemanager.ServiceInfo in project hazelcast by hazelcast.
the class TimedMemberStateFactory method isCacheServiceEnabled.
private boolean isCacheServiceEnabled() {
NodeEngineImpl nodeEngine = instance.node.nodeEngine;
Collection<ServiceInfo> serviceInfos = nodeEngine.getServiceInfos(CacheService.class);
return !serviceInfos.isEmpty();
}
use of com.hazelcast.spi.impl.servicemanager.ServiceInfo in project hazelcast by hazelcast.
the class ReplicaSyncRequest method createReplicationOperations.
private List<Operation> createReplicationOperations() {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
Collection<ServiceInfo> services = nodeEngine.getServiceInfos(MigrationAwareService.class);
PartitionReplicationEvent event = new PartitionReplicationEvent(getPartitionId(), getReplicaIndex());
List<Operation> tasks = new LinkedList<Operation>();
for (ServiceInfo serviceInfo : services) {
MigrationAwareService service = (MigrationAwareService) serviceInfo.getService();
Operation op = service.prepareReplicationOperation(event);
if (op != null) {
op.setServiceName(serviceInfo.getName());
tasks.add(op);
}
}
return tasks;
}
Aggregations