Methods Summary |
---|
public synchronized void | addChannel(java.nio.channels.SocketChannel channel)Add a Channel to be processed by this
Selector
channels.add(channel);
getSelector().wakeup();
|
public int | getCurrentBusyProcessorThreads()Provides the count of request threads that are currently
being processed by the container
return (getProcessorPipeline().getCurrentThreadsBusy());
|
public ReadTask | getReadTask(java.nio.channels.SelectionKey key)Return a ReadTask configured to use this instance.
ReadTask task = super.getReadTask(key);
task.setSelectorThread(this);
return task;
|
public void | initEndpoint()Initialize this SelectorThread
setName("SelectorReaderThread-" + getPort());
initAlgorithm();
|
private synchronized void | registerNewChannels()Register all Channel with an OP_READ opeation.
int size = channels.size();
for (int i = 0; i < size; i++) {
SocketChannel sc = channels.get(i);
sc.configureBlocking(false);
try {
SelectionKey readKey =
sc.register(getSelector(), SelectionKey.OP_READ);
setSocketOptions(((SocketChannel)readKey.channel()).socket());
} catch (ClosedChannelException cce) {
}
}
channels.clear();
|
public void | startEndpoint()Start and wait for incoming connection
setRunning(true);
while (isRunning()) {
try{
if ( getSelector() == null ){
setSelector(Selector.open());
}
registerNewChannels();
doSelect();
} catch (Throwable t){
logger.log(Level.FINE,"selectorThread.errorOnRequest",t);
}
}
|