Package org.apache.tomcat.util.net
Class NioEndpoint.Poller
- java.lang.Object
- 
- org.apache.tomcat.util.net.NioEndpoint.Poller
 
- 
- All Implemented Interfaces:
- java.lang.Runnable
 - Enclosing class:
- NioEndpoint
 
 public class NioEndpoint.Poller extends java.lang.Object implements java.lang.RunnablePoller class.
- 
- 
Constructor SummaryConstructors Constructor Description Poller()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(NioEndpoint.NioSocketWrapper socketWrapper, int interestOps)Add specified socket and associated pool to the poller.voidcancelledKey(java.nio.channels.SelectionKey sk, SocketWrapperBase<NioChannel> socketWrapper)protected voiddestroy()Destroy the poller.booleanevents()Processes events in the event queue of the Poller.intgetKeyCount()java.nio.channels.SelectorgetSelector()protected voidprocessKey(java.nio.channels.SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper)SendfileStateprocessSendfile(java.nio.channels.SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, boolean calledByProcessor)protected voidreg(java.nio.channels.SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, int intops)voidregister(NioEndpoint.NioSocketWrapper socketWrapper)Registers a newly created socket with the poller.voidrun()The background thread that adds sockets to the Poller, checks the poller for triggered events and hands the associated socket off to an appropriate processor as events occur.protected voidtimeout(int keyCount, boolean hasEvents)protected voidunreg(java.nio.channels.SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, int readyOps)
 
- 
- 
- 
Method Detail- 
getKeyCountpublic int getKeyCount() 
 - 
getSelectorpublic java.nio.channels.Selector getSelector() 
 - 
destroyprotected void destroy() Destroy the poller.
 - 
addpublic void add(NioEndpoint.NioSocketWrapper socketWrapper, int interestOps) Add specified socket and associated pool to the poller. The socket will be added to a temporary array, and polled first after a maximum amount of time equal to pollTime (in most cases, latency will be much lower, however).- Parameters:
- socketWrapper- to add to the poller
- interestOps- Operations for which to register this socket with the Poller
 
 - 
eventspublic boolean events() Processes events in the event queue of the Poller.- Returns:
- trueif some events were processed,- falseif queue was empty
 
 - 
registerpublic void register(NioEndpoint.NioSocketWrapper socketWrapper) Registers a newly created socket with the poller.- Parameters:
- socketWrapper- The socket wrapper
 
 - 
cancelledKeypublic void cancelledKey(java.nio.channels.SelectionKey sk, SocketWrapperBase<NioChannel> socketWrapper)
 - 
runpublic void run() The background thread that adds sockets to the Poller, checks the poller for triggered events and hands the associated socket off to an appropriate processor as events occur.- Specified by:
- runin interface- java.lang.Runnable
 
 - 
processKeyprotected void processKey(java.nio.channels.SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper)
 - 
processSendfilepublic SendfileState processSendfile(java.nio.channels.SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, boolean calledByProcessor) 
 - 
unregprotected void unreg(java.nio.channels.SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, int readyOps)
 - 
regprotected void reg(java.nio.channels.SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, int intops)
 - 
timeoutprotected void timeout(int keyCount, boolean hasEvents)
 
- 
 
-