use of com.hazelcast.spi.InvocationBuilder in project hazelcast by hazelcast.
the class MapPublisherCreateWithValueMessageTask method createInvocations.
private void createInvocations(Collection<MemberImpl> members, List<Future> futures) {
final InternalOperationService operationService = nodeEngine.getOperationService();
final ClientEndpoint endpoint = getEndpoint();
for (MemberImpl member : members) {
Predicate predicate = serializationService.toObject(parameters.predicate);
AccumulatorInfo accumulatorInfo = AccumulatorInfo.createAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, true, parameters.populate, parameters.coalesce);
PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
operation.setCallerUuid(endpoint.getUuid());
Address address = member.getAddress();
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
Future future = invocationBuilder.invoke();
futures.add(future);
}
}
use of com.hazelcast.spi.InvocationBuilder in project hazelcast by hazelcast.
the class MapDestroyCacheMessageTask method createInvocations.
private void createInvocations(Collection<MemberImpl> members, List<Future<Boolean>> futures) {
InternalOperationService operationService = nodeEngine.getOperationService();
for (MemberImpl member : members) {
DestroyQueryCacheOperation operation = new DestroyQueryCacheOperation(parameters.mapName, parameters.cacheName);
operation.setCallerUuid(endpoint.getUuid());
Address address = member.getAddress();
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
Future future = invocationBuilder.invoke();
futures.add(future);
}
}
use of com.hazelcast.spi.InvocationBuilder in project hazelcast by hazelcast.
the class MapReduceService method processRequest.
public <R> R processRequest(Address address, ProcessingOperation processingOperation) throws ExecutionException, InterruptedException {
InvocationBuilder invocation = nodeEngine.getOperationService().createInvocationBuilder(SERVICE_NAME, processingOperation, address);
Future<R> future = invocation.invoke();
return future.get();
}
use of com.hazelcast.spi.InvocationBuilder in project hazelcast by hazelcast.
the class MapReduceUtil method executeOperation.
public static <V> V executeOperation(Operation operation, Address address, MapReduceService mapReduceService, NodeEngine nodeEngine) {
ClusterService cs = nodeEngine.getClusterService();
OperationService os = nodeEngine.getOperationService();
boolean returnsResponse = operation.returnsResponse();
try {
if (cs.getThisAddress().equals(address)) {
// Locally we can call the operation directly
operation.setNodeEngine(nodeEngine);
operation.setCallerUuid(nodeEngine.getLocalMember().getUuid());
operation.setService(mapReduceService);
operation.run();
if (returnsResponse) {
return (V) operation.getResponse();
}
} else {
if (returnsResponse) {
InvocationBuilder ib = os.createInvocationBuilder(SERVICE_NAME, operation, address);
return (V) ib.invoke().get();
} else {
os.send(operation, address);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
Aggregations