@Override protected <R> RPromise<R> createPromise() { if (isRedisBasedQueue()) { return new BatchPromise<R>(executed); } return super.createPromise(); }
@Override public void run(Timeout timeout) throws Exception { async(details.isReadOnlyMode(), source, details.getCodec(), details.getCommand(), details.getParams(), details.getMainPromise(), details.getAttempt(), ignoreRedirect); } }, 1, TimeUnit.SECONDS);
public TasksBatchService(Codec codec, RedissonClient redisson, String name, CommandExecutor commandExecutor, String executorId, ConcurrentMap<String, ResponseEntry> responses) { super(codec, redisson, name, commandExecutor, executorId, responses); batchCommandService = new CommandBatchService(commandExecutor.getConnectionManager()); }
@Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } });
@Override public <T, R> RFuture<R> readAsync(byte[] key, Codec codec, RedisCommand<T> command, Object... params) { RPromise<R> mainPromise = createPromise(); NodeSource source = getNodeSource(key); async(true, source, codec, command, params, mainPromise, 0, false); return mainPromise; }
@Override public <T, R> R evalRead(String key, Codec codec, RedisCommand<T> evalCommandType, String script, List<Object> keys, Object ... params) { RFuture<R> res = evalReadAsync(key, codec, evalCommandType, script, keys, params); return get(res); }
@Override public <T, R> R evalWrite(String key, Codec codec, RedisCommand<T> evalCommandType, String script, List<Object> keys, Object ... params) { RFuture<R> res = evalWriteAsync(key, codec, evalCommandType, script, keys, params); return get(res); }
protected void free(final Entry entry) { for (BatchCommandData<?, ?> command : entry.getCommands()) { free(command.getParams()); } }
public RFuture<MapScanResult<Object, Object>> scanIteratorAsync(String name, RedisClient client, long startPos, String pattern, int count) { if (pattern == null) { RFuture<MapScanResult<Object, Object>> f = commandExecutor.readAsync(client, name, codec, RedisCommands.HSCAN, name, startPos, "COUNT", count); return f; } RFuture<MapScanResult<Object, Object>> f = commandExecutor.readAsync(client, name, codec, RedisCommands.HSCAN, name, startPos, "MATCH", pattern, "COUNT", count); return f; }
@Override public void operationComplete(Future<Object> future) throws Exception { handle(voidPromise, slots, future); } });
@Override public <V, R> void async(boolean readOnlyMode, NodeSource nodeSource, Codec codec, RedisCommand<V> command, Object[] params, RPromise<R> mainPromise, int attempt, boolean ignoreRedirect) { batchService.async(readOnlyMode, nodeSource, codec, command, params, mainPromise, attempt, ignoreRedirect); }
@Override public void run(Timeout timeout) throws Exception { async(details.isReadOnlyMode(), source, details.getCodec(), details.getCommand(), details.getParams(), details.getMainPromise(), details.getAttempt(), ignoreRedirect); } }, 1, TimeUnit.SECONDS);
public TasksBatchService(Codec codec, RedissonClient redisson, String name, CommandExecutor commandExecutor, String executorId, ConcurrentMap<String, ResponseEntry> responses) { super(codec, redisson, name, commandExecutor, executorId, responses); batchCommandService = new CommandBatchService(commandExecutor.getConnectionManager()); }
@Override public <T, R> RFuture<R> writeAsync(String key, Codec codec, RedisCommand<T> command, Object... params) { RPromise<R> mainPromise = createPromise(); NodeSource source = getNodeSource(key); async(false, source, codec, command, params, mainPromise, 0, false); return mainPromise; }
@Override protected <R> RPromise<R> createPromise() { if (isRedisBasedQueue()) { return new BatchPromise<R>(executed); } return super.createPromise(); }
@Override public <T, R> R evalRead(String key, Codec codec, RedisCommand<T> evalCommandType, String script, List<Object> keys, Object ... params) { RFuture<R> res = evalReadAsync(key, codec, evalCommandType, script, keys, params); return get(res); }
public RFuture<MapScanResult<Object, Object>> scanIteratorAsync(String name, RedisClient client, long startPos, String pattern, int count) { if (pattern == null) { RFuture<MapScanResult<Object, Object>> f = commandExecutor.readAsync(client, name, codec, RedisCommands.HSCAN, name, startPos, "COUNT", count); return f; } RFuture<MapScanResult<Object, Object>> f = commandExecutor.readAsync(client, name, codec, RedisCommands.HSCAN, name, startPos, "MATCH", pattern, "COUNT", count); return f; }
@Override public <T, R> RFuture<R> readAsync(byte[] key, Codec codec, RedisCommand<T> command, Object... params) { RPromise<R> mainPromise = createPromise(); NodeSource source = getNodeSource(key); async(true, source, codec, command, params, mainPromise, 0, false); return mainPromise; }
public RFuture<ListScanResult<Object>> scanIteratorAsync(RedisClient client, MasterSlaveEntry entry, long startPos, String pattern, int count) { if (pattern == null) { return commandExecutor.readAsync(client, entry, StringCodec.INSTANCE, RedisCommands.SCAN, startPos, "COUNT", count); } return commandExecutor.readAsync(client, entry, StringCodec.INSTANCE, RedisCommands.SCAN, startPos, "MATCH", pattern, "COUNT", count); }