Search in sources :

Example 1 with CommandBatching

use of io.lettuce.core.dynamic.batch.CommandBatching in project lettuce-core by lettuce-io.

the class BatchExecutableCommand method execute.

@Override
public Object execute(Object[] parameters) throws ExecutionException, InterruptedException {
    RedisCommand<Object, Object, Object> command = commandFactory.createCommand(parameters);
    CommandBatching batching = null;
    if (this.parameters.hasCommandBatchingIndex()) {
        batching = (CommandBatching) parameters[this.parameters.getCommandBatchingIndex()];
    }
    AsyncCommand<Object, Object, Object> asyncCommand = new AsyncCommand<>(command);
    if (async) {
        batcher.batch(asyncCommand, batching);
        return asyncCommand;
    }
    BatchTasks batchTasks = batcher.batch(asyncCommand, batching);
    return synchronize(batchTasks, connection);
}
Also used : CommandBatching(io.lettuce.core.dynamic.batch.CommandBatching) AsyncCommand(io.lettuce.core.protocol.AsyncCommand)

Aggregations

CommandBatching (io.lettuce.core.dynamic.batch.CommandBatching)1 AsyncCommand (io.lettuce.core.protocol.AsyncCommand)1