|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.indi.reactor.SimpleEventHandler
org.indi.reactor.OutputQueue
public class OutputQueue
An Output queue that can filled with as many ByteBuffers as requiered. It is registered with a reactor and associated with a SelectableChannel. It empties itself though the channel as the the channel is detected writable by the reactor.
| Field Summary | |
|---|---|
protected boolean |
active
true if data if waiting in the queue to be writen into the channel. |
protected boolean |
dead
false until onClose has been called. |
protected java.util.Queue<java.nio.ByteBuffer> |
queue
The queue containing the ByteBuffers to be written into the channel. |
| Fields inherited from class org.indi.reactor.SimpleEventHandler |
|---|
channel, reactor, registeredOperations |
| Constructor Summary | |
|---|---|
OutputQueue(Reactor r,
java.nio.channels.SelectableChannel ch)
class constructor |
|
| Method Summary | |
|---|---|
void |
close()
close the channel. |
boolean |
isOpen()
return whether the channel is open. |
void |
onClose()
Called by the reactor when the channel is deregistered |
void |
onWrite()
Called by the reactor when channel is ready for writing. |
int |
write(java.nio.ByteBuffer src)
Put a new ByteBuffer into the queue. |
| Methods inherited from class org.indi.reactor.SimpleEventHandler |
|---|
channel, onAccept, onConnect, onRead, register |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Queue<java.nio.ByteBuffer> queue
protected boolean active
protected boolean dead
| Constructor Detail |
|---|
public OutputQueue(Reactor r,
java.nio.channels.SelectableChannel ch)
r - the reactor to register with.ch - the SelectableChannel to write the information to| Method Detail |
|---|
public void onWrite()
throws java.io.IOException
onWrite in interface EventHandleronWrite in class SimpleEventHandlerjava.io.IOExceptionEventHandler.onWrite()public int write(java.nio.ByteBuffer src)
write in interface java.nio.channels.WritableByteChannelpublic boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic void close()
close in interface java.io.Closeableclose in interface java.nio.channels.Channelpublic void onClose()
onClose in interface EventHandleronClose in class SimpleEventHandlerEventHandler.onClose()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||