use of com.hazelcast.internal.util.executor.CompletableFutureTask in project hazelcast by hazelcast.
the class CacheProxySupport method createAndSubmitLoadAllTask.
@SuppressWarnings("unchecked")
protected void createAndSubmitLoadAllTask(Set<Data> keysData, boolean replaceExistingValues, CompletionListener completionListener) {
try {
CacheProxyLoadAllTask loadAllTask = new CacheProxyLoadAllTask(getNodeEngine(), operationProvider, keysData, replaceExistingValues, completionListener, getServiceName());
ExecutionService executionService = getNodeEngine().getExecutionService();
final CompletableFutureTask<Object> future = (CompletableFutureTask<Object>) executionService.submit("loadAll-" + nameWithPrefix, loadAllTask);
loadAllTasks.add(future);
future.whenCompleteAsync((response, t) -> {
loadAllTasks.remove(future);
if (t != null) {
logger.warning("Problem in loadAll task", t);
}
});
} catch (Exception e) {
if (completionListener != null) {
completionListener.onException(e);
}
throw new CacheException(e);
}
}
Aggregations