@Override protected <R> RPromise<R> createPromise() { if (isRedisBasedQueue()) { return new BatchPromise<R>(executed); } return super.createPromise(); }
@Override protected <R> RPromise<R> createPromise() { if (isRedisBasedQueue()) { return new BatchPromise<R>(executed); } return super.createPromise(); }
@Override protected <V, R> void releaseConnection(NodeSource source, RFuture<RedisConnection> connectionFuture, boolean isReadOnly, RPromise<R> attemptPromise, AsyncDetails<V, R> details) { if (!isRedisBasedQueue() || RedisCommands.EXEC.getName().equals(details.getCommand().getName())) { super.releaseConnection(source, connectionFuture, isReadOnly, attemptPromise, details); } }
@Override protected <V, R> void releaseConnection(NodeSource source, RFuture<RedisConnection> connectionFuture, boolean isReadOnly, RPromise<R> attemptPromise, AsyncDetails<V, R> details) { if (!isRedisBasedQueue() || RedisCommands.EXEC.getName().equals(details.getCommand().getName())) { super.releaseConnection(source, connectionFuture, isReadOnly, attemptPromise, details); } }
if (!isRedisBasedQueue()) { batchParams = params; if (!isRedisBasedQueue()) { return;
if (!isRedisBasedQueue()) { batchParams = params; if (!isRedisBasedQueue()) { return;
@Override protected <V, R> void handleSuccess(final AsyncDetails<V, R> details, RPromise<R> promise, RedisCommand<?> command, R res) { if (RedisCommands.EXEC.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, res); return; } if (RedisCommands.DISCARD.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, null); if (executed.compareAndSet(false, true)) { details.getConnectionFuture().getNow().forceFastReconnectAsync().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } }); } return; } if (isRedisBasedQueue()) { BatchPromise<R> batchPromise = (BatchPromise<R>) promise; RPromise<R> sentPromise = (RPromise<R>) batchPromise.getSentPromise(); super.handleSuccess(details, sentPromise, command, null); semaphore.release(); } }
@Override protected <V, R> void handleError(final AsyncDetails<V, R> details, RPromise<R> promise, Throwable cause) { if (isRedisBasedQueue() && promise instanceof BatchPromise) { BatchPromise<R> batchPromise = (BatchPromise<R>) promise; RPromise<R> sentPromise = (RPromise<R>) batchPromise.getSentPromise(); sentPromise.tryFailure(cause); promise.tryFailure(cause); if (executed.compareAndSet(false, true)) { details.getConnectionFuture().getNow().forceFastReconnectAsync().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } }); } semaphore.release(); return; } super.handleError(details, promise, cause); }
if (isRedisBasedQueue()) { int permits = 0; for (Entry entry : commands.values()) {
@Override protected <V, R> void handleError(final AsyncDetails<V, R> details, RPromise<R> promise, Throwable cause) { if (isRedisBasedQueue() && promise instanceof BatchPromise) { BatchPromise<R> batchPromise = (BatchPromise<R>) promise; RPromise<R> sentPromise = (RPromise<R>) batchPromise.getSentPromise(); sentPromise.tryFailure(cause); promise.tryFailure(cause); if (executed.compareAndSet(false, true)) { details.getConnectionFuture().getNow().forceFastReconnectAsync().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } }); } semaphore.release(); return; } super.handleError(details, promise, cause); }
if (isRedisBasedQueue()) { int permits = 0; for (Entry entry : commands.values()) {
@Override protected <V, R> void handleSuccess(final AsyncDetails<V, R> details, RPromise<R> promise, RedisCommand<?> command, R res) { if (RedisCommands.EXEC.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, res); return; } if (RedisCommands.DISCARD.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, null); if (executed.compareAndSet(false, true)) { details.getConnectionFuture().getNow().forceFastReconnectAsync().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } }); } return; } if (isRedisBasedQueue()) { BatchPromise<R> batchPromise = (BatchPromise<R>) promise; RPromise<R> sentPromise = (RPromise<R>) batchPromise.getSentPromise(); super.handleSuccess(details, sentPromise, command, null); semaphore.release(); } }
@Override protected <V> RFuture<RedisConnection> getConnection(boolean readOnlyMode, NodeSource source, RedisCommand<V> command) { if (!isRedisBasedQueue()) { return super.getConnection(readOnlyMode, source, command);
@Override protected <V> RFuture<RedisConnection> getConnection(boolean readOnlyMode, NodeSource source, RedisCommand<V> command) { if (!isRedisBasedQueue()) { return super.getConnection(readOnlyMode, source, command);
@Override protected <R, V> void sendCommand(AsyncDetails<V, R> details, RedisConnection connection) { if (!isRedisBasedQueue()) { super.sendCommand(details, connection); return;
@Override protected <R, V> void sendCommand(AsyncDetails<V, R> details, RedisConnection connection) { if (!isRedisBasedQueue()) { super.sendCommand(details, connection); return;
@Override protected <R> RPromise<R> createPromise() { if (isRedisBasedQueue()) { return new BatchPromise<R>(executed); } return super.createPromise(); }
@Override protected <V, R> void releaseConnection(NodeSource source, RFuture<RedisConnection> connectionFuture, boolean isReadOnly, RPromise<R> attemptPromise, AsyncDetails<V, R> details) { if (!isRedisBasedQueue() || RedisCommands.EXEC.getName().equals(details.getCommand().getName())) { super.releaseConnection(source, connectionFuture, isReadOnly, attemptPromise, details); } }
@Override protected <V, R> void handleSuccess(final AsyncDetails<V, R> details, RPromise<R> promise, RedisCommand<?> command, R res) { if (RedisCommands.EXEC.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, res); return; } if (RedisCommands.DISCARD.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, null); if (executed.compareAndSet(false, true)) { details.getConnectionFuture().getNow().forceFastReconnectAsync().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } }); } return; } if (isRedisBasedQueue()) { BatchPromise<R> batchPromise = (BatchPromise<R>) promise; RPromise<R> sentPromise = (RPromise<R>) batchPromise.getSentPromise(); super.handleSuccess(details, sentPromise, command, null); semaphore.release(); } }
@Override protected <V, R> void handleError(final AsyncDetails<V, R> details, RPromise<R> promise, Throwable cause) { if (isRedisBasedQueue() && promise instanceof BatchPromise) { BatchPromise<R> batchPromise = (BatchPromise<R>) promise; RPromise<R> sentPromise = (RPromise<R>) batchPromise.getSentPromise(); sentPromise.tryFailure(cause); promise.tryFailure(cause); if (executed.compareAndSet(false, true)) { details.getConnectionFuture().getNow().forceFastReconnectAsync().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } }); } semaphore.release(); return; } super.handleError(details, promise, cause); }