use of com.hazelcast.spi.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<Future>();
for (Member member : members) {
if (member.localMember()) {
getService().shutdownExecutor(name);
} else {
Future f = submitShutdownOperation(operationService, member);
calls.add(f);
}
}
waitWithDeadline(calls, 1, TimeUnit.SECONDS, WHILE_SHUTDOWN_EXCEPTION_HANDLER);
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class BasicRecordStoreLoader method sendOperation.
private Future<?> sendOperation(List<Data> keyValueSequence, AtomicInteger finishedBatchCounter) {
OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
final Operation operation = createOperation(keyValueSequence, finishedBatchCounter);
//operationService.executeOperation(operation);
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class BasicRecordStoreLoader method removeExistingKeys.
private Future removeExistingKeys(List<Data> keys) {
OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
final Operation operation = new RemoveFromLoadAllOperation(name, keys);
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class MapReduceUtil method notifyRemoteException.
public static void notifyRemoteException(JobSupervisor supervisor, Throwable throwable) {
MapReduceService mapReduceService = supervisor.getMapReduceService();
NodeEngine nodeEngine = mapReduceService.getNodeEngine();
try {
Address jobOwner = supervisor.getJobOwner();
if (supervisor.isOwnerNode()) {
supervisor.notifyRemoteException(jobOwner, throwable);
} else {
String name = supervisor.getConfiguration().getName();
String jobId = supervisor.getConfiguration().getJobId();
NotifyRemoteExceptionOperation operation = new NotifyRemoteExceptionOperation(name, jobId, throwable);
OperationService os = nodeEngine.getOperationService();
os.send(operation, jobOwner);
}
} catch (Exception e) {
ILogger logger = nodeEngine.getLogger(MapReduceUtil.class);
logger.warning("Could not notify remote map-reduce owner", e);
}
}
use of com.hazelcast.spi.OperationService 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