refactoring

pull/2691/head
Nikita Koksharov 5 years ago
parent 740d5199dd
commit efba350f8b

@ -31,10 +31,7 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiConsumer;
import org.redisson.SlotCallback;
import org.redisson.api.RFuture;
import org.redisson.api.RedissonClient;
import org.redisson.api.RedissonReactiveClient;
import org.redisson.api.RedissonRxClient;
import org.redisson.api.*;
import org.redisson.cache.LRUCacheMap;
import org.redisson.client.RedisClient;
import org.redisson.client.RedisException;
@ -654,9 +651,9 @@ public class CommandAsyncService implements CommandAsyncExecutor {
RPromise<R> result = new RedissonPromise<>();
AtomicReference<Throwable> failed = new AtomicReference<>();
AtomicLong executed = new AtomicLong(range2key.size());
BiConsumer<List<?>, Throwable> listener = (t, u) -> {
BiConsumer<BatchResult<?>, Throwable> listener = (t, u) -> {
if (u == null) {
for (T res : (List<T>) t) {
for (T res : (List<T>) t.getResponses()) {
if (res != null) {
callback.onSlotResult(res);
}
@ -690,7 +687,7 @@ public class CommandAsyncService implements CommandAsyncExecutor {
}
}
RFuture<List<?>> future = executorService.executeAsync();
RFuture<BatchResult<?>> future = executorService.executeAsync();
future.onComplete(listener);
}

@ -173,7 +173,7 @@ public class CommandBatchService extends CommandAsyncService {
return promise;
}
public RFuture<List<?>> executeAsync() {
public RFuture<BatchResult<?>> executeAsync() {
return executeAsync(BatchOptions.defaults());
}
@ -184,7 +184,7 @@ public class CommandBatchService extends CommandAsyncService {
if (commands.isEmpty()) {
executed.set(true);
BatchResult<Object> result = new BatchResult<Object>(Collections.emptyList(), 0);
BatchResult<Object> result = new BatchResult<>(Collections.emptyList(), 0);
return (RFuture<R>) RedissonPromise.newSucceededFuture(result);
}

@ -224,7 +224,7 @@ public class RedissonTransaction implements RTransaction {
return;
}
RFuture<List<?>> transactionFuture = transactionExecutor.executeAsync();
RFuture<BatchResult<?>> transactionFuture = transactionExecutor.executeAsync();
transactionFuture.onComplete((r, exc) -> {
if (exc != null) {
result.tryFailure(new TransactionException("Unable to execute transaction", exc));
@ -581,7 +581,7 @@ public class RedissonTransaction implements RTransaction {
}
RPromise<Void> result = new RedissonPromise<>();
RFuture<List<?>> future = executorService.executeAsync();
RFuture<BatchResult<?>> future = executorService.executeAsync();
future.onComplete((res, e) -> {
if (e != null) {
result.tryFailure(new TransactionException("Unable to rollback transaction", e));

Loading…
Cancel
Save