public <T, R> CommandData<T, R> create(Codec encoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); return new CommandData<T, R>(promise, encoder, command, params); }
public <T, R> CommandData<T, R> create(Codec encoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); return new CommandData<T, R>(promise, encoder, command, params); }
private <T, R> ChannelFuture async(MultiDecoder<Object> messageDecoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); return channel.writeAndFlush(new CommandData<T, R>(promise, messageDecoder, null, command, params)); }
private <T, R> ChannelFuture async(MultiDecoder<Object> messageDecoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); return channel.writeAndFlush(new CommandData<T, R>(promise, messageDecoder, null, command, params)); }
public <T, R> R sync(Codec encoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); send(new CommandData<T, R>(promise, encoder, command, params)); return await(promise); }
public <T, R> R sync(Codec encoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); send(new CommandData<T, R>(promise, encoder, command, params)); return await(promise); }
protected <R, V> void sendCommand(final AsyncDetails<V, R> details, final RedisConnection connection) { if (details.getSource().getRedirect() == Redirect.ASK) { List<CommandData<?, ?>> list = new ArrayList<CommandData<?, ?>>(2); RPromise<Void> promise = new RedissonPromise<Void>(); list.add(new CommandData<Void, Void>(promise, details.getCodec(), RedisCommands.ASKING, new Object[]{})); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); RPromise<Void> main = new RedissonPromise<Void>(); ChannelFuture future = connection.send(new CommandsData(main, list, false)); details.setWriteFuture(future); } else { if (log.isDebugEnabled()) { log.debug("acquired connection for command {} and params {} from slot {} using node {}... {}", details.getCommand(), LogHelper.toString(details.getParams()), details.getSource(), connection.getRedisClient().getAddr(), connection); } ChannelFuture future = connection.send(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); details.setWriteFuture(future); } }
protected <R, V> void sendCommand(final AsyncDetails<V, R> details, final RedisConnection connection) { if (details.getSource().getRedirect() == Redirect.ASK) { List<CommandData<?, ?>> list = new ArrayList<CommandData<?, ?>>(2); RPromise<Void> promise = new RedissonPromise<Void>(); list.add(new CommandData<Void, Void>(promise, details.getCodec(), RedisCommands.ASKING, new Object[]{})); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); RPromise<Void> main = new RedissonPromise<Void>(); ChannelFuture future = connection.send(new CommandsData(main, list, false)); details.setWriteFuture(future); } else { if (log.isDebugEnabled()) { log.debug("acquired connection for command {} and params {} from slot {} using node {}... {}", details.getCommand(), LogHelper.toString(details.getParams()), details.getSource(), connection.getRedisClient().getAddr(), connection); } ChannelFuture future = connection.send(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); details.setWriteFuture(future); } }
List<CommandData<?, ?>> list = new ArrayList<CommandData<?, ?>>(2); RPromise<Void> promise = new RedissonPromise<Void>(); list.add(new CommandData<Void, Void>(promise, details.getCodec(), RedisCommands.ASKING, new Object[]{})); if (connectionEntry.isFirstCommand()) { list.add(new CommandData<Void, Void>(promise, details.getCodec(), RedisCommands.MULTI, new Object[]{})); connectionEntry.setFirstCommand(false); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); RPromise<Void> main = new RedissonPromise<Void>(); ChannelFuture future = connection.send(new CommandsData(main, list, true)); list.add(new CommandData<Void, Void>(new RedissonPromise<Void>(), details.getCodec(), RedisCommands.MULTI, new Object[]{})); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); RPromise<Void> main = new RedissonPromise<Void>(); ChannelFuture future = connection.send(new CommandsData(main, list, true)); list.add(new CommandData<Void, Void>(new RedissonPromise<Void>(), details.getCodec(), RedisCommands.CLIENT_REPLY, new Object[]{ "OFF" })); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); list.add(new CommandData<Void, Void>(new RedissonPromise<Void>(), details.getCodec(), RedisCommands.CLIENT_REPLY, new Object[]{ "ON" })); RPromise<Void> main = new RedissonPromise<Void>(); List<CommandData<?, ?>> list = new LinkedList<CommandData<?, ?>>(); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); ChannelFuture future = connection.send(new CommandsData(main, list, true)); details.setWriteFuture(future);
List<CommandData<?, ?>> list = new ArrayList<CommandData<?, ?>>(2); RPromise<Void> promise = new RedissonPromise<Void>(); list.add(new CommandData<Void, Void>(promise, details.getCodec(), RedisCommands.ASKING, new Object[]{})); if (connectionEntry.isFirstCommand()) { list.add(new CommandData<Void, Void>(promise, details.getCodec(), RedisCommands.MULTI, new Object[]{})); connectionEntry.setFirstCommand(false); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); RPromise<Void> main = new RedissonPromise<Void>(); ChannelFuture future = connection.send(new CommandsData(main, list, true)); list.add(new CommandData<Void, Void>(new RedissonPromise<Void>(), details.getCodec(), RedisCommands.MULTI, new Object[]{})); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); RPromise<Void> main = new RedissonPromise<Void>(); ChannelFuture future = connection.send(new CommandsData(main, list, true)); list.add(new CommandData<Void, Void>(new RedissonPromise<Void>(), details.getCodec(), RedisCommands.CLIENT_REPLY, new Object[]{ "OFF" })); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); list.add(new CommandData<Void, Void>(new RedissonPromise<Void>(), details.getCodec(), RedisCommands.CLIENT_REPLY, new Object[]{ "ON" })); RPromise<Void> main = new RedissonPromise<Void>(); List<CommandData<?, ?>> list = new LinkedList<CommandData<?, ?>>(); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); ChannelFuture future = connection.send(new CommandsData(main, list, true)); details.setWriteFuture(future);
ChannelFuture writeFuture = send(new CommandData<T, R>(promise, encoder, command, params)); writeFuture.addListener(new ChannelFutureListener() { @Override
ChannelFuture writeFuture = send(new CommandData<T, R>(promise, encoder, command, params)); writeFuture.addListener(new ChannelFutureListener() { @Override
if (source.getRedirect() == Redirect.ASK) { RPromise<Void> promise = new RedissonPromise<Void>(); list.add(new CommandData<Void, Void>(promise, StringCodec.INSTANCE, RedisCommands.ASKING, new Object[] {}));
if (source.getRedirect() == Redirect.ASK) { RPromise<Void> promise = new RedissonPromise<Void>(); list.add(new CommandData<Void, Void>(promise, StringCodec.INSTANCE, RedisCommands.ASKING, new Object[] {}));
private <T, R> ChannelFuture async(MultiDecoder<Object> messageDecoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); return channel.writeAndFlush(new CommandData<T, R>(promise, messageDecoder, null, command, params)); }
public <T, R> CommandData<T, R> create(Codec encoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); return new CommandData<T, R>(promise, encoder, command, params); }
public <T, R> R sync(Codec encoder, RedisCommand<T> command, Object ... params) { RPromise<R> promise = new RedissonPromise<R>(); send(new CommandData<T, R>(promise, encoder, command, params)); return await(promise); }
protected <R, V> void sendCommand(final AsyncDetails<V, R> details, final RedisConnection connection) { if (details.getSource().getRedirect() == Redirect.ASK) { List<CommandData<?, ?>> list = new ArrayList<CommandData<?, ?>>(2); RPromise<Void> promise = new RedissonPromise<Void>(); list.add(new CommandData<Void, Void>(promise, details.getCodec(), RedisCommands.ASKING, new Object[]{})); list.add(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); RPromise<Void> main = new RedissonPromise<Void>(); ChannelFuture future = connection.send(new CommandsData(main, list, false)); details.setWriteFuture(future); } else { if (log.isDebugEnabled()) { log.debug("acquired connection for command {} and params {} from slot {} using node {}... {}", details.getCommand(), LogHelper.toString(details.getParams()), details.getSource(), connection.getRedisClient().getAddr(), connection); } ChannelFuture future = connection.send(new CommandData<V, R>(details.getAttemptPromise(), details.getCodec(), details.getCommand(), details.getParams())); details.setWriteFuture(future); } }
ChannelFuture writeFuture = send(new CommandData<T, R>(promise, encoder, command, params)); writeFuture.addListener(new ChannelFutureListener() { @Override
if (source.getRedirect() == Redirect.ASK) { RPromise<Void> promise = new RedissonPromise<Void>(); list.add(new CommandData<Void, Void>(promise, StringCodec.INSTANCE, RedisCommands.ASKING, new Object[] {}));