@ChannelHandler.Sharable
public class CommandHandler<K,V>
extends io.netty.channel.ChannelDuplexHandler
ChannelHandler responsible for writing redis commands and
reading responses from the server.| Modifier and Type | Field and Description |
|---|---|
protected io.netty.buffer.ByteBuf |
buffer |
protected BlockingQueue<Command<K,V,?>> |
queue |
protected RedisStateMachine<K,V> |
rsm |
| Constructor and Description |
|---|
CommandHandler(BlockingQueue<Command<K,V,?>> queue)
Initialize a new instance that handles commands from the supplied queue.
|
| Modifier and Type | Method and Description |
|---|---|
void |
channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
void |
channelRegistered(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) |
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer) |
void |
write(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.channel.ChannelPromise promise) |
bind, close, connect, deregister, disconnect, flush, readchannelActive, channelInactive, channelReadComplete, channelWritabilityChanged, exceptionCaught, userEventTriggeredhandlerAdded, handlerRemoved, isSharableprotected BlockingQueue<Command<K,V,?>> queue
protected io.netty.buffer.ByteBuf buffer
protected RedisStateMachine<K,V> rsm
public CommandHandler(BlockingQueue<Command<K,V,?>> queue)
queue - The command queue.public void channelRegistered(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelRegistered in interface io.netty.channel.ChannelInboundHandlerchannelRegistered in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelUnregistered(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelUnregistered in interface io.netty.channel.ChannelInboundHandlerchannelUnregistered in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg)
throws Exception
channelRead in interface io.netty.channel.ChannelInboundHandlerchannelRead in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void write(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.channel.ChannelPromise promise)
throws Exception
write in interface io.netty.channel.ChannelOutboundHandlerwrite in class io.netty.channel.ChannelDuplexHandlerExceptionprotected void decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer)
throws InterruptedException
InterruptedExceptionCopyright © 2014–2015. All rights reserved.