|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openflow.example.SelectLoop
public class SelectLoop
Dirt simple SelectLoop for simple java controller
Field Summary | |
---|---|
protected SelectListener |
callback
|
protected boolean |
dontStop
|
protected java.lang.Object |
registrationLock
|
protected java.util.Queue<java.lang.Object[]> |
registrationQueue
|
protected int |
registrationRequests
|
protected java.nio.channels.Selector |
selector
|
protected long |
timeout
|
Constructor Summary | |
---|---|
SelectLoop(SelectListener cb)
|
|
SelectLoop(SelectListener cb,
long timeout)
Initializes this SelectLoop |
Method Summary | |
---|---|
void |
doLoop()
Main top-level IO loop this dispatches all IO events and timer events together I believe this is fairly efficient |
protected void |
processRegistrationQueue()
|
void |
register(java.nio.channels.SelectableChannel ch,
int ops,
java.lang.Object arg)
|
java.nio.channels.SelectionKey |
registerBlocking(java.nio.channels.SelectableChannel ch,
int ops,
java.lang.Object arg)
Registers the supplied SelectableChannel with this SelectLoop. |
void |
shutdown()
Shuts down this select loop, may return before it has fully shutdown |
void |
wakeup()
Force this select loop to return immediately and re-enter select, useful for example if a new item has been added to the select loop while it was already blocked. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SelectListener callback
protected boolean dontStop
protected java.lang.Object registrationLock
protected int registrationRequests
protected java.util.Queue<java.lang.Object[]> registrationQueue
protected java.nio.channels.Selector selector
protected long timeout
Constructor Detail |
---|
public SelectLoop(SelectListener cb) throws java.io.IOException
java.io.IOException
public SelectLoop(SelectListener cb, long timeout) throws java.io.IOException
cb
- the callback to call when select returnstimeout
- the timeout value in milliseconds that select will be
called with
java.io.IOException
Method Detail |
---|
public void register(java.nio.channels.SelectableChannel ch, int ops, java.lang.Object arg) throws java.nio.channels.ClosedChannelException
java.nio.channels.ClosedChannelException
public java.nio.channels.SelectionKey registerBlocking(java.nio.channels.SelectableChannel ch, int ops, java.lang.Object arg) throws java.nio.channels.ClosedChannelException
ch
- the channelops
- interest opsarg
- argument that will be returned with the SelectListener
java.nio.channels.ClosedChannelException
public void doLoop() throws java.io.IOException
java.io.IOException
protected void processRegistrationQueue()
public void wakeup()
public void shutdown()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |