use of com.hazelcast.internal.util.ConcurrencyUtil.CALLER_RUNS in project hazelcast by hazelcast.
the class CacheAddPartitionLostListenerMessageTask method processInternal.
@Override
protected CompletableFuture<UUID> processInternal() {
CachePartitionLostListener listener = event -> {
if (endpoint.isAlive()) {
ClientMessage eventMessage = CacheAddPartitionLostListenerCodec.encodeCachePartitionLostEvent(event.getPartitionId(), event.getMember().getUuid());
sendClientMessage(null, eventMessage);
}
};
InternalCachePartitionLostListenerAdapter listenerAdapter = new InternalCachePartitionLostListenerAdapter(listener);
EventFilter filter = new CachePartitionLostEventFilter();
CacheService service = getService(CacheService.SERVICE_NAME);
EventService eventService = service.getNodeEngine().getEventService();
if (parameters.localOnly) {
return newCompletedFuture(eventService.registerLocalListener(ICacheService.SERVICE_NAME, parameters.name, filter, listenerAdapter).getId());
}
return eventService.registerListenerAsync(ICacheService.SERVICE_NAME, parameters.name, filter, listenerAdapter).thenApplyAsync(EventRegistration::getId, CALLER_RUNS);
}
use of com.hazelcast.internal.util.ConcurrencyUtil.CALLER_RUNS in project hazelcast by hazelcast.
the class ShutdownClusterMessageTask method call.
@Override
protected Object call() throws Exception {
ILogger logger = nodeEngine.getLogger(getClass());
ExecutionService executionService = nodeEngine.getExecutionService();
Future<Void> future = executionService.submit(ExecutionService.ASYNC_EXECUTOR, () -> {
nodeEngine.getClusterService().shutdown();
return null;
});
executionService.asCompletableFuture(future).whenCompleteAsync(withTryCatch(logger, (empty, error) -> sendResponse(error != null ? peel(error) : null)), CALLER_RUNS);
return null;
}
use of com.hazelcast.internal.util.ConcurrencyUtil.CALLER_RUNS in project hazelcast by hazelcast.
the class PromoteLiteMemberOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getNodeEngine().getLogger(getClass());
ExecutionService executionService = getNodeEngine().getExecutionService();
Future<Void> future = executionService.submit(ExecutionService.ASYNC_EXECUTOR, () -> {
getNodeEngine().getHazelcastInstance().getCluster().promoteLocalLiteMember();
return null;
});
executionService.asCompletableFuture(future).whenCompleteAsync(withTryCatch(logger, (empty, error) -> sendResponse(error != null ? peel(error) : null)), CALLER_RUNS);
}
use of com.hazelcast.internal.util.ConcurrencyUtil.CALLER_RUNS in project hazelcast by hazelcast.
the class ReadMetricsOperation method run.
@Override
public void run() {
ILogger logger = getNodeEngine().getLogger(getClass());
MetricsService service = getService();
CompletableFuture<RingbufferSlice<Entry<Long, byte[]>>> future = service.readMetrics(offset);
future.whenCompleteAsync(withTryCatch(logger, (slice, error) -> doSendResponse(error != null ? peel(error) : slice)), CALLER_RUNS);
}
Aggregations