|
|
@ -110,6 +110,17 @@ public class CommandDecoder extends ReplayingDecoder<State> {
|
|
|
|
} else if (data instanceof CommandsData) {
|
|
|
|
} else if (data instanceof CommandsData) {
|
|
|
|
CommandsData commands = (CommandsData)data;
|
|
|
|
CommandsData commands = (CommandsData)data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleCommandsDataResponse(ctx, in, data, currentDecoder, commands);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctx.pipeline().get(CommandsQueue.class).sendNextCommand(ctx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void handleCommandsDataResponse(ChannelHandlerContext ctx, ByteBuf in, QueueCommand data,
|
|
|
|
|
|
|
|
Decoder<Object> currentDecoder, CommandsData commands) throws Exception {
|
|
|
|
int i = state().getIndex();
|
|
|
|
int i = state().getIndex();
|
|
|
|
|
|
|
|
|
|
|
|
while (in.writerIndex() > in.readerIndex()) {
|
|
|
|
while (in.writerIndex() > in.readerIndex()) {
|
|
|
@ -138,12 +149,6 @@ public class CommandDecoder extends ReplayingDecoder<State> {
|
|
|
|
checkpoint();
|
|
|
|
checkpoint();
|
|
|
|
state().setIndex(i);
|
|
|
|
state().setIndex(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctx.pipeline().get(CommandsQueue.class).sendNextCommand(ctx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void decode(ByteBuf in, CommandData<Object, Object> data, List<Object> parts, Channel channel, Decoder<Object> currentDecoder) throws IOException {
|
|
|
|
private void decode(ByteBuf in, CommandData<Object, Object> data, List<Object> parts, Channel channel, Decoder<Object> currentDecoder) throws IOException {
|
|
|
@ -206,6 +211,9 @@ public class CommandDecoder extends ReplayingDecoder<State> {
|
|
|
|
|
|
|
|
|
|
|
|
Object result = decoder.decode(respParts, state());
|
|
|
|
Object result = decoder.decode(respParts, state());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// store current message index
|
|
|
|
|
|
|
|
checkpoint();
|
|
|
|
|
|
|
|
|
|
|
|
if (result instanceof Message) {
|
|
|
|
if (result instanceof Message) {
|
|
|
|
handleMultiResult(data, null, channel, result);
|
|
|
|
handleMultiResult(data, null, channel, result);
|
|
|
|
// has next messages?
|
|
|
|
// has next messages?
|
|
|
|