public class CommandHandler extends ChannelDuplexHandler
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(ClientOptions clientOptions,
ClientResources clientResources,
Endpoint endpoint)
Initialize a new instance that handles commands from the supplied queue.
|
bind, close, connect, deregister, disconnect, flush, readchannelReadComplete, channelWritabilityChangedensureNotSharable, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAdded, handlerRemovedpublic CommandHandler(ClientOptions clientOptions, ClientResources clientResources, Endpoint endpoint)
clientOptions - client options for this connection, must not be nullclientResources - client resources for this connection, must not be nullendpoint - must not be null.public Queue<RedisCommand<?,?,?>> getStack()
protected void setState(CommandHandler.LifecycleState lifecycleState)
public Collection<RedisCommand<?,?,?>> drainQueue()
protected CommandHandler.LifecycleState getState()
public boolean isClosed()
public void channelRegistered(ChannelHandlerContext ctx) throws Exception
channelRegistered in interface ChannelInboundHandlerchannelRegistered in class ChannelInboundHandlerAdapterExceptionChannelInboundHandlerAdapter.channelRegistered(io.netty.channel.ChannelHandlerContext)public void channelUnregistered(ChannelHandlerContext ctx) throws Exception
channelUnregistered in interface ChannelInboundHandlerchannelUnregistered in class ChannelInboundHandlerAdapterExceptionChannelInboundHandlerAdapter.channelUnregistered(io.netty.channel.ChannelHandlerContext)public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
userEventTriggered in interface ChannelInboundHandleruserEventTriggered in class ChannelInboundHandlerAdapterExceptionChannelInboundHandlerAdapter.userEventTriggered(io.netty.channel.ChannelHandlerContext, Object)public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
exceptionCaught in interface ChannelHandlerexceptionCaught in interface ChannelInboundHandlerexceptionCaught in class ChannelInboundHandlerAdapterExceptionpublic void channelActive(ChannelHandlerContext ctx) throws Exception
channelActive in interface ChannelInboundHandlerchannelActive in class ChannelInboundHandlerAdapterExceptionChannelInboundHandlerAdapter.channelActive(io.netty.channel.ChannelHandlerContext)public void channelInactive(ChannelHandlerContext ctx) throws Exception
channelInactive in interface ChannelInboundHandlerchannelInactive in class ChannelInboundHandlerAdapterExceptionChannelInboundHandlerAdapter.channelInactive(io.netty.channel.ChannelHandlerContext)public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
write in interface ChannelOutboundHandlerwrite in class ChannelDuplexHandlerExceptionChannelDuplexHandler.write(io.netty.channel.ChannelHandlerContext, java.lang.Object,
io.netty.channel.ChannelPromise)public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
channelRead in interface ChannelInboundHandlerchannelRead in class ChannelInboundHandlerAdapterExceptionChannelInboundHandlerAdapter.channelRead(io.netty.channel.ChannelHandlerContext, java.lang.Object)protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws InterruptedException
InterruptedExceptionprotected boolean canDecode(ByteBuf buffer)
protected boolean decode(ByteBuf buffer, CommandOutput<?,?,?> output)
protected boolean decode(ByteBuf buffer, RedisCommand<?,?,?> command, CommandOutput<?,?,?> output)
protected void afterComplete(ChannelHandlerContext ctx, RedisCommand<?,?,?> command)
ctx - command - Copyright © 2018 lettuce.io. All rights reserved.