protected <R> void executeLocked(final RPromise<R> promise, final Runnable runnable, RLock lock) { lock.lockAsync(timeout, TimeUnit.MILLISECONDS).addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (future.isSuccess()) { runnable.run(); } else { promise.tryFailure(future.cause()); } } }); }
private void unlock(final RPromise<V> result, RLock lock, long threadId, final V value) { lock.unlockAsync(threadId).addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (!future.isSuccess()) { result.tryFailure(future.cause()); return; } result.trySuccess(value); } }); }
private void awaitResultAsync(final RemoteInvocationOptions optionsCopy, final RemotePromise<Object> result, final String ackName, final RFuture<RRemoteServiceResponse> responseFuture) { RFuture<Boolean> deleteFuture = redisson.getBucket(ackName).deleteAsync(); deleteFuture.addListener(new FutureListener<Boolean>() { @Override public void operationComplete(Future<Boolean> future) throws Exception { if (!future.isSuccess()) { result.tryFailure(future.cause()); return; } awaitResultAsync(optionsCopy, result, responseFuture); } }); }
protected RMapCache<Object, Object> getMapCache(String name, CacheConfig config) { if (codec != null) { return redisson.getMapCache(name, codec); } return redisson.getMapCache(name); }
@Override public RBatch skipResult() { options.skipResult(); return this; }
@Override public RBatchReactive timeout(long timeout, TimeUnit unit) { options.responseTimeout(timeout, unit); return this; }
@Override public RBatch syncSlaves(int slaves, long timeout, TimeUnit unit) { options.syncSlaves(slaves, timeout, unit); return this; }
@Override public RFuture<V> call() throws Exception { return queue.takeAsync(); } });
public BaseTransactionalSet(CommandAsyncExecutor commandExecutor, long timeout, List<TransactionalOperation> operations, RCollectionAsync<V> set) { this.commandExecutor = commandExecutor; this.timeout = timeout; this.operations = operations; this.set = set; this.object = (RObject) set; this.name = object.getName(); }
@Override public RBatchRx retryInterval(long retryInterval, TimeUnit unit) { options.retryInterval(retryInterval, unit); return this; }
@Override public void commit(RMap<Object, Object> map) { if (oldValue != null) { map.replaceAsync(key, oldValue, value); } else { map.replaceAsync(key, value); } }
@Override public RFuture<V> call() throws Exception { return instance.takeLastAsync(); } });
private void awaitResultAsync(final RemoteInvocationOptions optionsCopy, final RemotePromise<Object> result, final String ackName, final RFuture<RRemoteServiceResponse> responseFuture) { RFuture<Boolean> deleteFuture = redisson.getBucket(ackName).deleteAsync(); deleteFuture.addListener(new FutureListener<Boolean>() { @Override public void operationComplete(Future<Boolean> future) throws Exception { if (!future.isSuccess()) { result.tryFailure(future.cause()); return; } awaitResultAsync(optionsCopy, result, responseFuture); } }); }
protected <R> void executeLocked(final RPromise<R> promise, final Runnable runnable, RLock lock) { lock.lockAsync(timeout, TimeUnit.MILLISECONDS).addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (future.isSuccess()) { runnable.run(); } else { promise.tryFailure(future.cause()); } } }); }
private void unlock(final RPromise<V> result, RLock lock, long threadId, final V value) { lock.unlockAsync(threadId).addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (!future.isSuccess()) { result.tryFailure(future.cause()); return; } result.trySuccess(value); } }); }
@Override public RBatchReactive skipResult() { options.skipResult(); return this; }
@Override public RBatchRx timeout(long timeout, TimeUnit unit) { options.responseTimeout(timeout, unit); return this; }
protected <R> void executeLocked(final RPromise<R> promise, final Runnable runnable, RLock lock) { lock.lockAsync(timeout, TimeUnit.MILLISECONDS).addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (future.isSuccess()) { runnable.run(); } else { promise.tryFailure(future.cause()); } } }); }
@Override public RBatchRx skipResult() { options.skipResult(); return this; }
protected <R> void executeLocked(final RPromise<R> promise, final Runnable runnable, RLock lock) { lock.lockAsync(timeout, TimeUnit.MILLISECONDS).addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (future.isSuccess()) { runnable.run(); } else { promise.tryFailure(future.cause()); } } }); }