use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class QueueProxySupport method invokeAndGetData.
private Object invokeAndGetData(QueueOperation operation) {
final NodeEngine nodeEngine = getNodeEngine();
try {
OperationService operationService = nodeEngine.getOperationService();
Future f = operationService.invokeOnPartition(QueueService.SERVICE_NAME, operation, partitionId);
return f.get();
} catch (Throwable throwable) {
throw rethrow(throwable);
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class ExecutorServiceProxy method submitToMember.
private <T> void submitToMember(@Nonnull Data taskData, @Nonnull Member member, @Nullable ExecutionCallback<T> callback) {
checkNotNull(member, "member must not be null");
checkNotShutdown();
NodeEngine nodeEngine = getNodeEngine();
UUID uuid = newUnsecureUUID();
MemberCallableTaskOperation op = new MemberCallableTaskOperation(name, uuid, taskData);
OperationService operationService = nodeEngine.getOperationService();
Address address = member.getAddress();
InvocationFuture<T> future = operationService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, address).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 DurableExecutorServiceProxy 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) {
ShutdownOperation op = new ShutdownOperation(name);
Future f = operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress());
calls.add(f);
}
waitWithDeadline(calls, 3, TimeUnit.SECONDS, shutdownExceptionHandler);
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class OnJoinOp method run.
@Override
public void run() throws Exception {
if (!operations.isEmpty()) {
SecurityConfig securityConfig = getNodeEngine().getConfig().getSecurityConfig();
boolean runPermissionUpdates = securityConfig.getOnJoinPermissionOperation() == OnJoinPermissionOperationName.RECEIVE;
for (Operation op : operations) {
if ((op instanceof UpdatePermissionConfigOperation) && !runPermissionUpdates) {
continue;
}
try {
// not running via OperationService since we don't want any restrictions like cluster state check etc.
runDirect(op);
} catch (Exception e) {
getLogger().warning("Error while running post-join operation: " + op, e);
}
}
final ClusterService clusterService = getService();
// if executed on master, broadcast to all other members except sender (joining member)
if (clusterService.isMaster()) {
final OperationService operationService = getNodeEngine().getOperationService();
for (Member member : clusterService.getMembers()) {
if (!member.localMember() && !member.getUuid().equals(getCallerUuid())) {
OnJoinOp operation = new OnJoinOp(operations);
operationService.invokeOnTarget(getServiceName(), operation, member.getAddress());
}
}
}
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class FinalizeJoinOp method sendPostJoinOperationsBackToMaster.
private void sendPostJoinOperationsBackToMaster() {
final ClusterServiceImpl clusterService = getService();
final NodeEngineImpl nodeEngine = clusterService.getNodeEngine();
// Post join operations must be lock free; means no locks at all;
// no partition locks, no key-based locks, no service level locks!
Collection<Operation> postJoinOperations = nodeEngine.getPostJoinOperations();
if (postJoinOperations != null && !postJoinOperations.isEmpty()) {
final OperationService operationService = nodeEngine.getOperationService();
// send post join operations to master and it will broadcast it to all members
Address masterAddress = clusterService.getMasterAddress();
OnJoinOp operation = new OnJoinOp(postJoinOperations);
operationService.invokeOnTarget(ClusterServiceImpl.SERVICE_NAME, operation, masterAddress);
}
}
Aggregations