use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.
the class WriteBehindStore method executeNotifyOperation.
private void executeNotifyOperation(Sequence flushSequence) {
if (!flushSequence.isFullFlush() || !nodeEngine.getPartitionService().isPartitionOwner(partitionId)) {
return;
}
Operation operation = new NotifyMapFlushOperation(mapName, flushSequence.getSequence());
operation.setServiceName(SERVICE_NAME).setNodeEngine(nodeEngine).setPartitionId(partitionId).setCallerUuid(nodeEngine.getLocalMember().getUuid()).setOperationResponseHandler(createEmptyResponseHandler());
operationService.execute(operation);
}
use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.
the class ScheduledExecutorContainer method publishTaskState.
/**
* State is published after every run.
* When replicas get promoted, they start with the latest state.
*/
void publishTaskState(String taskName, Map stateSnapshot, ScheduledTaskStatisticsImpl statsSnapshot, ScheduledTaskResult result) {
if (logger.isFinestEnabled()) {
log(FINEST, "Publishing state, to replicas. State: " + stateSnapshot);
}
Operation op = new SyncStateOperation(getName(), taskName, stateSnapshot, statsSnapshot, result);
createInvocationBuilder(op).invoke().joinInternal();
}
use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.
the class InvokeOnMembers method retryFailedTargets.
private void retryFailedTargets() throws InterruptedException, ExecutionException {
List<Member> failedMembers = new LinkedList<Member>();
for (Map.Entry<Member, Object> memberResult : results.entrySet()) {
Member member = memberResult.getKey();
Object result = memberResult.getValue();
if (result instanceof Throwable) {
failedMembers.add(member);
}
}
for (Member failedMember : failedMembers) {
Operation operation = operationFactory.get();
Future future = operationService.createInvocationBuilder(serviceName, operation, failedMember.getAddress()).invoke();
results.put(failedMember, future);
}
for (Member failedMember : failedMembers) {
Future future = (Future) results.get(failedMember);
Object result = future.get();
results.put(failedMember, result);
}
}
use of com.hazelcast.spi.impl.operationservice.Operation 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<>();
for (Member member : members) {
Operation op = new ShutdownOperation(name);
calls.add(operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress()));
}
waitWithDeadline(calls, SHUTDOWN_TIMEOUT, TimeUnit.SECONDS, shutdownExceptionHandler);
}
use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.
the class ScheduledFutureProxy method getDelay.
@Override
public long getDelay(TimeUnit unit) {
checkNotNull(unit, "Unit is null");
checkAccessibleHandler();
checkAccessibleOwner();
Operation op = new GetDelayOperation(handler, unit);
return this.<Long>invoke(op).joinInternal();
}
Aggregations