checkpoint(); state().setBatchIndex(i); RedisCommand<?> cmd = commandBatch.getCommands().get(i).getCommand(); boolean skipConvertor = commandBatch.isQueued(); if (!commandBatch.isAtomic() || RedisCommands.EXEC.getName().equals(cmd.getName()) || RedisCommands.WAIT.getName().equals(cmd.getName())) { commandData = (CommandData<Object, Object>) commandBatch.getCommands().get(i); if (RedisCommands.EXEC.getName().equals(cmd.getName())) { skipConvertor = false; if (commandBatch.getAttachedCommands() != null) { commandsData.set(commandBatch.getAttachedCommands()); } else { commandsData.set(commandBatch.getCommands()); Iterator<Object> iter = objects.iterator(); boolean multiFound = false; for (CommandData<?, ?> command : commandBatch.getCommands()) { if (multiFound) { if (!iter.hasNext()) { if (commandBatch.isSkipResult() || i == commandBatch.getCommands().size()) { RPromise<Void> promise = commandBatch.getPromise(); if (error != null) { if (!promise.tryFailure(error) && promise.cause() instanceof RedisTimeoutException) {
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); } }
@Override protected void encode(ChannelHandlerContext ctx, CommandsData msg, ByteBuf out) throws Exception { CommandEncoder encoder = ctx.pipeline().get(CommandEncoder.class); for (CommandData<?, ?> commandData : msg.getCommands()) { encoder.encode(ctx, commandData, out); } }
decodeCommandBatch(ctx, in, data, commands); } catch (Exception e) { commands.getPromise().tryFailure(e); sendNext(ctx); throw e;
ChannelFuture future = connection.send(new CommandsData(main, list, true)); details.setWriteFuture(future); } else { 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)); connectionEntry.setFirstCommand(false); details.setWriteFuture(future); ChannelFuture future = connection.send(new CommandsData(main, list, new ArrayList(entry.getCommands()))); details.setWriteFuture(future); } else { 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);
@Override protected void encode(ChannelHandlerContext ctx, CommandsData msg, ByteBuf out) throws Exception { CommandEncoder encoder = ctx.pipeline().get(CommandEncoder.class); for (CommandData<?, ?> commandData : msg.getCommands()) { encoder.encode(ctx, commandData, out); } }
decodeCommandBatch(ctx, in, data, commands); } catch (Exception e) { commands.getPromise().tryFailure(e); sendNext(ctx); throw e;
checkpoint(); state().setBatchIndex(i); RedisCommand<?> cmd = commandBatch.getCommands().get(i).getCommand(); boolean skipConvertor = commandBatch.isQueued(); if (!commandBatch.isAtomic() || RedisCommands.EXEC.getName().equals(cmd.getName()) || RedisCommands.WAIT.getName().equals(cmd.getName())) { commandData = (CommandData<Object, Object>) commandBatch.getCommands().get(i); if (RedisCommands.EXEC.getName().equals(cmd.getName())) { skipConvertor = false; if (commandBatch.getAttachedCommands() != null) { commandsData.set(commandBatch.getAttachedCommands()); } else { commandsData.set(commandBatch.getCommands()); Iterator<Object> iter = objects.iterator(); boolean multiFound = false; for (CommandData<?, ?> command : commandBatch.getCommands()) { if (multiFound) { if (!iter.hasNext()) { if (commandBatch.isSkipResult() || i == commandBatch.getCommands().size()) { RPromise<Void> promise = commandBatch.getPromise(); if (error != null) { if (!promise.tryFailure(error) && promise.cause() instanceof RedisTimeoutException) {
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); } }
@Override protected void encode(ChannelHandlerContext ctx, CommandsData msg, ByteBuf out) throws Exception { CommandEncoder encoder = ctx.pipeline().get(CommandEncoder.class); for (CommandData<?, ?> commandData : msg.getCommands()) { encoder.encode(ctx, commandData, out); } }
decodeCommandBatch(channel, in, data, commands); } catch (Exception e) { commands.getPromise().tryFailure(e); decoderStatus.set(Status.NORMAL); sendNext(channel);
state.get().setBatchIndex(i); RedisCommand<?> cmd = commandBatch.getCommands().get(i).getCommand(); boolean skipConvertor = commandBatch.isQueued(); List<CommandData<?, ?>> commandsData = null; if (!commandBatch.isAtomic() || RedisCommands.EXEC.getName().equals(cmd.getName()) || RedisCommands.WAIT.getName().equals(cmd.getName())) { commandData = (CommandData<Object, Object>) commandBatch.getCommands().get(i); if (RedisCommands.EXEC.getName().equals(cmd.getName())) { skipConvertor = false; if (commandBatch.getAttachedCommands() != null) { commandsData = commandBatch.getAttachedCommands(); } else { commandsData = commandBatch.getCommands(); Iterator<Object> iter = objects.iterator(); boolean multiFound = false; for (CommandData<?, ?> command : commandBatch.getCommands()) { if (multiFound) { if (!iter.hasNext()) { if (commandBatch.isSkipResult() || i == commandBatch.getCommands().size()) { if (decoderStatus.get() != Status.FILL_BUFFER) { RPromise<Void> promise = commandBatch.getPromise(); if (error != null) { if (!promise.tryFailure(error) && promise.cause() instanceof RedisTimeoutException) {
ChannelFuture future = connection.send(new CommandsData(main, list, true)); details.setWriteFuture(future); } else { 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)); connectionEntry.setFirstCommand(false); details.setWriteFuture(future); ChannelFuture future = connection.send(new CommandsData(main, list, new ArrayList(entry.getCommands()))); details.setWriteFuture(future); } else { 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 future = connection.send(new CommandsData(attemptPromise, list, noResult, isAtomic, isQueued)); details.setWriteFuture(future);
ChannelFuture future = connection.send(new CommandsData(attemptPromise, list, noResult, isAtomic, isQueued)); 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); } }
ChannelFuture future = connection.send(new CommandsData(main, list, true)); details.setWriteFuture(future); } else { 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)); connectionEntry.setFirstCommand(false); details.setWriteFuture(future); ChannelFuture future = connection.send(new CommandsData(main, list, new ArrayList(entry.getCommands()))); details.setWriteFuture(future); } else { 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 future = connection.send(new CommandsData(attemptPromise, list, noResult, isAtomic, isQueued)); details.setWriteFuture(future);