@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, read
channelActive, channelInactive, channelReadComplete, channelWritabilityChanged, exceptionCaught, userEventTriggered
handlerAdded, handlerRemoved, isSharable
protected 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.ChannelInboundHandler
channelRegistered
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelUnregistered
in interface io.netty.channel.ChannelInboundHandler
channelUnregistered
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
channelRead
in interface io.netty.channel.ChannelInboundHandler
channelRead
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) throws Exception
write
in interface io.netty.channel.ChannelOutboundHandler
write
in class io.netty.channel.ChannelDuplexHandler
Exception
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer) throws InterruptedException
InterruptedException
Copyright © 2014–2015. All rights reserved.