use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class RaftInvocationManager method triggerRaftNodeCreation.
void triggerRaftNodeCreation(CPGroupSummary group) {
for (CPMember groupMember : group.members()) {
if (groupMember.equals(raftService.getLocalCPMember())) {
ExecutionService executionService = nodeEngine.getExecutionService();
executionService.execute(CP_SUBSYSTEM_EXECUTOR, () -> raftService.createRaftNode(group.id(), group.initialMembers()));
} else {
Operation op = new CreateRaftNodeOp(group.id(), group.initialMembers());
OperationService operationService = nodeEngine.getOperationService();
operationService.send(op, groupMember.getAddress());
}
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class MetadataRaftGroupManager method broadcastActiveCPMembers.
void broadcastActiveCPMembers() {
if (!(isDiscoveryCompleted() && isMetadataGroupLeader())) {
return;
}
RaftGroupId metadataGroupId = getMetadataGroupId();
long commitIndex = this.activeMembersCommitIndex;
Collection<CPMemberInfo> cpMembers = this.activeMembers;
if (cpMembers.isEmpty()) {
return;
}
Set<Member> clusterMembers = nodeEngine.getClusterService().getMembers();
OperationService operationService = nodeEngine.getOperationService();
Operation op = new PublishActiveCPMembersOp(metadataGroupId, commitIndex, cpMembers);
for (Member member : clusterMembers) {
if (member.localMember()) {
continue;
}
operationService.send(op, member.getAddress());
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class MetadataRaftGroupManager method sendTerminateRaftNodeOpsForDestroyedGroup.
private void sendTerminateRaftNodeOpsForDestroyedGroup(CPGroupInfo group) {
Map<UUID, CPMemberInfo> activeMembersMap = getActiveMembersMap();
CPMemberInfo localCPMember = getLocalCPMember();
if (localCPMember == null) {
return;
}
RaftEndpoint localEndpoint = localCPMember.toRaftEndpoint();
OperationService operationService = nodeEngine.getOperationService();
for (RaftEndpoint endpoint : group.members()) {
if (endpoint.equals(localEndpoint)) {
terminateRaftNodeAsync(group.id());
} else {
Operation op = new TerminateRaftNodesOp(Collections.singleton(group.id()));
CPMemberInfo cpMember = activeMembersMap.get(endpoint.getUuid());
operationService.invokeOnTarget(SERVICE_NAME, op, cpMember.getAddress());
}
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class ExecutorServiceProxy method submitToPartitionOwner.
private <T> void submitToPartitionOwner(@Nonnull Callable<T> task, @Nullable ExecutionCallback<T> callback, int partitionId) {
checkNotShutdown();
checkNotNull(task, "task must not be null");
NodeEngine nodeEngine = getNodeEngine();
Data taskData = nodeEngine.toData(task);
CallableTaskOperation op = new CallableTaskOperation(name, null, taskData);
OperationService operationService = nodeEngine.getOperationService();
InvocationFuture<T> future = operationService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, partitionId).invoke();
if (callback != null) {
future.whenCompleteAsync(new ExecutionCallbackAdapter<>(callback)).whenCompleteAsync((v, t) -> {
if (t instanceof RejectedExecutionException) {
callback.onFailure(t);
}
});
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class ExecutorServiceProxy method shutdown.
@Override
public void shutdown() {
NodeEngine nodeEngine = getNodeEngine();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
OperationService operationService = nodeEngine.getOperationService();
Collection<Future> calls = new LinkedList<>();
for (Member member : members) {
Future f = submitShutdownOperation(operationService, member);
calls.add(f);
}
waitWithDeadline(calls, 3, TimeUnit.SECONDS, shutdownExceptionHandler);
}
Aggregations