Search in sources :

Example 1 with ShutdownOperation

use of com.hazelcast.durableexecutor.impl.operations.ShutdownOperation 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<Future>();
    for (Member member : members) {
        if (member.localMember()) {
            getService().shutdownExecutor(name);
        } else {
            ShutdownOperation op = new ShutdownOperation(name);
            Future f = operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress());
            calls.add(f);
        }
    }
    waitWithDeadline(calls, 1, TimeUnit.SECONDS, WHILE_SHUTDOWN_EXCEPTION_HANDLER);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) DurableExecutorServiceFuture(com.hazelcast.durableexecutor.DurableExecutorServiceFuture) DelegatingFuture(com.hazelcast.util.executor.DelegatingFuture) Future(java.util.concurrent.Future) CompletedFuture(com.hazelcast.util.executor.CompletedFuture) ShutdownOperation(com.hazelcast.durableexecutor.impl.operations.ShutdownOperation) OperationService(com.hazelcast.spi.OperationService) Member(com.hazelcast.core.Member) LinkedList(java.util.LinkedList)

Aggregations

Member (com.hazelcast.core.Member)1 DurableExecutorServiceFuture (com.hazelcast.durableexecutor.DurableExecutorServiceFuture)1 ShutdownOperation (com.hazelcast.durableexecutor.impl.operations.ShutdownOperation)1 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)1 NodeEngine (com.hazelcast.spi.NodeEngine)1 OperationService (com.hazelcast.spi.OperationService)1 CompletedFuture (com.hazelcast.util.executor.CompletedFuture)1 DelegatingFuture (com.hazelcast.util.executor.DelegatingFuture)1 LinkedList (java.util.LinkedList)1 Future (java.util.concurrent.Future)1