|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.remoting.transport.multiplex.utility.VirtualSelector
public class VirtualSelector
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 |
---|
protected static final org.jboss.logging.Logger log
Constructor Detail |
---|
public VirtualSelector()
Method Detail |
---|
public void register(GrowablePipedInputStream inputStream, java.lang.Object attachment)
InputStream
to register itself and an attachment.
inputStream
- attachment
- public void unregister(java.io.InputStream inputStream)
InputStream
to unregister itself.
inputStream
- public java.util.Map select()
Thread
to wait to be informed of InputStreams that have bytes ready to read.
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.public boolean isOpen()
VirtualSelector
is open.
VirtualSelector
is openpublic void close()
VirtualSelector
as preparing to close.
If any Thread
is blocked in select()
, select()
returns null.
public void addToReadyInputStreams(java.io.InputStream inputStream) throws java.io.IOException
InputStream
to inform a listening Thread
that it has bytes ready to read.
inputStream
-
java.io.IOException
public void remove(java.io.InputStream inputStream) throws java.io.IOException
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.
inputStream
-
java.io.IOException
public void waitUntilEmpty()
protected void finishClose()
VirtualSelector
, releasing all resources.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |