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

## org.apache.catalina.tribes.transport.nio
Class NioReceiver

    java.lang.Object
      org.apache.catalina.tribes.transport.ReceiverBase
          org.apache.catalina.tribes.transport.nio.NioReceiver

All Implemented Interfaces:
  Runnable, ChannelReceiver, Heartbeat, ListenCallback, RxTaskPool.TaskCreator

    public class NioReceiver

extends ReceiverBase
implements Runnable

Version:
  $Id: NioReceiver.java 1212120 2011-12-08 20:57:33Z markt $
Author:
  Filip Hanik

Field Summary
`protected LinkedList<Runnable>` | `events`
`protected long` | `lastCheck`
`protected static StringManager` | `sm` The string manager for this package.

Fields inherited from class org.apache.catalina.tribes.transport.ReceiverBase
`OPTION_DIRECT_BUFFER`

Fields inherited from interface org.apache.catalina.tribes.ChannelReceiver
`MAX_UDP_SIZE`

Constructor Summary
`NioReceiver()`

Method Summary
`void` | `addEvent(Runnable event)`
`protected void` | `bind()`
`static void` | `cancelledKey(SelectionKey key)`
`AbstractRxTask` | `createRxTask()`
`void` | `events()`
`String` | `getInfo()` Return descriptive information about this implementation and the corresponding version number, in the format `<description>/<version>`.
`protected void` | `listen()` get data from channel and store in byte array send it to cluster
`protected void` | `readDataFromSocket(SelectionKey key)` Sample data handler method for a channel with data ready to read.
`protected void` | `registerChannel(Selector selector, SelectableChannel channel, int ops, Object attach)` Register the given channel with the given selector for the given operations of interest
`void` | `run()` Start thread and listen
`protected void` | `socketTimeouts()`
`void` | `start()` start cluster receiver
`void` | `stop()` Stop listening for messages
`protected void` | `stopListening()` Close Selector.

Methods inherited from class org.apache.catalina.tribes.transport.ReceiverBase
`bind, bindUdp, doListen, getAddress, getAutoBind, getBind, getDirect, getExecutor, getHost, getListener, getMaxIdleTime, getMaxTasks, getMaxThreads, getMessageListener, getMinTasks, getMinThreads, getOoBInline, getPort, getRxBufSize, getSecurePort, getSelectorTimeout, getSoKeepAlive, getSoLingerOn, getSoLingerTime, getSoReuseAddress, getSoTrafficClass, getTaskPool, getTcpListenAddress, getTcpListenPort, getTcpNoDelay, getTcpSelectorTimeout, getTcpThreadCount, getTimeout, getTxBufSize, getUdpPort, getUdpRxBufSize, getUdpTxBufSize, getUseBufferPool, getWorkerThreadOptions, heartbeat, isDaemon, isListening, messageDataReceived, setAddress, setAutoBind, setBind, setDaemon, setDirect, setExecutor, setHost, setListen, setListener, setMaxIdleTime, setMaxTasks, setMaxThreads, setMessageListener, setMinTasks, setMinThreads, setOoBInline, setPool, setPort, setRxBufSize, setSecurePort, setSelectorTimeout, setSoKeepAlive, setSoLingerOn, setSoLingerTime, setSoReuseAddress, setSoTrafficClass, setTcpListenAddress, setTcpListenPort, setTcpNoDelay, setTcpSelectorTimeout, setTcpThreadCount, setTimeout, setTxBufSize, setUdpPort, setUdpRxBufSize, setUdpTxBufSize, setUseBufferPool`

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

Field Detail

### sm

    protected static final StringManager sm

  The string manager for this package.

### events

    protected LinkedList<Runnable> events

### lastCheck

    protected long lastCheck

Constructor Detail

### NioReceiver

    public NioReceiver()

Method Detail

### getInfo

    public String getInfo()

  Return descriptive information about this implementation and the corresponding version number, in the format `<description>/<version>`.

### stop

    public void stop()

  Description copied from interface: `ChannelReceiver`
  Stop listening for messages

  Specified by:
    `stop` in interface `ChannelReceiver`
  Overrides:
    `stop` in class `ReceiverBase`

### start

    public void start()
               throws IOException

  start cluster receiver

  Specified by:
    `start` in interface `ChannelReceiver`
  Overrides:
    `start` in class `ReceiverBase`
  Throws:
    `IOException`
  See Also:
    `ChannelReceiver.start()`

### createRxTask

    public AbstractRxTask createRxTask()

  Specified by:
    `createRxTask` in interface `RxTaskPool.TaskCreator`

### bind

    protected void bind()
                 throws IOException

  Throws:
    `IOException`

### addEvent

    public void addEvent(Runnable event)

### events

    public void events()

### cancelledKey

    public static void cancelledKey(SelectionKey key)

### socketTimeouts

    protected void socketTimeouts()

### listen

    protected void listen()
                   throws Exception

  get data from channel and store in byte array send it to cluster

  Throws:
    `IOException`
    `ClosedChannelException`
    `Exception`

### stopListening

    protected void stopListening()

  Close Selector.

  See Also:
    `ReceiverBase.stop()`

### registerChannel

    protected void registerChannel(Selector selector,
                                   SelectableChannel channel,
                                   int ops,
                                   Object attach)
                            throws Exception

  Register the given channel with the given selector for the given operations of interest

  Throws:
    `Exception`

### run

    public void run()

  Start thread and listen

  Specified by:
    `run` in interface `Runnable`

### readDataFromSocket

    protected void readDataFromSocket(SelectionKey key)
                               throws Exception

  Sample data handler method for a channel with data ready to read.

  Parameters:
    `key` - A SelectionKey object associated with a channel determined by the selector to be ready for reading. If the channel returns an EOF condition, it is closed here, which automatically invalidates the associated key. The selector will then de-register the channel on the next select call.
  Throws:
    `Exception`

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

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.