Package org.apache.tomcat.util.net
Class NioEndpoint
java.lang.Object
org.apache.tomcat.util.net.AbstractEndpoint<S,U>
 
org.apache.tomcat.util.net.AbstractJsseEndpoint<NioChannel,SocketChannel>
 
org.apache.tomcat.util.net.NioEndpoint
NIO tailored thread pool, providing the following services:
 
- Socket acceptor thread
- Socket poller thread
- Worker threads pool
- Author:
- Mladen Turk, Remy Maucherat
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classclassPoller class.static classPollerEvent, cacheable object for poller events to avoid GCstatic classSendfileData class.protected classThis class is the equivalent of the Worker, but will simply use in an external Executor thread pool.Nested classes/interfaces inherited from class org.apache.tomcat.util.net.AbstractEndpointAbstractEndpoint.BindState, AbstractEndpoint.Handler<S>
- 
Field SummaryFieldsFields inherited from class org.apache.tomcat.util.net.AbstractEndpointacceptor, acceptorThreadPriority, attributes, connections, internalExecutor, negotiableProtocols, paused, processorCache, running, sm, socketProperties, sslHostConfigs, threadPriority
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidbind()Initialize the endpoint.protected SocketProcessorBase<NioChannel>createSocketProcessor(SocketWrapperBase<NioChannel> socketWrapper, SocketEvent event) protected voiddestroySocket(SocketChannel socket) Close the socket.protected voidActually close the server socket but don't perform any other clean-up.getId()The default behavior is to identify connectors uniquely with address and port.intNumber of keep-alive sockets.protected LoggetLog()protected Logprotected SynchronizedStack<NioChannel>protected NioEndpoint.Pollerintlongprotected NetworkChannelprotected CountDownLatchbooleanprotected voidprotected SocketChannelvoidsetPollerThreadPriority(int pollerThreadPriority) voidsetSelectorTimeout(long timeout) protected booleansetSocketOptions(SocketChannel socket) Process the specified connection.protected voidsetStopLatch(CountDownLatch stopLatch) voidsetUnixDomainSocketPath(String unixDomainSocketPath) voidsetUnixDomainSocketPathPermissions(String unixDomainSocketPathPermissions) voidsetUseInheritedChannel(boolean useInheritedChannel) voidStart the NIO endpoint, creating acceptor, poller threads.voidStop the endpoint.voidunbind()Deallocate NIO memory pools, and close server socket.protected voidUnlock the server socket acceptor threads using bogus connections.Methods inherited from class org.apache.tomcat.util.net.AbstractJsseEndpointcreateSSLContext, createSSLEngine, getLocalAddress, getSniParseLimit, getSslImplementation, getSslImplementationName, initialiseSsl, setSniParseLimit, setSslImplementationNameMethods inherited from class org.apache.tomcat.util.net.AbstractEndpointaddNegotiatedProtocol, addSslHostConfig, addSslHostConfig, awaitConnectionsClose, closeServerSocketGraceful, closeSocket, countDownConnection, countUpOrAwaitConnection, createExecutor, destroy, destroySsl, findSslHostConfigs, generateCertificateDebug, getAcceptCount, getAcceptorThreadPriority, getAddress, getAttribute, getBindOnInit, getBindState, getConnectionCount, getConnectionLinger, getConnections, getConnectionTimeout, getCurrentThreadCount, getCurrentThreadsBusy, getDaemon, getDefaultSSLHostConfigName, getDeferAccept, getDomain, getExecutor, getExecutorTerminationTimeoutMillis, getHandler, getKeepAliveTimeout, getLocalPort, getMaxConnections, getMaxKeepAliveRequests, getMaxThreads, getMinSpareThreads, getName, getPort, getPortOffset, getPortWithOffset, getProperty, getSocketProperties, getSSLHostConfig, getTcpNoDelay, getThreadPriority, getUseAsyncIO, getUseSendfile, getUseVirtualThreads, getUtilityExecutor, hasNegotiableProtocols, init, initializeConnectionLatch, isPaused, isRunning, isSSLEnabled, logCertificate, pause, processSocket, releaseSSLContext, reloadSslHostConfig, reloadSslHostConfigs, removeSslHostConfig, resume, setAcceptCount, setAcceptorThreadPriority, setAddress, setAttribute, setBindOnInit, setConnectionLinger, setConnectionTimeout, setDaemon, setDefaultSSLHostConfigName, setDomain, setExecutor, setExecutorTerminationTimeoutMillis, setHandler, setKeepAliveTimeout, setMaxConnections, setMaxKeepAliveRequests, setMaxThreads, setMinSpareThreads, setName, setPort, setPortOffset, setProperty, setSSLEnabled, setTcpNoDelay, setThreadPriority, setUseAsyncIO, setUseSendfile, setUseVirtualThreads, setUtilityExecutor, shutdownExecutor, start, startAcceptorThread, stop, toTimeout
- 
Field Details- 
OP_REGISTERpublic static final int OP_REGISTER- See Also:
 
 
- 
- 
Constructor Details- 
NioEndpointpublic NioEndpoint()
 
