com.lambdaworks.redis.protocol
Class CommandHandler<K,V>

java.lang.Object
  extended by org.jboss.netty.channel.SimpleChannelHandler
      extended by com.lambdaworks.redis.protocol.CommandHandler<K,V>
All Implemented Interfaces:
ChannelDownstreamHandler, ChannelHandler, ChannelUpstreamHandler
Direct Known Subclasses:
PubSubCommandHandler

public class CommandHandler<K,V>
extends SimpleChannelHandler

A netty ChannelHandler responsible for writing redis commands and reading responses from the server.

Author:
Will Glozer

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
 
Field Summary
protected  ChannelBuffer buffer
           
protected  BlockingQueue<Command<K,V,?>> queue
           
protected  RedisStateMachine<K,V> rsm
           
 
Constructor Summary
CommandHandler(BlockingQueue<Command<K,V,?>> queue)
          Initialize a new instance that handles commands from the supplied queue.
 
Method Summary
 void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
           
protected  void decode(ChannelHandlerContext ctx, ChannelBuffer buffer)
           
 void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
           
 void writeRequested(ChannelHandlerContext ctx, MessageEvent e)
           
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelHandler
bindRequested, channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, exceptionCaught, handleDownstream, handleUpstream, setInterestOpsRequested, unbindRequested, writeComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queue

protected BlockingQueue<Command<K,V,?>> queue

buffer

protected ChannelBuffer buffer

rsm

protected RedisStateMachine<K,V> rsm
Constructor Detail

CommandHandler

public CommandHandler(BlockingQueue<Command<K,V,?>> queue)
Initialize a new instance that handles commands from the supplied queue.

Parameters:
queue - The command queue.
Method Detail

channelOpen

public void channelOpen(ChannelHandlerContext ctx,
                        ChannelStateEvent e)
                 throws Exception
Overrides:
channelOpen in class SimpleChannelHandler
Throws:
Exception

writeRequested

public void writeRequested(ChannelHandlerContext ctx,
                           MessageEvent e)
                    throws Exception
Overrides:
writeRequested in class SimpleChannelHandler
Throws:
Exception

messageReceived

public void messageReceived(ChannelHandlerContext ctx,
                            MessageEvent e)
                     throws Exception
Overrides:
messageReceived in class SimpleChannelHandler
Throws:
Exception

decode

protected void decode(ChannelHandlerContext ctx,
                      ChannelBuffer buffer)
               throws InterruptedException
Throws:
InterruptedException


Copyright © 2013. All Rights Reserved.