use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class ConnectedClientOperationTest method testGetConnectedClientsOperation_WhenZeroClientConnects.
@Test
public void testGetConnectedClientsOperation_WhenZeroClientConnects() throws Exception {
HazelcastInstance instance = factory.newHazelcastInstance();
Node node = TestUtil.getNode(instance);
Operation operation = new GetConnectedClientsOperation();
OperationService operationService = node.nodeEngine.getOperationService();
Future<Map<String, ClientType>> future = operationService.invokeOnTarget(ClientEngineImpl.SERVICE_NAME, operation, node.address);
Map<String, ClientType> clients = future.get();
assertEquals(0, clients.size());
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class ExecutorServiceProxy method submitToMember.
@Override
public <T> void submitToMember(Callable<T> task, Member member, ExecutionCallback<T> callback) {
checkNotShutdown();
NodeEngine nodeEngine = getNodeEngine();
Data taskData = nodeEngine.toData(task);
String uuid = newUnsecureUuidString();
MemberCallableTaskOperation op = new MemberCallableTaskOperation(name, uuid, taskData);
OperationService operationService = nodeEngine.getOperationService();
Address address = ((MemberImpl) member).getAddress();
operationService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, address).setExecutionCallback((ExecutionCallback) callback).invoke();
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class ExecutorServiceProxy method submitToPartitionOwner.
private <T> void submitToPartitionOwner(Callable<T> task, ExecutionCallback<T> callback, int partitionId) {
checkNotShutdown();
NodeEngine nodeEngine = getNodeEngine();
Data taskData = nodeEngine.toData(task);
CallableTaskOperation op = new CallableTaskOperation(name, null, taskData);
OperationService operationService = nodeEngine.getOperationService();
operationService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, partitionId).setExecutionCallback((ExecutionCallback) callback).invoke();
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class MemberImpl method invokeOnAllMembers.
private void invokeOnAllMembers(Operation operation) {
NodeEngineImpl nodeEngine = instance.node.nodeEngine;
OperationService os = nodeEngine.getOperationService();
String uuid = nodeEngine.getLocalMember().getUuid();
operation.setCallerUuid(uuid).setNodeEngine(nodeEngine);
try {
for (Member member : nodeEngine.getClusterService().getMembers()) {
if (!member.localMember()) {
os.send(operation, member.getAddress());
} else {
os.execute(operation);
}
}
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class CancellableDelegatingFuture method invokeCancelOperation.
private Future<Boolean> invokeCancelOperation(boolean mayInterruptIfRunning) {
CancellationOperation op = new CancellationOperation(uuid, mayInterruptIfRunning);
OperationService opService = nodeEngine.getOperationService();
InvocationBuilder builder;
if (partitionId > -1) {
builder = opService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, partitionId);
} else {
builder = opService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, target);
}
builder.setTryCount(CANCEL_TRY_COUNT).setTryPauseMillis(CANCEL_TRY_PAUSE_MILLIS);
return builder.invoke();
}
Aggregations