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

## org.jboss.remoting.transport.multiplex.utility
Class VirtualSelector

    java.lang.Object
      org.jboss.remoting.transport.multiplex.utility.VirtualSelector

    public class VirtualSelector

extends java.lang.Object

`VirtualSelector` is a simple version of `java.nio.channels.Selector`. It allows a thread to register for `InputStream`s to notify it that they have bytes ready to read.

Field Summary
`protected static org.jboss.logging.Logger` | `log`

Constructor Summary
`VirtualSelector()`

Method Summary
`void` | `addToReadyInputStreams(java.io.InputStream inputStream)` Allows an `InputStream` to inform a listening `Thread` that it has bytes ready to read.
`void` | `close()` Marks this `VirtualSelector` as preparing to close.
`protected void` | `finishClose()` Finishes the process of closing this `VirtualSelector`, releasing all resources.
`boolean` | `isOpen()` Returns true if and only if this `VirtualSelector` is open.
`void` | `register(GrowablePipedInputStream inputStream, java.lang.Object attachment)` Allows an `InputStream` to register itself and an attachment.
`void` | `remove(java.io.InputStream inputStream)` Indicates that an `InputStream` has been processed.
`java.util.Map` | `select()` Allows a `Thread` to wait to be informed of InputStreams that have bytes ready to read.
`void` | `unregister(java.io.InputStream inputStream)` Allows an `InputStream` to unregister itself.
`void` | `waitUntilEmpty()`

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

Field Detail

### log

    protected static final org.jboss.logging.Logger log

Constructor Detail

### VirtualSelector

    public VirtualSelector()

Method Detail

### register

    public void register(GrowablePipedInputStream inputStream,
                         java.lang.Object attachment)

  Allows an `InputStream` to register itself and an attachment.

  Parameters:
    `inputStream` -
    `attachment` -

### unregister

    public void unregister(java.io.InputStream inputStream)

  Allows an `InputStream` to unregister itself.

  Parameters:
    `inputStream` -

### select

    public java.util.Map select()

  Allows a `Thread` to wait to be informed of InputStreams that have bytes ready to read.

  Returns:
    a `Map` from a set of `InputStream`s with ready bytes to their attachments. If `close()` is called while a `Thread` is waiting in `select()`, and if there are no ready `InputStreams`, `select()` will return null.

### isOpen

    public boolean isOpen()

  Returns true if and only if this `VirtualSelector` is open.

  Returns:
    true if and only if this `VirtualSelector` is open

### close

    public void close()

  Marks this `VirtualSelector` as preparing to close. If any `Thread` is blocked in `select()`, `select()` returns null.

### addToReadyInputStreams

    public void addToReadyInputStreams(java.io.InputStream inputStream)
                                throws java.io.IOException

  Allows an `InputStream` to inform a listening `Thread` that it has bytes ready to read.

  Parameters:
    `inputStream` -
  Throws:
    `java.io.IOException`

### remove

    public void remove(java.io.InputStream inputStream)
                throws java.io.IOException

  Indicates that an `InputStream` has been processed. If `InputStream` has no available bytes, it will be removed from the `Set` of `InputStream`s that will be returned by the next call to `select()`. If `InputStream` has available bytes, its status will not be changed.

  Parameters:
    `inputStream` -
  Throws:
    `java.io.IOException`

### waitUntilEmpty

    public void waitUntilEmpty()

### finishClose

    protected void finishClose()

  Finishes the process of closing this `VirtualSelector`, releasing all resources.

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

Copyright ? 1998-2005 JBoss Inc . All Rights Reserved.