|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.khelekore.rnio.impl.MultiSelectorNioHandler
public class MultiSelectorNioHandler
An implementation of NioHandler that runs several selector threads.
Any tasks that should run on a background thread are passed to the
ExecutorService
that was given in the constructor.
This class will log using the "org.khelekore.rnio" Logger
.
Constructor Summary | |
---|---|
MultiSelectorNioHandler(ExecutorService executorService,
StatisticsHolder stats,
int numSelectors,
Long defaultTimeout)
Create a new MultiSelectorNioHandler that runs background tasks on the given executor and has a specified number of selectors. |
Method Summary | |
---|---|
void |
cancel(SelectableChannel channel,
SocketChannelHandler handler)
Remove an event listener. |
void |
close(SelectableChannel channel)
Close the given channel. |
Long |
getDefaultTimeout()
Get the default timeout time for an operations started at this point in time. |
StatisticsHolder |
getTimingStatistics()
Get the timing information for the thread tasks. |
void |
runThreadTask(Runnable r,
TaskIdentifier ti)
Run a task in a background thread. |
void |
shutdown()
Shutdown this task runner. |
void |
start()
Start handling operations. |
void |
visitSelectors(SelectorVisitor visitor)
Visit all the selectors. |
void |
waitForAccept(SelectableChannel channel,
AcceptHandler handler)
Install an event listener for accent events. |
void |
waitForConnect(SelectableChannel channel,
ConnectHandler handler)
Install an event listener for connect events. |
void |
waitForRead(SelectableChannel channel,
ReadHandler handler)
Install an event listener for read events. |
void |
waitForWrite(SelectableChannel channel,
WriteHandler handler)
Install an event listener for write events. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiSelectorNioHandler(ExecutorService executorService, StatisticsHolder stats, int numSelectors, Long defaultTimeout) throws IOException
executorService
- the ExecutorService to use for this NioHandlerstats
- the StatisticsHolder to use for this NioHandlernumSelectors
- the number of threads that this NioHandler will usedefaultTimeout
- the default timeout value for this NioHandler
IOException
Method Detail |
---|
public void start()
NioHandler
start
in interface NioHandler
public void shutdown()
NioHandler
shutdown
in interface NioHandler
public Long getDefaultTimeout()
NioHandler
getDefaultTimeout
in interface NioHandler
public void runThreadTask(Runnable r, TaskIdentifier ti)
NioHandler
runThreadTask
in interface NioHandler
r
- the task to run.public void waitForRead(SelectableChannel channel, ReadHandler handler)
NioHandler
waitForRead
in interface NioHandler
public void waitForWrite(SelectableChannel channel, WriteHandler handler)
NioHandler
waitForWrite
in interface NioHandler
public void waitForAccept(SelectableChannel channel, AcceptHandler handler)
NioHandler
waitForAccept
in interface NioHandler
public void waitForConnect(SelectableChannel channel, ConnectHandler handler)
NioHandler
waitForConnect
in interface NioHandler
public void cancel(SelectableChannel channel, SocketChannelHandler handler)
NioHandler
cancel
in interface NioHandler
public void close(SelectableChannel channel)
NioHandler
close
in interface NioHandler
public void visitSelectors(SelectorVisitor visitor)
NioHandler
visitSelectors
in interface NioHandler
public StatisticsHolder getTimingStatistics()
NioHandler
getTimingStatistics
in interface NioHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |