use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class ClearOperation method replicateClearOperation.
private void replicateClearOperation(long version) {
final OperationService operationService = getNodeEngine().getOperationService();
Collection<Address> members = getMemberAddresses();
for (Address address : members) {
ClearOperation clearOperation = new ClearOperation(mapName, false, version);
clearOperation.setPartitionId(getPartitionId());
clearOperation.setValidateTarget(false);
operationService.createInvocationBuilder(getServiceName(), clearOperation, address).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class ScheduledExecutorServiceProxy method shutdown.
@Override
public void shutdown() {
NodeEngine nodeEngine = getNodeEngine();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
OperationService operationService = nodeEngine.getOperationService();
Collection<Future> calls = new LinkedList<Future>();
for (Member member : members) {
if (member.localMember()) {
getService().shutdownExecutor(name);
} else {
Operation op = new ShutdownOperation(name);
calls.add(operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress()));
}
}
waitWithDeadline(calls, SHUTDOWN_TIMEOUT, TimeUnit.SECONDS, WHILE_SHUTDOWN_EXCEPTION_HANDLER);
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class EventServiceImpl method invokeRegistrationOnOtherNodes.
private void invokeRegistrationOnOtherNodes(String serviceName, Registration reg) {
OperationService operationService = nodeEngine.getOperationService();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
Collection<Future> calls = new ArrayList<Future>(members.size());
for (Member member : members) {
if (!member.localMember()) {
RegistrationOperation operation = new RegistrationOperation(reg);
Future f = operationService.invokeOnTarget(serviceName, operation, member.getAddress());
calls.add(f);
}
}
waitWithDeadline(calls, REGISTRATION_TIMEOUT_SECONDS, TimeUnit.SECONDS, registrationExceptionHandler);
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class EventServiceImpl method invokeDeregistrationOnOtherNodes.
private void invokeDeregistrationOnOtherNodes(String serviceName, String topic, String id) {
OperationService operationService = nodeEngine.getOperationService();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
Collection<Future> calls = new ArrayList<Future>(members.size());
for (Member member : members) {
if (!member.localMember()) {
DeregistrationOperation operation = new DeregistrationOperation(topic, id);
Future f = operationService.invokeOnTarget(serviceName, operation, member.getAddress());
calls.add(f);
}
}
waitWithDeadline(calls, DEREGISTER_TIMEOUT_SECONDS, TimeUnit.SECONDS, deregistrationExceptionHandler);
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class PartitionIteratingOperation method executeOperations.
private void executeOperations() {
NodeEngine nodeEngine = getNodeEngine();
OperationResponseHandler responseHandler = new OperationResponseHandlerImpl(partitions);
OperationService operationService = nodeEngine.getOperationService();
Object service = getServiceName() == null ? null : getService();
for (int partitionId : partitions) {
Operation operation = operationFactory.createOperation().setNodeEngine(nodeEngine).setPartitionId(partitionId).setReplicaIndex(getReplicaIndex()).setOperationResponseHandler(responseHandler).setServiceName(getServiceName()).setService(service).setCallerUuid(extractCallerUuid());
OperationAccessor.setCallerAddress(operation, getCallerAddress());
operationService.execute(operation);
}
}
Aggregations