refactoring

pull/3215/merge
Nikita Koksharov 3 years ago
parent cd240943ca
commit a32d5ac160

@ -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<T, R> implements QueueCommand {
return null;
} catch (CompletionException e) {
return e.getCause();
} catch (CancellationException e) {
return e;
}
}

@ -489,12 +489,13 @@ public class CommandBatchService extends CommandAsyncService {
}
protected void handle(CompletableFuture<Void> 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);
}
}

Loading…
Cancel
Save