com.hazelcast.core.ExecutionCallback Java Examples
The following examples show how to use
com.hazelcast.core.ExecutionCallback.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HazelcastCommandExecutor.java From concursus with MIT License | 6 votes |
@Override public void accept(Command command, CompletableFuture<CommandResult> commandResultCompletableFuture) { executorService.submitToKeyOwner( RemoteCommand.processing(command), command.getAggregateId().getId(), new ExecutionCallback<CommandResult>() { @Override public void onResponse(CommandResult commandResult) { commandResultCompletableFuture.complete(commandResult); } @Override public void onFailure(Throwable throwable) { commandResultCompletableFuture.completeExceptionally(throwable); } }); }
Example #2
Source File: HazelcastProxy.java From bucket4j with Apache License 2.0 | 5 votes |
private <T extends Serializable> CompletableFuture<CommandResult<T>> invokeAsync(K key, JCacheEntryProcessor<K, T> entryProcessor) { CompletableFuture<CommandResult<T>> future = new CompletableFuture<>(); cache.submitToKey(key, adoptEntryProcessor(entryProcessor), new ExecutionCallback() { @Override public void onResponse(Object response) { future.complete((CommandResult<T>) response); } @Override public void onFailure(Throwable t) { future.completeExceptionally(t); } }); return future; }
Example #3
Source File: AbstractAsyncStreamer.java From hazelcast-simulator with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void pushEntry(K key, V value) { if (storedException.get() != null) { throw new RuntimeException("Aborting pushEntry; problems are detected. Please check the cause", storedException.get()); } acquirePermit(1); try { ICompletableFuture<V> future = storeAsync(key, value); future.andThen(new ExecutionCallback<V>() { @Override public void onResponse(V response) { callback.onSuccess(response); } @Override public void onFailure(Throwable t) { callback.onFailure(t); } }); } catch (Exception e) { releasePermit(1); throw rethrow(e); } }