Search in sources :

Example 1 with CompletableFutureTask

use of com.hazelcast.util.executor.CompletableFutureTask in project hazelcast by hazelcast.

the class AbstractCacheProxyBase method submitLoadAllTask.

@SuppressWarnings("unchecked")
void submitLoadAllTask(LoadAllTask loadAllTask) {
    ExecutionService executionService = nodeEngine.getExecutionService();
    final CompletableFutureTask<Object> future = (CompletableFutureTask<Object>) executionService.submit("loadAll-" + nameWithPrefix, loadAllTask);
    loadAllTasks.add(future);
    future.andThen(new ExecutionCallback() {

        @Override
        public void onResponse(Object response) {
            loadAllTasks.remove(future);
        }

        @Override
        public void onFailure(Throwable t) {
            loadAllTasks.remove(future);
            getNodeEngine().getLogger(getClass()).warning("Problem in loadAll task", t);
        }
    });
}
Also used : CompletableFutureTask(com.hazelcast.util.executor.CompletableFutureTask) PrefixedDistributedObject(com.hazelcast.core.PrefixedDistributedObject) AbstractDistributedObject(com.hazelcast.spi.AbstractDistributedObject) ExecutionService(com.hazelcast.spi.ExecutionService) ExecutionCallback(com.hazelcast.core.ExecutionCallback)

Aggregations

ExecutionCallback (com.hazelcast.core.ExecutionCallback)1 PrefixedDistributedObject (com.hazelcast.core.PrefixedDistributedObject)1 AbstractDistributedObject (com.hazelcast.spi.AbstractDistributedObject)1 ExecutionService (com.hazelcast.spi.ExecutionService)1 CompletableFutureTask (com.hazelcast.util.executor.CompletableFutureTask)1