From 8f309499276dcfb596bab755fd7a51fa2d13c1a7 Mon Sep 17 00:00:00 2001 From: Nikita Date: Mon, 18 Sep 2017 14:54:26 +0300 Subject: [PATCH] refactoring --- .../org/redisson/command/CommandBatchService.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/redisson/src/main/java/org/redisson/command/CommandBatchService.java b/redisson/src/main/java/org/redisson/command/CommandBatchService.java index 3a009e1b9..13b2583af 100644 --- a/redisson/src/main/java/org/redisson/command/CommandBatchService.java +++ b/redisson/src/main/java/org/redisson/command/CommandBatchService.java @@ -45,7 +45,6 @@ import org.redisson.connection.ConnectionManager; import org.redisson.connection.MasterSlaveEntry; import org.redisson.connection.NodeSource; import org.redisson.connection.NodeSource.Redirect; -import org.redisson.misc.LogHelper; import org.redisson.misc.RPromise; import org.redisson.misc.RedissonObjectFactory; @@ -277,7 +276,7 @@ public class CommandBatchService extends CommandAsyncService { if (future.isCancelled() && connectionFuture.cancel(false)) { log.debug("Connection obtaining canceled for batch"); details.getTimeout().cancel(); - if (details.getAttemptPromise().cancel(false)) { + if (attemptPromise.cancel(false)) { free(entry); } } @@ -301,7 +300,7 @@ public class CommandBatchService extends CommandAsyncService { if (details.getException() == null) { details.setException(new RedisTimeoutException("Unable to send batch after " + connectionManager.getConfig().getRetryAttempts() + " retry attempts")); } - details.getAttemptPromise().tryFailure(details.getException()); + attemptPromise.tryFailure(details.getException()); } return; } @@ -418,14 +417,14 @@ public class CommandBatchService extends CommandAsyncService { private void checkWriteFuture(Entry entry, final RPromise attemptPromise, AsyncDetails details, final RedisConnection connection, ChannelFuture future, boolean noResult, long responseTimeout, int attempts) { - if (future.isCancelled() || details.getAttemptPromise().isDone()) { + if (future.isCancelled() || attemptPromise.isDone()) { return; } if (!future.isSuccess()) { details.setException(new WriteRedisConnectionException("Can't write command batch to channel: " + future.channel(), future.cause())); if (details.getAttempt() == attempts) { - details.getAttemptPromise().tryFailure(details.getException()); + attemptPromise.tryFailure(details.getException()); } return; } @@ -461,8 +460,8 @@ public class CommandBatchService extends CommandAsyncService { return; } - if (details.getAttemptPromise().isDone() || details.getMainPromise().isDone()) { - releaseConnection(source, connFuture, details.isReadOnlyMode(), details.getAttemptPromise(), details); + if (attemptPromise.isDone() || details.getMainPromise().isDone()) { + releaseConnection(source, connFuture, details.isReadOnlyMode(), attemptPromise, details); return; }