Class Nio2Endpoint
java.lang.Object
org.apache.tomcat.util.net.AbstractEndpoint<Nio2Channel,AsynchronousSocketChannel>
org.apache.tomcat.util.net.AbstractNetworkChannelEndpoint<Nio2Channel,AsynchronousSocketChannel>
org.apache.tomcat.util.net.Nio2Endpoint
public class Nio2Endpoint
extends AbstractNetworkChannelEndpoint<Nio2Channel,AsynchronousSocketChannel>
NIO2 endpoint.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
static class
static class
SendfileData class.protected class
This 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.AbstractEndpoint
AbstractEndpoint.BindState, AbstractEndpoint.Handler<S>
-
Field Summary
Fields inherited from class org.apache.tomcat.util.net.AbstractEndpoint
acceptor, acceptorThreadPriority, attributes, connections, internalExecutor, negotiableProtocols, paused, processorCache, running, sm, socketProperties, sslHostConfigs, threadPriority
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bind()
Initialize the endpoint.protected Nio2Channel
createChannel
(SocketBufferHandler buffer) protected SocketProcessorBase
<Nio2Channel> createSocketProcessor
(SocketWrapperBase<Nio2Channel> socketWrapper, SocketEvent event) protected void
Close the socket.protected void
Actually close the server socket but don't perform any other clean-up.static void
int
Number of keep-alive sockets.protected Log
getLog()
protected Log
protected SynchronizedStack
<Nio2Channel> protected NetworkChannel
static boolean
isInline()
void
resume()
Resume the endpoint, which will make it start accepting new connections again.protected AsynchronousSocketChannel
protected boolean
Process the specified connection.void
protected void
static void
void
Start the NIO2 endpoint, creating acceptor.void
Stop the endpoint.void
unbind()
Deallocate NIO memory pools, and close server socket.Methods inherited from class org.apache.tomcat.util.net.AbstractNetworkChannelEndpoint
getLocalAddress
Methods inherited from class org.apache.tomcat.util.net.AbstractEndpoint
addNegotiatedProtocol, addSslHostConfig, addSslHostConfig, awaitConnectionsClose, closeServerSocketGraceful, closeSocket, countDownConnection, countUpOrAwaitConnection, createExecutor, createSSLContext, createSSLEngine, destroy, destroySsl, findSslHostConfigs, generateCertificateDebug, getAcceptCount, getAcceptorThreadPriority, getAddress, getAttribute, getBindOnInit, getBindState, getConnectionCount, getConnectionLinger, getConnections, getConnectionTimeout, getCurrentThreadCount, getCurrentThreadsBusy, getDaemon, getDefaultSSLHostConfigName, getDomain, getExecutor, getExecutorTerminationTimeoutMillis, getHandler, getId, getKeepAliveTimeout, getLocalPort, getMaxConnections, getMaxKeepAliveRequests, getMaxQueueSize, getMaxThreads, getMinSpareThreads, getName, getPort, getPortOffset, getPortWithOffset, getProperty, getSniParseLimit, getSocketProperties, getSSLHostConfig, getSslImplementation, getSslImplementationName, getTcpNoDelay, getThreadPriority, getThreadsMaxIdleTime, getUseAsyncIO, getUseSendfile, getUseVirtualThreads, getUtilityExecutor, hasNegotiableProtocols, init, initialiseSsl, initializeConnectionLatch, isPaused, isRunning, isSSLEnabled, logCertificate, pause, processSocket, releaseSSLContext, reloadSslHostConfig, reloadSslHostConfigs, removeSslHostConfig, setAcceptCount, setAcceptorThreadPriority, setAddress, setAttribute, setBindOnInit, setConnectionLinger, setConnectionTimeout, setDaemon, setDefaultSSLHostConfigName, setDomain, setExecutor, setExecutorTerminationTimeoutMillis, setHandler, setKeepAliveTimeout, setMaxConnections, setMaxKeepAliveRequests, setMaxQueueSize, setMaxThreads, setMinSpareThreads, setName, setPort, setPortOffset, setProperty, setSniParseLimit, setSSLEnabled, setSslImplementationName, setTcpNoDelay, setThreadPriority, setThreadsMaxIdleTime, setUseAsyncIO, setUseSendfile, setUseVirtualThreads, setUtilityExecutor, start, stop, toTimeout, unlockAccept
-
Constructor Details
-
Nio2Endpoint
public Nio2Endpoint()
-
-
Method Details
-
getKeepAliveCount
public int getKeepAliveCount()Number of keep-alive sockets.- Returns:
- Always returns -1.
-
bind
Initialize the endpoint.- Specified by:
bind
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel> - Throws:
Exception
-
startInternal
Start the NIO2 endpoint, creating acceptor.- Specified by:
startInternal
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel> - Throws:
Exception
-
startAcceptorThread
protected void startAcceptorThread()- Overrides:
startAcceptorThread
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
resume
public void resume()Description copied from class:AbstractEndpoint
Resume the endpoint, which will make it start accepting new connections again.- Overrides:
resume
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
stopInternal
public void stopInternal()Stop the endpoint. This will cause all processing threads to stop.- Specified by:
stopInternal
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
unbind
Deallocate NIO memory pools, and close server socket.- Overrides:
unbind
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel> - Throws:
Exception
-
doCloseServerSocket
Description copied from class:AbstractEndpoint
Actually close the server socket but don't perform any other clean-up.- Specified by:
doCloseServerSocket
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel> - Throws:
IOException
- If an error occurs closing the socket
-
shutdownExecutor
public void shutdownExecutor()- Overrides:
shutdownExecutor
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
setSocketOptions
Process the specified connection.- Specified by:
setSocketOptions
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel> - Parameters:
socket
- The socket channel- Returns:
true
if the socket was correctly configured and processing may continue,false
if the socket needs to be close immediately
-
destroySocket
Description copied from class:AbstractEndpoint
Close 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:
destroySocket
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel> - Parameters:
socket
- The newly accepted socket
-
getNioChannels
-
getServerSocket
- Specified by:
getServerSocket
in classAbstractNetworkChannelEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
serverSocketAccept
- Specified by:
serverSocketAccept
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel> - Throws:
Exception
-
getLog
- Specified by:
getLog
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
getLogCertificate
- Overrides:
getLogCertificate
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
createSocketProcessor
protected SocketProcessorBase<Nio2Channel> createSocketProcessor(SocketWrapperBase<Nio2Channel> socketWrapper, SocketEvent event) - Specified by:
createSocketProcessor
in classAbstractEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
createChannel
- Specified by:
createChannel
in classAbstractNetworkChannelEndpoint<Nio2Channel,
AsynchronousSocketChannel>
-
startInline
public static void startInline() -
endInline
public static void endInline() -
isInline
public static boolean isInline()
-