use of org.redisson.transaction.operation.TransactionalOperation in project redisson by redisson.
the class RedissonTransaction method rollbackAsync.
@Override
public RFuture<Void> rollbackAsync() {
checkState();
CommandBatchService executorService = new CommandBatchService(commandExecutor);
for (TransactionalOperation transactionalOperation : operations) {
transactionalOperation.rollback(executorService);
}
RPromise<Void> result = new RedissonPromise<>();
RFuture<BatchResult<?>> future = executorService.executeAsync();
future.onComplete((res, e) -> {
if (e != null) {
result.tryFailure(new TransactionException("Unable to rollback transaction", e));
return;
}
operations.clear();
executed.set(true);
result.trySuccess(null);
});
return result;
}
use of org.redisson.transaction.operation.TransactionalOperation in project redisson by redisson.
the class BaseTransactionalSet method addAsync.
public RFuture<Boolean> addAsync(V value) {
long threadId = Thread.currentThread().getId();
TransactionalOperation operation = createAddOperation(value, threadId);
return addAsync(value, operation);
}
Aggregations