AprEndpoint (Apache Tomcat 9.0.117 API Documentation)
Description: declaration: package: org.apache.tomcat.util.net, class: AprEndpoint

# Class AprEndpoint

java.lang.Object
org.apache.tomcat.util.net.AbstractEndpoint<Long,Long>
org.apache.tomcat.util.net.AprEndpoint

All Implemented Interfaces:
  `SSLContext.SNICallBack`

@Deprecated public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SSLContext.SNICallBack
Deprecated.
The APR/Native Connector will be removed in Tomcat 9.1.x onwards and has been removed from Tomcat 10.1.x onwards.
APR tailored thread pool, providing the following services:

- Socket acceptor thread
- Socket poller thread
- Sendfile thread
- Worker threads pool

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `AprEndpoint.AprSocketWrapper`
  Deprecated.
  `class`
  `AprEndpoint.Poller`
  Deprecated.
  `class`
  `AprEndpoint.Sendfile`
  Deprecated.
  `static class`
  `AprEndpoint.SendfileData`
  Deprecated.
  SendfileData class.
  `static class`
  `AprEndpoint.SocketInfo`
  Deprecated.
  `static class`
  `AprEndpoint.SocketList`
  Deprecated.
  `protected class`
  `AprEndpoint.SocketProcessor`
  Deprecated.
  This class is the equivalent of the Worker, but will simply use in an external Executor thread pool.
  `static class`
  `AprEndpoint.SocketTimeouts`
  Deprecated.
  `protected class`
  `AprEndpoint.SocketWithOptionsProcessor`
  Deprecated.
  This class is the equivalent of the Worker, but will simply use in an external Executor thread pool.

  ### Nested classes/interfaces inherited from class AbstractEndpoint

  `AbstractEndpoint.BindState, AbstractEndpoint.Handler<S>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected boolean`
  `deferAccept`
  Deprecated.
  Defer accept.
  `protected AprEndpoint.Poller`
  `poller`
  Deprecated.
  The socket poller.
  `protected int`
  `pollTime`
  Deprecated.
  Poll interval, in microseconds.
  `protected long`
  `rootPool`
  Deprecated.
  Root APR memory pool.
  `protected AprEndpoint.Sendfile`
  `sendfile`
  Deprecated.
  The static file sender.
  `protected int`
  `sendfileSize`
  Deprecated.
  Size of the sendfile (= concurrent files which can be served).
  `protected long`
  `serverSock`
  Deprecated.
  Server socket "pointer".
  `protected long`
  `serverSockPool`
  Deprecated.
  APR memory pool for the server socket.
  `protected long`
  `sslContext`
  Deprecated.
  Default SSL context.

  ### Fields inherited from class AbstractEndpoint

  `acceptor, acceptorThreadCount, acceptorThreadPriority, attributes, connections, internalExecutor, negotiableProtocols, paused, processorCache, running, sm, socketProperties, sslHostConfigs, threadPriority`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AprEndpoint()`
  Deprecated.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected long`
  `allocatePoller(int size, long pool, int timeout)`
  Deprecated.
  Allocate a new poller of the specified size.
  `void`
  `bind()`
  Deprecated.
  Initialize the endpoint.
  `protected SocketProcessorBase<Long>`
  `createSocketProcessor(SocketWrapperBase<Long> socketWrapper, SocketEvent event)`
  Deprecated.
  `protected void`
  `createSSLContext(SSLHostConfig sslHostConfig)`
  Deprecated.
  Create the SSLContext for the given SSLHostConfig.
  `protected void`
  `destroySocket(Long socket)`
  Deprecated.
  Close the socket.
  `protected void`
  `doCloseServerSocket()`
  Deprecated.
  Actually close the server socket but don't perform any other clean-up.
  `boolean`
  `getDeferAccept()`
  Deprecated.
  `String`
  `getId()`
  Deprecated.
  The default behavior is to identify connectors uniquely with address and port.
  `boolean`
  `getIpv6v6only()`
  Deprecated.
  `int`
  `getKeepAliveCount()`
  Deprecated.
  Obtain the number of kept alive sockets.
  `InetSocketAddress`
  `getLocalAddress()`
  Deprecated.
  Obtain the network address the server socket is bound to.
  `protected Log`
  `getLog()`
  Deprecated.
  `protected Log`
  `getLogCertificate()`
  Deprecated.
  `AprEndpoint.Poller`
  `getPoller()`
  Deprecated.
  `int`
  `getPollTime()`
  Deprecated.
  `AprEndpoint.Sendfile`
  `getSendfile()`
  Deprecated.
  `int`
  `getSendfileCount()`
  Deprecated.
  Obtain the number of sendfile sockets.
  `int`
  `getSendfileSize()`
  Deprecated.
  `long`
  `getSslContext(String sniHostName)`
  Deprecated.
  This callback is made during the TLS handshake when the client uses the SNI extension to request a specific TLS host.
  `String`
  `getUnixDomainSocketPath()`
  Deprecated.
  `String`
  `getUnixDomainSocketPathPermissions()`
  Deprecated.
  `boolean`
  `isAlpnSupported()`
  Deprecated.
  Identifies if the endpoint supports ALPN.
  `protected boolean`
  `processSocket(long socket, SocketEvent event)`
  Deprecated.
  Process the given socket.
  `protected Long`
  `serverSocketAccept()`
  Deprecated.
  `protected void`
  `setDefaultSslHostConfig(SSLHostConfig sslHostConfig)`
  Deprecated.
  `void`
  `setDeferAccept(boolean deferAccept)`
  Deprecated.
  `void`
  `setIpv6v6only(boolean ipv6v6only)`
  Deprecated.
  `void`
  `setMaxConnections(int maxConnections)`
  Deprecated.
  This endpoint does not support `-1` for unlimited connections, nor does it support setting this attribute while the endpoint is running.
  `void`
  `setPollTime(int pollTime)`
  Deprecated.
  `void`
  `setSendfileSize(int sendfileSize)`
  Deprecated.
  `protected boolean`
  `setSocketOptions(Long socket)`
  Deprecated.
  Process given socket.
  `protected boolean`
  `setSocketOptions(SocketWrapperBase<Long> socketWrapper)`
  Deprecated.
  Process the specified connection.
  `void`
  `setUnixDomainSocketPath(String unixDomainSocketPath)`
  Deprecated.
  `void`
  `setUnixDomainSocketPathPermissions(String unixDomainSocketPathPermissions)`
  Deprecated.
  `void`
  `setUseSendfile(boolean useSendfile)`
  Deprecated.
  `void`
  `startInternal()`
  Deprecated.
  Start the APR endpoint, creating acceptor, poller and sendfile threads.
  `void`
  `stopInternal()`
  Deprecated.
  Stop the endpoint.
  `void`
  `unbind()`
  Deprecated.
  Deallocate APR memory pools, and close server socket.

  ### Methods inherited from class AbstractEndpoint

  `addNegotiatedProtocol, addSslHostConfig, addSslHostConfig, awaitConnectionsClose, checkSni, 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, getKeepAliveTimeout, getLocalPort, getMaxConnections, getMaxKeepAliveRequests, getMaxQueueSize, getMaxThreads, getMinSpareThreads, getName, getPort, getPortOffset, getPortWithOffset, getProperty, getSocketProperties, getSSLHostConfig, getStrictSni, getTcpNoDelay, getThreadPriority, getThreadsMaxIdleTime, getUseAsyncIO, getUseSendfile, getUseVirtualThreads, getUtilityExecutor, hasNegotiableProtocols, init, initializeConnectionLatch, isPaused, isRunning, isSSLEnabled, logCertificate, pause, processSocket, releaseSSLContext, reloadSslHostConfig, reloadSslHostConfigs, removeSslHostConfig, resume, setAcceptCount, setAcceptorThreadCount, setAcceptorThreadPriority, setAddress, setAttribute, setBindOnInit, setConnectionLinger, setConnectionTimeout, setDaemon, setDefaultSSLHostConfigName, setDomain, setExecutor, setExecutorTerminationTimeoutMillis, setHandler, setKeepAliveTimeout, setMaxKeepAliveRequests, setMaxQueueSize, setMaxThreads, setMinSpareThreads, setName, setPort, setPortOffset, setProperty, setSSLEnabled, setStrictSni, setTcpNoDelay, setThreadPriority, setThreadsMaxIdleTime, setUseAsyncIO, setUseVirtualThreads, setUtilityExecutor, shutdownExecutor, start, startAcceptorThread, stop, toTimeout, unlockAccept`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### rootPool

    protected long rootPool
    Deprecated.
    Root APR memory pool.

  - ### serverSock

    protected volatile long serverSock
    Deprecated.
    Server socket "pointer".

  - ### serverSockPool

    protected long serverSockPool
    Deprecated.
    APR memory pool for the server socket.

  - ### sslContext

    protected volatile long sslContext
    Deprecated.
    Default SSL context. SNI callback may select a different SSL context.

  - ### deferAccept

    protected boolean deferAccept
    Deprecated.
    Defer accept.

  - ### sendfileSize

    protected int sendfileSize
    Deprecated.
    Size of the sendfile (= concurrent files which can be served).

  - ### pollTime

    protected int pollTime
    Deprecated.
    Poll interval, in microseconds. The smaller the value, the more CPU the poller will use, but the more responsive to activity it will be.

  - ### poller

    protected AprEndpoint.Poller poller
    Deprecated.
    The socket poller.

  - ### sendfile

    protected AprEndpoint.Sendfile sendfile
    Deprecated.
    The static file sender.

