rabbit.httpio
Class BaseSocketHandler

java.lang.Object
  extended by rabbit.httpio.BaseSocketHandler
All Implemented Interfaces:
SocketChannelHandler
Direct Known Subclasses:
BlockSender, HttpHeaderReader

public abstract class BaseSocketHandler
extends Object
implements SocketChannelHandler

A base class for socket handlers.

Author:
Robert Olofsson

Constructor Summary
BaseSocketHandler(SocketChannel channel, BufferHandle bh, NioHandler nioHandler)
           
 
Method Summary
 void closed()
          Does nothing by default
protected  void closeDown()
           
protected  ByteBuffer getBuffer()
           
 BufferHandle getBufferHandle()
           
 SocketChannel getChannel()
           
 String getDescription()
          Get a string description.
protected  Logger getLogger()
           
 Long getTimeout()
          Get the timeout time in millis.
protected  void growBuffer()
           
protected  void releaseBuffer()
           
 void timeout()
          Does nothing by default
 boolean useSeparateThread()
          Runs on the selector thread by default
 void waitForRead(ReadHandler rh)
           
 void waitForWrite(WriteHandler rh)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSocketHandler

public BaseSocketHandler(SocketChannel channel,
                         BufferHandle bh,
                         NioHandler nioHandler)
Method Detail

getBuffer

protected ByteBuffer getBuffer()

growBuffer

protected void growBuffer()

releaseBuffer

protected void releaseBuffer()

closed

public void closed()
Does nothing by default

Specified by:
closed in interface SocketChannelHandler

timeout

public void timeout()
Does nothing by default

Specified by:
timeout in interface SocketChannelHandler

useSeparateThread

public boolean useSeparateThread()
Runs on the selector thread by default

Specified by:
useSeparateThread in interface SocketChannelHandler

getDescription

public String getDescription()
Description copied from interface: SocketChannelHandler
Get a string description.

Specified by:
getDescription in interface SocketChannelHandler

getTimeout

public Long getTimeout()
Description copied from interface: SocketChannelHandler
Get the timeout time in millis.

Specified by:
getTimeout in interface SocketChannelHandler
Returns:
the time when this operation times out, null if no timeout is set.

getLogger

protected Logger getLogger()

closeDown

protected void closeDown()

getChannel

public SocketChannel getChannel()

getBufferHandle

public BufferHandle getBufferHandle()

waitForRead

public void waitForRead(ReadHandler rh)

waitForWrite

public void waitForWrite(WriteHandler rh)