MultiSelectorNioHandler (RabbIT/4)
Date: 2009-12-20

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rabbit.nio
Class MultiSelectorNioHandler

    java.lang.Object
      rabbit.nio.MultiSelectorNioHandler

All Implemented Interfaces:
  NioHandler

    public class MultiSelectorNioHandler

extends Object
implements NioHandler

An implementation of NioHandler that runs several selector threads.

Author:
  Robert Olofsson

Constructor Summary
`MultiSelectorNioHandler(ExecutorService executorService, int numSelectors)` Create a new MultiSelectorNioHandler that runs background tasks on the given executor and has a specified number of selectors.

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.
`StatisticsHolder` | `getTimingStatistics()` Get the timing information for the thread tasks.
`void` | `runThreadTask(Runnable r, TaskIdentifier ti)` 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MultiSelectorNioHandler

    public MultiSelectorNioHandler(ExecutorService executorService,
                                   int numSelectors)
                            throws IOException

  Create a new MultiSelectorNioHandler that runs background tasks on the given executor and has a specified number of selectors.

  Throws:
    `IOException`

Method Detail

### start

    public void start()

  Description copied from interface: `NioHandler`
  Start handling operations.

  Specified by:
    `start` in interface `NioHandler`

### shutdown

    public void shutdown()

  Description copied from interface: `NioHandler`
  Shutdown this task runner.

  Specified by:
    `shutdown` in interface `NioHandler`

### getDefaultTimeout

    public Long getDefaultTimeout()

  Description copied from interface: `NioHandler`
  Get the default timeout time for an operations started at this point in time.

  Specified by:
    `getDefaultTimeout` in interface `NioHandler`

### runThreadTask

    public void runThreadTask(Runnable r,
                              TaskIdentifier ti)

  Description copied from interface: `NioHandler`
  Run a task in a background thread. The task will be run sometime in the future.

  Specified by:
    `runThreadTask` in interface `NioHandler`
  Parameters:
    `r` - the task to run.

### waitForRead

    public void waitForRead(SelectableChannel channel,
                            ReadHandler handler)

  Description copied from interface: `NioHandler`
  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.

  Specified by:
    `waitForRead` in interface `NioHandler`

### waitForWrite

    public void waitForWrite(SelectableChannel channel,
                             WriteHandler handler)

  Description copied from interface: `NioHandler`
  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.

  Specified by:
    `waitForWrite` in interface `NioHandler`

### waitForAccept

    public void waitForAccept(SelectableChannel channel,
                              AcceptHandler handler)

  Description copied from interface: `NioHandler`
  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.

  Specified by:
    `waitForAccept` in interface `NioHandler`

### waitForConnect

    public void waitForConnect(SelectableChannel channel,
                               ConnectHandler handler)

  Description copied from interface: `NioHandler`
  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.

  Specified by:
    `waitForConnect` in interface `NioHandler`

### cancel

    public void cancel(SelectableChannel channel,
                       SocketChannelHandler handler)

  Description copied from interface: `NioHandler`
  Remove an event listener.

  Specified by:
    `cancel` in interface `NioHandler`

### close

    public void close(SelectableChannel channel)

  Description copied from interface: `NioHandler`
  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.

  Specified by:
    `close` in interface `NioHandler`

### visitSelectors

    public void visitSelectors(SelectorVisitor visitor)

  Description copied from interface: `NioHandler`
  Visit all the selectors. This should really only be used for status handling and/or debugging.

  Specified by:
    `visitSelectors` in interface `NioHandler`

### getTimingStatistics

    public StatisticsHolder getTimingStatistics()

  Description copied from interface: `NioHandler`
  Get the timing information for the thread tasks.

  Specified by:
    `getTimingStatistics` in interface `NioHandler`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD