Class AbstractEndpoint<S,U>
java.lang.Object
org.apache.tomcat.util.net.AbstractEndpoint<S,U>
- Type Parameters:
S- The type used by the socket wrapper associated with this endpoint. Might be the same as U.U- The type of the underlying socket used by this endpoint. Might be the same as S.
- Direct Known Subclasses:
AbstractJsseEndpoint
Abstract endpoint implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumEnum representing the possible states of the bind operation.static interfaceInterface for handlers used by an endpoint. -
Field Summary
FieldsModifier and TypeFieldDescriptionThread used to accept new connections and pass them to worker threads.protected intPriority of the acceptor threads.Attributes provide a way for configuration to be passed to subcomponents without theProtocolHandlerbeing aware of the properties available on those subcomponents.protected Map<U, SocketWrapperBase<S>> Map holding all current connections keyed with the sockets.protected booleanAre we using an internal executorList of protocols that can be negotiated (e.g.protected booleanWill be set to true whenever the endpoint is paused.protected SynchronizedStack<SocketProcessorBase<S>> Cache for SocketProcessor objectsprotected booleanRunning state of the endpoint.protected static final StringManagerString manager for this package.protected final SocketPropertiesSocket propertiesprotected ConcurrentMap<String, SSLHostConfig> Map of SSL host configurations keyed by host name.protected intPriority of the worker threads. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNegotiatedProtocol(String negotiableProtocol) Add a protocol that can be negotiated (e.g.voidaddSslHostConfig(SSLHostConfig sslHostConfig) Add the given SSL Host configuration.voidaddSslHostConfig(SSLHostConfig sslHostConfig, boolean replace) Add the given SSL Host configuration, optionally replacing the existing configuration for the given host.final longawaitConnectionsClose(long waitMillis) Wait for the client connections to the server to close gracefully.abstract voidbind()Bind the endpoint to its port and address.booleanCheck if two host names share the same SSLHostConfig.final voidprotected voidcloseSocket(U socket) Close the socket when the connection has to be immediately closed when an error occurs while configuring the accepted socket or trying to dispatch it for processing.protected longCount down a connection.protected voidCount up or await a connection slot.voidCreate the internal executor.protected abstract SocketProcessorBase<S> createSocketProcessor(SocketWrapperBase<S> socketWrapper, SocketEvent event) Create a socket processor for the given socket wrapper.protected abstract voidcreateSSLContext(SSLHostConfig sslHostConfig) Create the SSLContext for the given SSLHostConfig.final voiddestroy()Destroy the endpoint and release all resources.protected abstract voiddestroySocket(U socket) Close the socket.protected voidDestroy the SSL configuration.protected abstract voidActually close the server socket but don't perform any other clean-up.Find all SSL host configurations.protected StringgenerateCertificateDebug(X509Certificate certificate) Generate debug information about a certificate.intGet the accept count.intGet the acceptor thread priority.Get the bind address.getAttribute(String key) Used by subcomponents to retrieve configuration information.booleanGet the bind on init flag.protected AbstractEndpoint.BindStateGet the current bind state.longReturn the current count of connections handled by this endpoint, if the connections are counted (which happens when the maximum count of connections is limited), or-1if they are not.intSocket linger.Get a set with the current open connections.intSocket timeout.intReturn the amount of threads that are managed by the pool.intReturn the amount of threads that are in usebooleanCheck if the threads are daemon threads.Get the host name for the default SSL configuration for this endpoint - always in lower case.booleanDeprecated.This code will be removed in Tomcat 11 onwardsGet the JMX domain.Get the external executor.longGet the executor termination timeout.Get the handler.getId()The default behavior is to identify connectors uniquely with address and port.intGet the keepalive timeout.protected abstract InetSocketAddressObtain the network address the server socket is bound to.final intGet the local port the server socket is bound to.protected abstract LoggetLog()Get the logger for this endpoint.protected LogGet the logger for certificate-related messages.intGet the maximum number of connections.intGet the maximum number of keep alive requests.intGet the maximum queue size.intGet the maximum number of worker threads.intGet the minimum number of spare threads.getName()Get the name of the thread pool.intgetPort()Get the server socket port.intGet the port offset.intGet the port with offset applied.getProperty(String name) Get the value of the specified property.Get the socket properties.protected SSLHostConfiggetSSLHostConfig(String sniHostName) Look up the SSLHostConfig for the given host name.booleanGet the strict SNI check flag.booleanSocket TCP no delay.intGet the priority of the worker threads.intGet the maximum idle time for threads in the internal thread pool.booleanCheck if asynchronous IO is enabled.booleanGet the sendfile flag.booleanGet whether virtual threads are enabled.Get the utility executor.booleanCheck if there are any negotiable protocols configured.final voidinit()Initialize the endpoint.protected LimitLatchInitialize the connection latch if it has not already been created.booleanisPaused()Check if the endpoint is paused.booleanCheck if the endpoint is running.booleanCheck if SSL is enabled.protected voidlogCertificate(SSLHostConfigCertificate certificate) Log information about the given certificate.voidpause()Pause the endpoint, which will stop it accepting new connections and unlock the acceptor.booleanprocessSocket(SocketWrapperBase<S> socketWrapper, SocketEvent event, boolean dispatch) Process the given SocketWrapper with the given status.protected voidreleaseSSLContext(SSLHostConfig sslHostConfig) Release the SSLContext, if any, associated with the SSLHostConfig.voidreloadSslHostConfig(String hostName) Re-read the configuration files for the SSL host and replace the existing SSL configuration with the updated settings.voidRe-read the configuration files for all SSL hosts and replace the existing SSL configuration with the updated settings.removeSslHostConfig(String hostName) Removes the SSL host configuration for the given host name, if such a configuration exists.voidresume()Resume the endpoint, which will make it start accepting new connections again.protected abstract UAccept a connection from the server socket.voidsetAcceptCount(int acceptCount) Set the accept count.voidsetAcceptorThreadPriority(int acceptorThreadPriority) Set the acceptor thread priority.voidsetAddress(InetAddress address) Set the bind address.voidsetAttribute(String name, Object value) Generic property setter called when a property for which a specific setter already exists within theProtocolHandlerneeds to be made available to subcomponents.voidsetBindOnInit(boolean b) Set the bind on init flag.voidsetConnectionLinger(int connectionLinger) Set the connection linger time.voidsetConnectionTimeout(int soTimeout) Set the connection timeout.voidsetDaemon(boolean b) Set whether the threads should be daemon threads.voidsetDefaultSSLHostConfigName(String defaultSSLHostConfigName) Set the host name for the default SSL configuration.voidSet the domain for JMX registration.voidsetExecutor(Executor executor) Set the external executor.voidsetExecutorTerminationTimeoutMillis(long executorTerminationTimeoutMillis) Set the executor termination timeout.voidsetHandler(AbstractEndpoint.Handler<S> handler) Set the handler for this endpoint.voidsetKeepAliveTimeout(int keepAliveTimeout) Set the keepalive timeout.voidsetMaxConnections(int maxCon) Set the maximum number of connections.voidsetMaxKeepAliveRequests(int maxKeepAliveRequests) Set the maximum number of keep alive requests.voidsetMaxQueueSize(int maxQueueSize) Set the maximum task queue size.voidsetMaxThreads(int maxThreads) Set the maximum number of worker threads.voidsetMinSpareThreads(int minSpareThreads) Set the minimum number of spare threads.voidSet the name of the thread pool.voidsetPort(int port) Set the server socket port.voidsetPortOffset(int portOffset) Set the port offset.booleansetProperty(String name, String value) Set the specified property.protected abstract booleansetSocketOptions(U socket) Set the socket options for the given accepted socket.voidsetSSLEnabled(boolean SSLEnabled) Set the SSL enabled flag.voidsetStrictSni(boolean strictSni) Set the strict SNI check flag.voidsetTcpNoDelay(boolean tcpNoDelay) Set the TCP no delay flag.voidsetThreadPriority(int threadPriority) Set the priority of the worker threads.voidsetThreadsMaxIdleTime(int threadsMaxIdleTime) Set the maximum idle time for threads in the internal thread pool.voidsetUseAsyncIO(boolean useAsyncIO) Set whether asynchronous IO is enabled.voidsetUseSendfile(boolean useSendfile) Set the sendfile flag.voidsetUseVirtualThreads(boolean useVirtualThreads) Set whether virtual threads should be used.voidsetUtilityExecutor(ScheduledExecutorService utilityExecutor) Set the utility executor.voidShutdown the internal executor.final voidstart()Start the endpoint.protected voidStart the acceptor thread.abstract voidStart the endpoint internal components.final voidstop()Stop the endpoint.abstract voidStop the endpoint internal components.static longtoTimeout(long timeout) Convert a timeout value to a positive timeout suitable for use with socket operations.abstract voidunbind()protected voidUnlock the server socket acceptor threads using bogus connections.
-
Field Details
-
sm
String manager for this package. -
running
protected volatile boolean runningRunning state of the endpoint. -
paused
protected volatile boolean pausedWill be set to true whenever the endpoint is paused. -
internalExecutor
protected volatile boolean internalExecutorAre we using an internal executor -
socketProperties
Socket properties -
acceptor
-
processorCache
Cache for SocketProcessor objects -
connections
Map holding all current connections keyed with the sockets. -
sslHostConfigs
Map of SSL host configurations keyed by host name. -
acceptorThreadPriority
protected int acceptorThreadPriorityPriority of the acceptor threads. -
threadPriority
protected int threadPriorityPriority of the worker threads. -
negotiableProtocols
-
attributes
Attributes provide a way for configuration to be passed to subcomponents without theProtocolHandlerbeing aware of the properties available on those subcomponents.
-
-
Constructor Details
-
AbstractEndpoint
public AbstractEndpoint()Construct and return an endpoint.
-
-
Method Details
-
toTimeout
public static long toTimeout(long timeout) Convert a timeout value to a positive timeout suitable for use with socket operations.- Parameters:
timeout- The timeout value in milliseconds. If less than or equal to 0, returnsLong.MAX_VALUE.- Returns:
- The timeout value, or
Long.MAX_VALUEif the input is less than or equal to 0
-
getSocketProperties
Get the socket properties.- Returns:
- The socket properties
-
getConnections
Get a set with the current open connections.- Returns:
- A set with the open socket wrappers
-
getStrictSni
public boolean getStrictSni()Get the strict SNI check flag.- Returns:
- True if strict SNI checking is enabled
-
setStrictSni
public void setStrictSni(boolean strictSni) Set the strict SNI check flag.- Parameters:
strictSni- True to enable strict SNI checking
-
getDefaultSSLHostConfigName
Get the host name for the default SSL configuration for this endpoint - always in lower case.- Returns:
- The host name for the default SSL configuration for this endpoint - always in lower case.
-
setDefaultSSLHostConfigName
Set the host name for the default SSL configuration.- Parameters:
defaultSSLHostConfigName- The default SSL host configuration name
-
addSslHostConfig
Add the given SSL Host configuration.- Parameters:
sslHostConfig- The configuration to add- Throws:
IllegalArgumentException- If the host name is not valid or if a configuration has already been provided for that host
-
addSslHostConfig
public void addSslHostConfig(SSLHostConfig sslHostConfig, boolean replace) throws IllegalArgumentException Add the given SSL Host configuration, optionally replacing the existing configuration for the given host.- Parameters:
sslHostConfig- The configuration to addreplace- Iftruereplacement of an existing configuration is permitted, otherwise any such attempted replacement will trigger an exception- Throws:
IllegalArgumentException- If the host name is not valid or if a configuration has already been provided for that host and replacement is not allowed
-
removeSslHostConfig
Removes the SSL host configuration for the given host name, if such a configuration exists.- Parameters:
hostName- The host name associated with the SSL host configuration to remove- Returns:
- The SSL host configuration that was removed, if any
-
reloadSslHostConfig
Re-read the configuration files for the SSL host and replace the existing SSL configuration with the updated settings. Note this replacement will happen even if the settings remain unchanged.- Parameters:
hostName- The SSL host for which the configuration should be reloaded. This must match a current SSL host
-
reloadSslHostConfigs
public void reloadSslHostConfigs()Re-read the configuration files for all SSL hosts and replace the existing SSL configuration with the updated settings. Note this replacement will happen even if the settings remain unchanged. -
findSslHostConfigs
Find all SSL host configurations.- Returns:
- An array of all SSL host configurations
-
createSSLContext
Create the SSLContext for the given SSLHostConfig.- Parameters:
sslHostConfig- The SSLHostConfig for which the SSLContext should be created- Throws:
Exception- If the SSLContext cannot be created for the given SSLHostConfig
-
logCertificate
Log information about the given certificate.- Parameters:
certificate- The certificate to log information about
-
generateCertificateDebug
Generate debug information about a certificate.- Parameters:
certificate- The certificate to generate debug info for- Returns:
- A string containing certificate debug information
-
destroySsl
-
releaseSSLContext
Release the SSLContext, if any, associated with the SSLHostConfig.- Parameters:
sslHostConfig- The SSLHostConfig for which the SSLContext should be released
-
getSSLHostConfig
Look up the SSLHostConfig for the given host name. Lookup order is:- exact match
- wild card match
- default SSLHostConfig
- Parameters:
sniHostName- Host name - must be in lower case- Returns:
- The SSLHostConfig for the given host name.
-
checkSni
Check if two host names share the same SSLHostConfig.- Parameters:
sniHostName- the host name from SNI, null if SNI is not in useprotocolHostName- the host name from the protocol- Returns:
- true if SNI is not checked, if the SNI host name matches the protocol host name, if both host names use the same SSLHostConfig configuration, if there is no SNI and the protocol host name uses the default SSLHostConfig configuration, and false otherwise
-
getUseSendfile
public boolean getUseSendfile()Get the sendfile flag.- Returns:
- True if sendfile is enabled
-
setUseSendfile
public void setUseSendfile(boolean useSendfile) Set the sendfile flag.- Parameters:
useSendfile- True to enable sendfile
-
getExecutorTerminationTimeoutMillis
public long getExecutorTerminationTimeoutMillis()Get the executor termination timeout.- Returns:
- The executor termination timeout in milliseconds
-
setExecutorTerminationTimeoutMillis
public void setExecutorTerminationTimeoutMillis(long executorTerminationTimeoutMillis) Set the executor termination timeout.- Parameters:
executorTerminationTimeoutMillis- The timeout in milliseconds
-
setAcceptorThreadPriority
public void setAcceptorThreadPriority(int acceptorThreadPriority) Set the acceptor thread priority.- Parameters:
acceptorThreadPriority- The thread priority
-
getAcceptorThreadPriority
public int getAcceptorThreadPriority()Get the acceptor thread priority.- Returns:
- The acceptor thread priority
-
setMaxConnections
public void setMaxConnections(int maxCon) Set the maximum number of connections.- Parameters:
maxCon- The maximum number of connections (-1 for unlimited)
-
getMaxConnections
public int getMaxConnections()Get the maximum number of connections.- Returns:
- The maximum number of connections
-
getConnectionCount
public long getConnectionCount()Return the current count of connections handled by this endpoint, if the connections are counted (which happens when the maximum count of connections is limited), or-1if they are not. This property is added here so that this value can be inspected through JMX. It is visible on "ThreadPool" MBean.The count is incremented by the Acceptor before it tries to accept a new connection. Until the limit is reached and thus the count cannot be incremented, this value is more by 1 (the count of acceptors) than the actual count of connections that are being served.
- Returns:
- The count
-
setExecutor
Set the external executor.- Parameters:
executor- The external executor (null to use internal executor)
-
getExecutor
Get the external executor.- Returns:
- The external executor, or null if none is configured
-
setUseVirtualThreads
public void setUseVirtualThreads(boolean useVirtualThreads) Set whether virtual threads should be used.- Parameters:
useVirtualThreads- True to use virtual threads
-
getUseVirtualThreads
public boolean getUseVirtualThreads()Get whether virtual threads are enabled.- Returns:
- True if virtual threads are enabled
-
setUtilityExecutor
Set the utility executor.- Parameters:
utilityExecutor- The utility executor
-
getUtilityExecutor
Get the utility executor.- Returns:
- The utility executor
-
getPort
public int getPort()Get the server socket port.- Returns:
- The server socket port
-
setPort
public void setPort(int port) Set the server socket port.- Parameters:
port- The server socket port
-
getPortOffset
public int getPortOffset()Get the port offset.- Returns:
- The port offset
-
setPortOffset
public void setPortOffset(int portOffset) Set the port offset.- Parameters:
portOffset- The port offset (must be >= 0)
-
getPortWithOffset
public int getPortWithOffset()Get the port with offset applied.- Returns:
- The port with offset, or the port if port <= 0
-
getLocalPort
public final int getLocalPort()Get the local port the server socket is bound to.- Returns:
- The local port or -1 if not bound
-
getAddress
-
setAddress
Set the bind address.- Parameters:
address- The bind address
-
getLocalAddress
Obtain the network address the server socket is bound to. This primarily exists to enable the correct address to be used when unlocking the server socket since it removes the guess-work involved if no address is specifically set.- Returns:
- The network address that the server socket is listening on or null if the server socket is not currently bound.
- Throws:
IOException- If there is a problem determining the currently bound socket
-
setAcceptCount
public void setAcceptCount(int acceptCount) Set the accept count.- Parameters:
acceptCount- The accept count (must be > 0)
-
getAcceptCount
public int getAcceptCount()Get the accept count.- Returns:
- The accept count
-
getBindOnInit
public boolean getBindOnInit()Get the bind on init flag.- Returns:
- True if the endpoint binds on init, false if it binds on start
-
setBindOnInit
public void setBindOnInit(boolean b) Set the bind on init flag.- Parameters:
b- True to bind on init, false to bind on start
-
getBindState
Get the current bind state.- Returns:
- The current bind state
-
getKeepAliveTimeout
public int getKeepAliveTimeout()Get the keepalive timeout.- Returns:
- The keepalive timeout in milliseconds
-
setKeepAliveTimeout
public void setKeepAliveTimeout(int keepAliveTimeout) Set the keepalive timeout.- Parameters:
keepAliveTimeout- The keepalive timeout in milliseconds
-
getTcpNoDelay
public boolean getTcpNoDelay()Socket TCP no delay.- Returns:
- The current TCP no delay setting for sockets created by this endpoint
-
setTcpNoDelay
public void setTcpNoDelay(boolean tcpNoDelay) Set the TCP no delay flag.- Parameters:
tcpNoDelay- True to enable TCP no delay
-
getConnectionLinger
public int getConnectionLinger()Socket linger.- Returns:
- The current socket linger time for sockets created by this endpoint
-
setConnectionLinger
public void setConnectionLinger(int connectionLinger) Set the connection linger time.- Parameters:
connectionLinger- The socket linger time in seconds
-
getConnectionTimeout
public int getConnectionTimeout()Socket timeout.- Returns:
- The current socket timeout for sockets created by this endpoint
-
setConnectionTimeout
public void setConnectionTimeout(int soTimeout) Set the connection timeout.- Parameters:
soTimeout- The socket timeout in milliseconds
-
isSSLEnabled
public boolean isSSLEnabled()Check if SSL is enabled.- Returns:
- True if SSL is enabled
-
setSSLEnabled
public void setSSLEnabled(boolean SSLEnabled) Set the SSL enabled flag.- Parameters:
SSLEnabled- True to enable SSL
-
setMinSpareThreads
public void setMinSpareThreads(int minSpareThreads) Set the minimum number of spare threads.- Parameters:
minSpareThreads- The minimum number of spare threads
-
getMinSpareThreads
public int getMinSpareThreads()Get the minimum number of spare threads.- Returns:
- The minimum number of spare threads
-
setMaxThreads
public void setMaxThreads(int maxThreads) Set the maximum number of worker threads.- Parameters:
maxThreads- The maximum number of worker threads
-
getMaxThreads
public int getMaxThreads()Get the maximum number of worker threads.- Returns:
- The maximum number of worker threads, or -1 if no internal executor is used
-
setMaxQueueSize
public void setMaxQueueSize(int maxQueueSize) Set the maximum task queue size.- Parameters:
maxQueueSize- The maximum queue size
-
getMaxQueueSize
public int getMaxQueueSize()Get the maximum queue size.- Returns:
- The maximum queue size
-
setThreadsMaxIdleTime
public void setThreadsMaxIdleTime(int threadsMaxIdleTime) Set the maximum idle time for threads in the internal thread pool.- Parameters:
threadsMaxIdleTime- The maximum idle time in milliseconds
-
getThreadsMaxIdleTime
public int getThreadsMaxIdleTime()Get the maximum idle time for threads in the internal thread pool.- Returns:
- The maximum idle time in milliseconds, or -1 if no internal executor is used
-
setThreadPriority
public void setThreadPriority(int threadPriority) Set the priority of the worker threads.- Parameters:
threadPriority- The thread priority
-
getThreadPriority
public int getThreadPriority()Get the priority of the worker threads.- Returns:
- The thread priority, or -1 if no internal executor is used
-
getMaxKeepAliveRequests
public int getMaxKeepAliveRequests()Get the maximum number of keep alive requests.- Returns:
- The maximum number of keep alive requests
-
setMaxKeepAliveRequests
public void setMaxKeepAliveRequests(int maxKeepAliveRequests) Set the maximum number of keep alive requests.- Parameters:
maxKeepAliveRequests- The maximum number of keep alive requests
-
setName
Set the name of the thread pool.- Parameters:
name- The name of the thread pool
-
getName
-
setDomain
Set the domain for JMX registration.- Parameters:
domain- The JMX domain
-
getDomain
-
setDaemon
public void setDaemon(boolean b) Set whether the threads should be daemon threads.- Parameters:
b- True to use daemon threads
-
getDaemon
public boolean getDaemon()Check if the threads are daemon threads.- Returns:
- True if the threads are daemon threads
-
setUseAsyncIO
public void setUseAsyncIO(boolean useAsyncIO) Set whether asynchronous IO is enabled.- Parameters:
useAsyncIO- True to enable asynchronous IO
-
getUseAsyncIO
public boolean getUseAsyncIO()Check if asynchronous IO is enabled.- Returns:
- True if asynchronous IO is enabled
-
getDeferAccept
Deprecated.This code will be removed in Tomcat 11 onwardsAlways returnsfalse.- Returns:
- Always
false
-
getId
The 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.- Returns:
- the id
-
addNegotiatedProtocol
Add a protocol that can be negotiated (e.g. ALPN).- Parameters:
negotiableProtocol- The protocol to add
-
hasNegotiableProtocols
public boolean hasNegotiableProtocols()Check if there are any negotiable protocols configured.- Returns:
- True if there are negotiable protocols
-
setHandler
Set the handler for this endpoint.- Parameters:
handler- The handler to set
-
getHandler
-
setAttribute
Generic property setter called when a property for which a specific setter already exists within theProtocolHandlerneeds to be made available to subcomponents. The specific setter will call this method to populate the attributes.- Parameters:
name- Name of property to setvalue- The value to set the property to
-
getAttribute
-
setProperty
-
getProperty
-
getCurrentThreadCount
public int getCurrentThreadCount()Return the amount of threads that are managed by the pool.- Returns:
- the amount of threads that are managed by the pool
-
getCurrentThreadsBusy
public int getCurrentThreadsBusy()Return the amount of threads that are in use- Returns:
- the amount of threads that are in use
-
isRunning
public boolean isRunning()Check if the endpoint is running.- Returns:
- True if the endpoint is running
-
isPaused
public boolean isPaused()Check if the endpoint is paused.- Returns:
- True if the endpoint is paused
-
createExecutor
public void createExecutor()Create the internal executor. -
shutdownExecutor
public void shutdownExecutor()Shutdown the internal executor. -
unlockAccept
protected void unlockAccept()Unlock the server socket acceptor threads using bogus connections. -
processSocket
public boolean processSocket(SocketWrapperBase<S> socketWrapper, SocketEvent event, boolean dispatch) Process the given SocketWrapper with the given status. Used to trigger processing as if the Poller (for those endpoints that have one) selected the socket.- Parameters:
socketWrapper- The socket wrapper to processevent- The socket event to be processeddispatch- Should the processing be performed on a new container thread- Returns:
- if processing was triggered successfully
-
createSocketProcessor
protected abstract SocketProcessorBase<S> createSocketProcessor(SocketWrapperBase<S> socketWrapper, SocketEvent event) Create a socket processor for the given socket wrapper.- Parameters:
socketWrapper- The socket wrapper to processevent- The socket event- Returns:
- The socket processor
-
bind
-
unbind
-
startInternal
-
stopInternal
-
init
-
start
-
startAcceptorThread
protected void startAcceptorThread()Start the acceptor thread. -
pause
public void pause()Pause the endpoint, which will stop it accepting new connections and unlock the acceptor. -
resume
public void resume()Resume the endpoint, which will make it start accepting new connections again. -
stop
-
destroy
-
getLog
-
getLogCertificate
-
initializeConnectionLatch
Initialize the connection latch if it has not already been created.- Returns:
- The connection latch, or null if connection counting is disabled
-
countUpOrAwaitConnection
Count up or await a connection slot.- Throws:
InterruptedException- If thrown during thread interruption
-
countDownConnection
protected long countDownConnection()Count down a connection.- Returns:
- The number of connections remaining, or -1 if connection counting is disabled
-
closeServerSocketGraceful
-
awaitConnectionsClose
public final long awaitConnectionsClose(long waitMillis) Wait for the client connections to the server to close gracefully. The method will return when all of the client connections have closed or the method has been waiting forwaitTimeMillis.- Parameters:
waitMillis- The maximum time to wait in milliseconds for the client connections to close.- Returns:
- The wait time, if any remaining when the method returned
-
doCloseServerSocket
Actually close the server socket but don't perform any other clean-up.- Throws:
IOException- If an error occurs closing the socket
-
serverSocketAccept
-
setSocketOptions
Set the socket options for the given accepted socket.- Parameters:
socket- The accepted socket- Returns:
- True if the socket options were set successfully
-
closeSocket
Close the socket when the connection has to be immediately closed when an error occurs while configuring the accepted socket or trying to dispatch it for processing. The wrapper associated with the socket will be used for the close.- Parameters:
socket- The newly accepted socket
-
destroySocket
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.- Parameters:
socket- The newly accepted socket
-