- 
- 
Method Details- 
setUseInheritedChannelpublic void setUseInheritedChannel(boolean useInheritedChannel) 
- 
getUseInheritedChannelpublic boolean getUseInheritedChannel()
- 
getUnixDomainSocketPath
- 
setUnixDomainSocketPath
- 
getUnixDomainSocketPathPermissions
- 
setUnixDomainSocketPathPermissions
- 
setPollerThreadPrioritypublic void setPollerThreadPriority(int pollerThreadPriority) 
- 
getPollerThreadPrioritypublic int getPollerThreadPriority()
- 
setSelectorTimeoutpublic void setSelectorTimeout(long timeout) 
- 
getSelectorTimeoutpublic long getSelectorTimeout()
- 
getKeepAliveCountpublic int getKeepAliveCount()Number of keep-alive sockets.- Returns:
- The number of sockets currently in the keep-alive state waiting for the next request to be received on the socket
 
- 
getIdDescription copied from class:AbstractEndpointThe default behavior is to identify connectors uniquely with address and port. However, certain connectors are not using that and need some other identifier, which then can be used as a replacement.- Overrides:
- getIdin class- AbstractEndpoint<NioChannel,- SocketChannel> 
- Returns:
- the id
 
- 
bindInitialize the endpoint.- Specified by:
- bindin class- AbstractEndpoint<NioChannel,- SocketChannel> 
- Throws:
- Exception
 
- 
initServerSocket- Throws:
- Exception
 
- 
startInternalStart the NIO endpoint, creating acceptor, poller threads.- Specified by:
- startInternalin class- AbstractEndpoint<NioChannel,- SocketChannel> 
- Throws:
- Exception
 
- 
stopInternalpublic void stopInternal()Stop the endpoint. This will cause all processing threads to stop.- Specified by:
- stopInternalin class- AbstractEndpoint<NioChannel,- SocketChannel> 
 
- 
unbindDeallocate NIO memory pools, and close server socket.- Overrides:
- unbindin class- AbstractJsseEndpoint<NioChannel,- SocketChannel> 
- Throws:
- Exception
 
- 
doCloseServerSocketDescription copied from class:AbstractEndpointActually close the server socket but don't perform any other clean-up.- Specified by:
- doCloseServerSocketin class- AbstractEndpoint<NioChannel,- SocketChannel> 
- Throws:
- IOException- If an error occurs closing the socket
 
- 
unlockAcceptprotected void unlockAccept()Description copied from class:AbstractEndpointUnlock the server socket acceptor threads using bogus connections.- Overrides:
- unlockAcceptin class- AbstractEndpoint<NioChannel,- SocketChannel> 
 
- 
getNioChannels
- 
getPoller
- 
getStopLatch
- 
setStopLatch
- 
setSocketOptionsProcess the specified connection.- Specified by:
- setSocketOptionsin class- AbstractEndpoint<NioChannel,- SocketChannel> 
- Parameters:
- socket- The socket channel
- Returns:
- trueif the socket was correctly configured and processing may continue,- falseif the socket needs to be close immediately
 
- 
destroySocketDescription copied from class:AbstractEndpointClose the socket. This is used when the connector is not in a state which allows processing the socket, or if there was an error which prevented the allocation of the socket wrapper.- Specified by:
- destroySocketin class- AbstractEndpoint<NioChannel,- SocketChannel> 
- Parameters:
- socket- The newly accepted socket
 
- 
getServerSocket- Specified by:
- getServerSocketin class- AbstractJsseEndpoint<NioChannel,- SocketChannel> 
 
- 
serverSocketAccept- Specified by:
- serverSocketAcceptin class- AbstractEndpoint<NioChannel,- SocketChannel> 
- Throws:
- Exception
 
- 
getLog- Specified by:
- getLogin class- AbstractEndpoint<NioChannel,- SocketChannel> 
 
- 
getLogCertificate- Overrides:
- getLogCertificatein class- AbstractEndpoint<NioChannel,- SocketChannel> 
 
- 
createSocketProcessorprotected SocketProcessorBase<NioChannel> createSocketProcessor(SocketWrapperBase<NioChannel> socketWrapper, SocketEvent event) - Specified by:
- createSocketProcessorin class- AbstractEndpoint<NioChannel,- SocketChannel> 
 
 
-