|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.asyncobjects.vats.VatRunner net.sf.asyncobjects.vats.VatQueueRunner net.sf.asyncobjects.vats.SingleThreadIdleRunner net.sf.asyncobjects.net.nio.NIOSelectorRunner
public class NIOSelectorRunner
A selector runner, there could be only one vat per selector and only one selector in runner. JDK 1.4 NIO is really "single point of blocking for many sockets" rather then nonblocking.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class net.sf.asyncobjects.vats.VatQueueRunner |
---|
VatQueueRunner.EnqueuedVat |
Nested classes/interfaces inherited from class net.sf.asyncobjects.vats.VatRunner |
---|
VatRunner.VatRunnerState |
Field Summary |
---|
Fields inherited from class net.sf.asyncobjects.vats.SingleThreadIdleRunner |
---|
isIdle |
Fields inherited from class net.sf.asyncobjects.vats.VatQueueRunner |
---|
queue |
Fields inherited from class net.sf.asyncobjects.vats.VatRunner |
---|
state, stateLock |
Constructor Summary | |
---|---|
NIOSelectorRunner()
a constructor |
|
NIOSelectorRunner(String name,
boolean isDaemon)
A constructor |
Method Summary | |
---|---|
protected ByteBuffer |
getDirectBuffer()
|
protected void |
idle()
perform idle action, idle action should stop to be performed after wakeup call. |
protected void |
init()
init action |
NIOSelectorVat |
newVat(String name)
Create default vat for this runner |
protected void |
pollIdle()
poll action, poll should never block. |
SelectionKey |
registerChannel(SelectableChannel ch)
register channel with listener |
protected void |
returnDirectBuffer(ByteBuffer buffer)
Return buffer to the runner |
void |
stop()
Stop this runner |
protected void |
stopped()
stop action |
protected void |
wakeupIdle()
wakeup idle action and perform, wakeupIdle should be ready to fact that it will be called several times and that it could be called before actual entering into idle call. |
Methods inherited from class net.sf.asyncobjects.vats.SingleThreadIdleRunner |
---|
hasEvents, isStopping, resumeInCurrentThread, setPollInterval, startInCurrentThread, startInNewThread, stopping, suspend |
Methods inherited from class net.sf.asyncobjects.vats.VatRunner |
---|
cancelledEqueuedVat, getBachingFactor, getState, newVat, setBachingFactor, setStarted, setStarting, setState, setStopped, setStopping |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.asyncobjects.vats.VatFactory |
---|
newVat |
Constructor Detail |
---|
public NIOSelectorRunner(String name, boolean isDaemon)
name
- name of runnerisDaemon
- true if a created thread should be daemon threadpublic NIOSelectorRunner()
Method Detail |
---|
public NIOSelectorVat newVat(String name)
VatRunner
newVat
in interface VatFactory
newVat
in class VatRunner
name
- a vat name
VatRunner.newVat(java.lang.String)
protected void init()
init
in class SingleThreadIdleRunner
public void stop()
SingleThreadIdleRunner
stop
in interface ThreadBasedRunner
stop
in class SingleThreadIdleRunner
SingleThreadIdleRunner.stop()
protected void stopped()
stopped
in class SingleThreadIdleRunner
protected void idle()
idle
in class SingleThreadIdleRunner
protected void pollIdle()
pollIdle
in class SingleThreadIdleRunner
public SelectionKey registerChannel(SelectableChannel ch) throws Exception
ch
- a channel used by component
Exception
- if there is IO problmeprotected ByteBuffer getDirectBuffer()
protected void returnDirectBuffer(ByteBuffer buffer)
buffer
- a buffer to returnprotected void wakeupIdle()
wakeupIdle
in class SingleThreadIdleRunner
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |