rabbit.nio
Interface NioHandler

All Known Implementing Classes:
MultiSelectorNioHandler

public interface NioHandler

A handler of nio based events.


Method Summary
 void cancel(SelectableChannel channel, SocketChannelHandler handler)
          Remove an event listener.
 void close(SelectableChannel channel)
          Close the given channel.
 Long getDefaultTimeout()
          Get the default timeout time for an operations started at this point in time.
 void runThreadTask(Runnable r)
          Run a task in a background thread.
 void shutdown()
          Shutdown this task runner.
 void start()
          Start handling operations.
 void visitSelectors(SelectorVisitor visitor)
          Visit all the selectors.
 void waitForAccept(SelectableChannel channel, AcceptHandler handler)
          Install an event listener for accent events.
 void waitForConnect(SelectableChannel channel, ConnectHandler handler)
          Install an event listener for connect events.
 void waitForRead(SelectableChannel channel, ReadHandler handler)
          Install an event listener for read events.
 void waitForWrite(SelectableChannel channel, WriteHandler handler)
          Install an event listener for write events.
 

Method Detail

start

void start()
Start handling operations.


shutdown

void shutdown()
Shutdown this task runner.


getDefaultTimeout

Long getDefaultTimeout()
Get the default timeout time for an operations started at this point in time.


runThreadTask

void runThreadTask(Runnable r)
Run a task in a background thread. The task will be run sometime in the future.

Parameters:
r - the task to run.

waitForRead

void waitForRead(SelectableChannel channel,
                 ReadHandler handler)
Install an event listener for read events. When the channels is ready the ReadHandler.read () method will be called and read selection will be turned off for the channel.


waitForWrite

void waitForWrite(SelectableChannel channel,
                  WriteHandler handler)
Install an event listener for write events. When the channel is ready the WriteHandler.write () method will be called and write selection will be turned off for the channel.


waitForAccept

void waitForAccept(SelectableChannel channel,
                   AcceptHandler handler)
Install an event listener for accent events. When the channel is ready the Accepthandler.accept () method will be called and accept selection will be turned off for the channel.


waitForConnect

void waitForConnect(SelectableChannel channel,
                    ConnectHandler handler)
Install an event listener for connect events. When the channel is ready the Connecthandler.connect () method will be called and connect selection will be turned off for the channel.


cancel

void cancel(SelectableChannel channel,
            SocketChannelHandler handler)
Remove an event listener.


close

void close(SelectableChannel channel)
Close the given channel. Closing a channel will cause SocketChannelHandler.close () to be raised on any listeners for this channel and will then cancel all selector interaction.


visitSelectors

void visitSelectors(SelectorVisitor visitor)
Visit all the selectors. This should really only be used for status handling and/or debugging.