@Override protected <R> RPromise<R> createPromise() { if (isRedisBasedQueue()) { return new BatchPromise<R>(executed); } return super.createPromise(); }
@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); }
@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); }
@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 <R> RPromise<R> createPromise() { if (isRedisBasedQueue()) { return new BatchPromise<R>(executed); } return super.createPromise(); }
@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 <R> RPromise<R> createPromise() { if (isRedisBasedQueue()) { return new BatchPromise<R>(executed); } return super.createPromise(); }
@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); }
@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(); } }