diff --git a/redisson/src/main/java/org/redisson/client/protocol/CommandData.java b/redisson/src/main/java/org/redisson/client/protocol/CommandData.java index be4cfeb35..6da5658fe 100644 --- a/redisson/src/main/java/org/redisson/client/protocol/CommandData.java +++ b/redisson/src/main/java/org/redisson/client/protocol/CommandData.java @@ -21,6 +21,7 @@ import org.redisson.misc.LogHelper; import java.util.Collections; import java.util.List; +import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; @@ -73,6 +74,8 @@ public class CommandData implements QueueCommand { return null; } catch (CompletionException e) { return e.getCause(); + } catch (CancellationException e) { + return e; } } diff --git a/redisson/src/main/java/org/redisson/command/CommandBatchService.java b/redisson/src/main/java/org/redisson/command/CommandBatchService.java index dc20c3ce1..a1fbebee1 100644 --- a/redisson/src/main/java/org/redisson/command/CommandBatchService.java +++ b/redisson/src/main/java/org/redisson/command/CommandBatchService.java @@ -489,12 +489,13 @@ public class CommandBatchService extends CommandAsyncService { } protected void handle(CompletableFuture mainPromise, AtomicInteger slots, RFuture future) { - if (future.isSuccess()) { + Throwable c = cause(future.toCompletableFuture()); + if (c == null) { if (slots.decrementAndGet() == 0) { mainPromise.complete(null); } } else { - mainPromise.completeExceptionally(future.cause()); + mainPromise.completeExceptionally(c); } }