- ## Constructor Details

  - ### AprEndpoint

    public AprEndpoint()
    Deprecated.

- ## Method Details

  - ### setDeferAccept

    public void setDeferAccept(boolean deferAccept)
    Deprecated.

  - ### getDeferAccept

    public boolean getDeferAccept()
    Deprecated.
    Specified by:
      `getDeferAccept` in class `AbstractEndpoint<Long,Long>`

  - ### setIpv6v6only

    public void setIpv6v6only(boolean ipv6v6only)
    Deprecated.

  - ### getIpv6v6only

    public boolean getIpv6v6only()
    Deprecated.

  - ### setSendfileSize

    public void setSendfileSize(int sendfileSize)
    Deprecated.

  - ### getSendfileSize

    public int getSendfileSize()
    Deprecated.

  - ### getPollTime

    public int getPollTime()
    Deprecated.

  - ### setPollTime

    public void setPollTime(int pollTime)
    Deprecated.

  - ### setUseSendfile

    public void setUseSendfile(boolean useSendfile)
    Deprecated.
    Overrides:
      `setUseSendfile` in class `AbstractEndpoint<Long,Long>`

  - ### getPoller

    public AprEndpoint.Poller getPoller()
    Deprecated.

  - ### getSendfile

    public AprEndpoint.Sendfile getSendfile()
    Deprecated.

  - ### getLocalAddress

    public InetSocketAddress getLocalAddress() throws IOException
    Deprecated.
    Description copied from class: `AbstractEndpoint`
    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.
    Specified by:
      `getLocalAddress` in class `AbstractEndpoint<Long,Long>`
    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

  - ### setMaxConnections

    public void setMaxConnections(int maxConnections)
    Deprecated.
    This endpoint does not support `-1` for unlimited connections, nor does it support setting this attribute while the endpoint is running.
    Overrides:
      `setMaxConnections` in class `AbstractEndpoint<Long,Long>`

  - ### getUnixDomainSocketPath

    public String getUnixDomainSocketPath()
    Deprecated.

  - ### setUnixDomainSocketPath

    public void setUnixDomainSocketPath(String unixDomainSocketPath)
    Deprecated.

  - ### getUnixDomainSocketPathPermissions

    public String getUnixDomainSocketPathPermissions()
    Deprecated.

  - ### setUnixDomainSocketPathPermissions

    public void setUnixDomainSocketPathPermissions(String unixDomainSocketPathPermissions)
    Deprecated.

  - ### getKeepAliveCount

    public int getKeepAliveCount()
    Deprecated.
    Obtain the number of kept alive sockets.
    Returns:
      The number of open sockets currently managed by the Poller

  - ### getSendfileCount

    public int getSendfileCount()
    Deprecated.
    Obtain the number of sendfile sockets.
    Returns:
      The number of sockets currently managed by the Sendfile poller.

  - ### getId

    public String getId()
    Deprecated.
    Description copied from class: `AbstractEndpoint`
    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.
    Overrides:
      `getId` in class `AbstractEndpoint<Long,Long>`
    Returns:
      the id

  - ### bind

    public void bind() throws Exception
    Deprecated.
    Initialize the endpoint.
    Specified by:
      `bind` in class `AbstractEndpoint<Long,Long>`
    Throws:
      `Exception`

  - ### createSSLContext

    protected void createSSLContext(SSLHostConfig sslHostConfig) throws Exception
    Deprecated.
    Description copied from class: `AbstractEndpoint`
    Create the SSLContext for the given SSLHostConfig.
    Specified by:
      `createSSLContext` in class `AbstractEndpoint<Long,Long>`
    Parameters:
      `sslHostConfig` - The SSLHostConfig for which the SSLContext should be created
    Throws:
      `Exception` - If the SSLContext cannot be created for the given SSLHostConfig

  - ### getSslContext

    public long getSslContext(String sniHostName)
    Deprecated.
    Description copied from interface: `SSLContext.SNICallBack`
    This callback is made during the TLS handshake when the client uses the SNI extension to request a specific TLS host.
    Specified by:
      `getSslContext` in interface `SSLContext.SNICallBack`
    Parameters:
      `sniHostName` - The host name requested by the client - must be in lower case
    Returns:
      The Java representation of the pointer to the OpenSSL SSLContext to use for the given host or zero if no SSLContext could be identified

  - ### setDefaultSslHostConfig

    protected void setDefaultSslHostConfig(SSLHostConfig sslHostConfig)
    Deprecated.
    Specified by:
      `setDefaultSslHostConfig` in class `AbstractEndpoint<Long,Long>`

  - ### isAlpnSupported

    public boolean isAlpnSupported()
    Deprecated.
    Description copied from class: `AbstractEndpoint`
    Identifies if the endpoint supports ALPN. Note that a return value of `true` implies that `AbstractEndpoint.isSSLEnabled()` will also return `true`.
    Specified by:
      `isAlpnSupported` in class `AbstractEndpoint<Long,Long>`
    Returns:
      `true` if the endpoint supports ALPN in its current configuration, otherwise `false`.

  - ### startInternal

    public void startInternal() throws Exception
    Deprecated.
    Start the APR endpoint, creating acceptor, poller and sendfile threads.
    Specified by:
      `startInternal` in class `AbstractEndpoint<Long,Long>`
    Throws:
      `Exception`

  - ### stopInternal

    public void stopInternal()
    Deprecated.
    Stop the endpoint. This will cause all processing threads to stop.
    Specified by:
      `stopInternal` in class `AbstractEndpoint<Long,Long>`

  - ### unbind

    public void unbind() throws Exception
    Deprecated.
    Deallocate APR memory pools, and close server socket.
    Specified by:
      `unbind` in class `AbstractEndpoint<Long,Long>`
    Throws:
      `Exception`

  - ### doCloseServerSocket

    protected void doCloseServerSocket()
    Deprecated.
    Description copied from class: `AbstractEndpoint`
    Actually close the server socket but don't perform any other clean-up.
    Specified by:
      `doCloseServerSocket` in class `AbstractEndpoint<Long,Long>`

  - ### setSocketOptions

    protected boolean setSocketOptions(SocketWrapperBase<Long> socketWrapper)
    Deprecated.
    Process the specified connection.
    Parameters:
      `socketWrapper` - The socket wrapper
    Returns:
      `true` if the socket was correctly configured and processing may continue, `false` if the socket needs to be close immediately

  - ### allocatePoller

    protected long allocatePoller(int size, long pool, int timeout)
    Deprecated.
    Allocate a new poller of the specified size.
    Parameters:
      `size` - The size
      `pool` - The pool from which the poller will be allocated
      `timeout` - The timeout
    Returns:
      the poller pointer

  - ### setSocketOptions

    protected boolean setSocketOptions(Long socket)
    Deprecated.
    Process given socket. This is called when the socket has been accepted.
    Specified by:
      `setSocketOptions` in class `AbstractEndpoint<Long,Long>`
    Parameters:
      `socket` - The socket
    Returns:
      `true` if the socket was correctly configured and processing may continue, `false` if the socket needs to be close immediately

  - ### serverSocketAccept

    protected Long serverSocketAccept() throws Exception
    Deprecated.
    Specified by:
      `serverSocketAccept` in class `AbstractEndpoint<Long,Long>`
    Throws:
      `Exception`

  - ### processSocket

    protected boolean processSocket(long socket, SocketEvent event)
    Deprecated.
    Process the given socket. Typically keep alive or upgraded protocol.
    Parameters:
      `socket` - The socket to process
      `event` - The event to process
    Returns:
      `true` if the processing completed normally otherwise `false` which indicates an error occurred and that the socket should be closed

  - ### createSocketProcessor

    protected SocketProcessorBase<Long> createSocketProcessor(SocketWrapperBase<Long> socketWrapper, SocketEvent event)
    Deprecated.
    Specified by:
      `createSocketProcessor` in class `AbstractEndpoint<Long,Long>`

  - ### destroySocket

    protected void destroySocket(Long socket)
    Deprecated.
    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 class `AbstractEndpoint<Long,Long>`
    Parameters:
      `socket` - The newly accepted socket

  - ### getLog

    protected Log getLog()
    Deprecated.
    Specified by:
      `getLog` in class `AbstractEndpoint<Long,Long>`

  - ### getLogCertificate

    protected Log getLogCertificate()
    Deprecated.
    Overrides:
      `getLogCertificate` in class `AbstractEndpoint<Long,Long>`