Package org.apache.tomcat.util.net
Class Nio2Endpoint
- java.lang.Object
- 
- org.apache.tomcat.util.net.AbstractEndpoint<S,U>
- 
- org.apache.tomcat.util.net.AbstractJsseEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
- 
- org.apache.tomcat.util.net.Nio2Endpoint
 
 
 
- 
 public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel> NIO2 endpoint.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classNio2Endpoint.Nio2Acceptorstatic classNio2Endpoint.Nio2SocketWrapperstatic classNio2Endpoint.SendfileDataSendfileData class.protected classNio2Endpoint.SocketProcessorThis 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 Summary- 
Fields inherited from class org.apache.tomcat.util.net.AbstractEndpointacceptor, acceptorThreadCount, acceptorThreadPriority, attributes, connections, internalExecutor, negotiableProtocols, paused, processorCache, running, sm, socketProperties, sslHostConfigs, threadPriority
 
- 
 - 
Constructor SummaryConstructors Constructor Description Nio2Endpoint()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind()Initialize the endpoint.protected SocketProcessorBase<Nio2Channel>createSocketProcessor(SocketWrapperBase<Nio2Channel> socketWrapper, SocketEvent event)protected voiddestroySocket(java.nio.channels.AsynchronousSocketChannel socket)Close the socket.protected voiddoCloseServerSocket()Actually close the server socket but don't perform any other clean-up.static voidendInline()booleangetDeferAccept()Is deferAccept supported?intgetKeepAliveCount()Number of keep-alive sockets.protected LoggetLog()protected LoggetLogCertificate()protected SynchronizedStack<Nio2Channel>getNioChannels()protected java.nio.channels.NetworkChannelgetServerSocket()static booleanisInline()voidresume()Resume the endpoint, which will make it start accepting new connections again.protected java.nio.channels.AsynchronousSocketChannelserverSocketAccept()protected booleansetSocketOptions(java.nio.channels.AsynchronousSocketChannel socket)Process the specified connection.voidshutdownExecutor()protected voidstartAcceptorThread()static voidstartInline()voidstartInternal()Start the NIO2 endpoint, creating acceptor.voidstopInternal()Stop the endpoint.voidunbind()Deallocate NIO memory pools, and close server socket.- 
Methods inherited from class org.apache.tomcat.util.net.AbstractJsseEndpointcreateSSLContext, createSSLEngine, getLocalAddress, getSniParseLimit, getSslImplementation, getSslImplementationName, initialiseSsl, isAlpnSupported, setSniParseLimit, setSslImplementationName
 - 
Methods inherited from class org.apache.tomcat.util.net.AbstractEndpointaddNegotiatedProtocol, addSslHostConfig, addSslHostConfig, awaitConnectionsClose, closeServerSocketGraceful, closeSocket, countDownConnection, countUpOrAwaitConnection, createExecutor, destroy, destroySsl, findSslHostConfigs, generateCertificateDebug, getAcceptCount, getAcceptorThreadCount, getAcceptorThreadPriority, getAddress, getAttribute, getBindOnInit, getBindState, getConnectionCount, getConnectionLinger, getConnections, getConnectionTimeout, getCurrentThreadCount, getCurrentThreadsBusy, getDaemon, getDefaultSSLHostConfigName, getDomain, getExecutor, getExecutorTerminationTimeoutMillis, getHandler, getId, 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, setAcceptCount, setAcceptorThreadCount, 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, start, stop, toTimeout, unlockAccept
 
- 
 
- 
- 
- 
Method Detail- 
getDeferAcceptpublic boolean getDeferAccept() Is deferAccept supported?- Specified by:
- getDeferAcceptin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
getKeepAliveCountpublic int getKeepAliveCount() Number of keep-alive sockets.- Returns:
- Always returns -1.
 
 - 
bindpublic void bind() throws java.lang.ExceptionInitialize the endpoint.- Specified by:
- bindin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
- Throws:
- java.lang.Exception
 
 - 
startInternalpublic void startInternal() throws java.lang.ExceptionStart the NIO2 endpoint, creating acceptor.- Specified by:
- startInternalin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
- Throws:
- java.lang.Exception
 
 - 
startAcceptorThreadprotected void startAcceptorThread() - Overrides:
- startAcceptorThreadin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
resumepublic void resume() Description copied from class:AbstractEndpointResume the endpoint, which will make it start accepting new connections again.- Overrides:
- resumein class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
stopInternalpublic void stopInternal() Stop the endpoint. This will cause all processing threads to stop.- Specified by:
- stopInternalin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
unbindpublic void unbind() throws java.lang.ExceptionDeallocate NIO memory pools, and close server socket.- Overrides:
- unbindin class- AbstractJsseEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
- Throws:
- java.lang.Exception
 
 - 
doCloseServerSocketprotected void doCloseServerSocket() throws java.io.IOExceptionDescription copied from class:AbstractEndpointActually close the server socket but don't perform any other clean-up.- Specified by:
- doCloseServerSocketin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
- Throws:
- java.io.IOException- If an error occurs closing the socket
 
 - 
shutdownExecutorpublic void shutdownExecutor() - Overrides:
- shutdownExecutorin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
setSocketOptionsprotected boolean setSocketOptions(java.nio.channels.AsynchronousSocketChannel socket) Process the specified connection.- Specified by:
- setSocketOptionsin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
- Parameters:
- socket- The socket channel
- Returns:
- trueif the socket was correctly configured and processing may continue,- falseif the socket needs to be close immediately
 
 - 
destroySocketprotected void destroySocket(java.nio.channels.AsynchronousSocketChannel socket) Description 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<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
- Parameters:
- socket- The newly accepted socket
 
 - 
getNioChannelsprotected SynchronizedStack<Nio2Channel> getNioChannels() 
 - 
getServerSocketprotected java.nio.channels.NetworkChannel getServerSocket() - Specified by:
- getServerSocketin class- AbstractJsseEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
serverSocketAcceptprotected java.nio.channels.AsynchronousSocketChannel serverSocketAccept() throws java.lang.Exception- Specified by:
- serverSocketAcceptin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
- Throws:
- java.lang.Exception
 
 - 
getLogprotected Log getLog() - Specified by:
- getLogin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
getLogCertificateprotected Log getLogCertificate() - Overrides:
- getLogCertificatein class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
createSocketProcessorprotected SocketProcessorBase<Nio2Channel> createSocketProcessor(SocketWrapperBase<Nio2Channel> socketWrapper, SocketEvent event) - Specified by:
- createSocketProcessorin class- AbstractEndpoint<Nio2Channel,java.nio.channels.AsynchronousSocketChannel>
 
 - 
startInlinepublic static void startInline() 
 - 
endInlinepublic static void endInline() 
 - 
isInlinepublic static boolean isInline() 
 
- 
 
-