public class CommandHandler extends ChannelDuplexHandler implements HasQueuedCommands
ChannelHandler
responsible for writing redis commands and reading responses from the server.Modifier and Type | Class and Description |
---|---|
static class |
CommandHandler.LifecycleState |
ChannelHandler.Sharable
Constructor and Description |
---|
CommandHandler(ClientResources clientResources,
Endpoint endpoint)
Initialize a new instance that handles commands from the supplied queue.
|
Modifier and Type | Method and Description |
---|---|
void |
channelActive(ChannelHandlerContext ctx) |
void |
channelInactive(ChannelHandlerContext ctx) |
void |
channelRead(ChannelHandlerContext ctx,
Object msg) |
void |
channelRegistered(ChannelHandlerContext ctx) |
void |
channelUnregistered(ChannelHandlerContext ctx) |
protected boolean |
decode(ByteBuf buffer,
CommandOutput<?,?,?> output) |
protected void |
decode(ChannelHandlerContext ctx,
ByteBuf buffer) |
void |
exceptionCaught(ChannelHandlerContext ctx,
Throwable cause) |
Queue<RedisCommand<?,?,?>> |
getQueue()
The queue holding commands.
|
protected CommandHandler.LifecycleState |
getState() |
boolean |
isClosed() |
protected String |
logPrefix() |
protected void |
setState(CommandHandler.LifecycleState lifecycleState) |
void |
userEventTriggered(ChannelHandlerContext ctx,
Object evt) |
void |
write(ChannelHandlerContext ctx,
Object msg,
ChannelPromise promise) |
bind, close, connect, deregister, disconnect, flush, read
channelReadComplete, channelWritabilityChanged
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded, handlerRemoved
public CommandHandler(ClientResources clientResources, Endpoint endpoint)
clientResources
- client resources for this connection, must not be nullendpoint
- public void channelRegistered(ChannelHandlerContext ctx) throws Exception
channelRegistered
in interface ChannelInboundHandler
channelRegistered
in class ChannelInboundHandlerAdapter
Exception
ChannelInboundHandlerAdapter.channelRegistered(io.netty.channel.ChannelHandlerContext)
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception
channelUnregistered
in interface ChannelInboundHandler
channelUnregistered
in class ChannelInboundHandlerAdapter
Exception
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
userEventTriggered
in interface ChannelInboundHandler
userEventTriggered
in class ChannelInboundHandlerAdapter
Exception
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
exceptionCaught
in interface ChannelHandler
exceptionCaught
in interface ChannelInboundHandler
exceptionCaught
in class ChannelInboundHandlerAdapter
Exception
public void channelActive(ChannelHandlerContext ctx) throws Exception
channelActive
in interface ChannelInboundHandler
channelActive
in class ChannelInboundHandlerAdapter
Exception
public void channelInactive(ChannelHandlerContext ctx) throws Exception
channelInactive
in interface ChannelInboundHandler
channelInactive
in class ChannelInboundHandlerAdapter
Exception
ChannelInboundHandlerAdapter.channelInactive(io.netty.channel.ChannelHandlerContext)
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
write
in interface ChannelOutboundHandler
write
in class ChannelDuplexHandler
Exception
ChannelDuplexHandler.write(io.netty.channel.ChannelHandlerContext, java.lang.Object,
io.netty.channel.ChannelPromise)
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
channelRead
in interface ChannelInboundHandler
channelRead
in class ChannelInboundHandlerAdapter
Exception
ChannelInboundHandlerAdapter.channelRead(io.netty.channel.ChannelHandlerContext, java.lang.Object)
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws InterruptedException
InterruptedException
protected boolean decode(ByteBuf buffer, CommandOutput<?,?,?> output)
protected void setState(CommandHandler.LifecycleState lifecycleState)
protected CommandHandler.LifecycleState getState()
public boolean isClosed()
protected String logPrefix()
public Queue<RedisCommand<?,?,?>> getQueue()
HasQueuedCommands
getQueue
in interface HasQueuedCommands
Copyright © 2017 lettuce.io. All rights reserved.