public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SSLContext.SNICallBack
Modifier and Type | Class and Description |
---|---|
static class |
AprEndpoint.AprSocketWrapper |
class |
AprEndpoint.Poller |
class |
AprEndpoint.Sendfile |
static class |
AprEndpoint.SendfileData
SendfileData class.
|
static class |
AprEndpoint.SocketInfo |
static class |
AprEndpoint.SocketList |
protected class |
AprEndpoint.SocketProcessor
This class is the equivalent of the Worker, but will simply use in an
external Executor thread pool.
|
static class |
AprEndpoint.SocketTimeouts |
protected class |
AprEndpoint.SocketWithOptionsProcessor
This class is the equivalent of the Worker, but will simply use in an
external Executor thread pool.
|
AbstractEndpoint.BindState, AbstractEndpoint.Handler<S>
Modifier and Type | Field and Description |
---|---|
protected boolean |
deferAccept
Defer accept.
|
protected AprEndpoint.Poller |
poller
The socket poller.
|
protected int |
pollTime
Poll interval, in microseconds.
|
protected long |
rootPool
Root APR memory pool.
|
protected AprEndpoint.Sendfile |
sendfile
The static file sender.
|
protected int |
sendfileSize
Size of the sendfile (= concurrent files which can be served).
|
protected long |
serverSock
Server socket "pointer".
|
protected long |
serverSockPool
APR memory pool for the server socket.
|
protected long |
sslContext
SSL context.
|
acceptor, acceptorThreadCount, acceptorThreadPriority, attributes, connections, internalExecutor, negotiableProtocols, paused, processorCache, running, sm, socketProperties, sslHostConfigs, threadPriority
Constructor and Description |
---|
AprEndpoint() |
Modifier and Type | Method and Description |
---|---|
protected long |
allocatePoller(int size,
long pool,
int timeout)
Allocate a new poller of the specified size.
|
void |
bind()
Initialize the endpoint.
|
protected SocketProcessorBase<Long> |
createSocketProcessor(SocketWrapperBase<Long> socketWrapper,
SocketEvent event) |
protected void |
createSSLContext(SSLHostConfig sslHostConfig)
Create the SSLContextfor the the given SSLHostConfig.
|
protected void |
destroySocket(Long socket)
Close the socket.
|
protected void |
doCloseServerSocket()
Actually close the server socket but don't perform any other clean-up.
|
boolean |
getDeferAccept() |
boolean |
getIpv6v6only() |
int |
getKeepAliveCount()
Obtain the number of kept alive sockets.
|
InetSocketAddress |
getLocalAddress()
Obtain the network address the server socket is bound to.
|
protected Log |
getLog() |
AprEndpoint.Poller |
getPoller() |
int |
getPollTime() |
AprEndpoint.Sendfile |
getSendfile() |
int |
getSendfileCount()
Obtain the number of sendfile sockets.
|
int |
getSendfileSize() |
long |
getSslContext(String sniHostName)
This callback is made during the TLS handshake when the client uses
the SNI extension to request a specific TLS host.
|
boolean |
isAlpnSupported()
Identifies if the endpoint supports ALPN.
|
protected boolean |
processSocket(long socket,
SocketEvent event)
Process the given socket.
|
protected Long |
serverSocketAccept() |
void |
setDeferAccept(boolean deferAccept) |
void |
setIpv6v6only(boolean ipv6v6only) |
void |
setMaxConnections(int maxConnections)
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) |
void |
setSendfileSize(int sendfileSize) |
protected boolean |
setSocketOptions(Long socket)
Process given socket.
|
protected boolean |
setSocketOptions(SocketWrapperBase<Long> socketWrapper)
Process the specified connection.
|
void |
setUseSendfile(boolean useSendfile) |
void |
startInternal()
Start the APR endpoint, creating acceptor, poller and sendfile threads.
|
void |
stopInternal()
Stop the endpoint.
|
void |
unbind()
Deallocate APR memory pools, and close server socket.
|
addNegotiatedProtocol, addSslHostConfig, addSslHostConfig, awaitConnectionsClose, closeServerSocketGraceful, closeSocket, countDownConnection, countUpOrAwaitConnection, createExecutor, destroy, destroySsl, findSslHostConfigs, getAcceptCount, getAcceptorThreadCount, getAcceptorThreadPriority, getAddress, getAttribute, getBindOnInit, getConnectionCount, getConnectionLinger, getConnections, getConnectionTimeout, getCurrentThreadCount, getCurrentThreadsBusy, getDaemon, getDefaultSSLHostConfigName, getDomain, getExecutor, getExecutorTerminationTimeoutMillis, getHandler, getKeepAliveTimeout, getLocalPort, getMaxConnections, getMaxKeepAliveRequests, getMaxThreads, getMinSpareThreads, getName, getPort, getPortOffset, getPortWithOffset, getProperty, getSocketProperties, getSSLHostConfig, getTcpNoDelay, getThreadPriority, getUseAsyncIO, getUseSendfile, getUtilityExecutor, hasNegotiableProtocols, init, initializeConnectionLatch, isPaused, isRunning, isSSLEnabled, pause, processSocket, releaseSSLContext, reloadSslHostConfig, reloadSslHostConfigs, removeSslHostConfig, resume, setAcceptCount, setAcceptorThreadCount, setAcceptorThreadPriority, setAddress, setAttribute, setBindOnInit, setConnectionLinger, setConnectionTimeout, setDaemon, setDefaultSSLHostConfigName, setDomain, setExecutor, setExecutorTerminationTimeoutMillis, setHandler, setKeepAliveTimeout, setMaxKeepAliveRequests, setMaxThreads, setMinSpareThreads, setName, setPort, setPortOffset, setProperty, setSSLEnabled, setTcpNoDelay, setThreadPriority, setUseAsyncIO, setUtilityExecutor, shutdownExecutor, start, startAcceptorThread, stop, toTimeout
protected long rootPool
protected volatile long serverSock
protected long serverSockPool
protected long sslContext
protected boolean deferAccept
protected int sendfileSize
protected int pollTime
protected AprEndpoint.Poller poller
protected AprEndpoint.Sendfile sendfile
public void setDeferAccept(boolean deferAccept)
public boolean getDeferAccept()
getDeferAccept
in class AbstractEndpoint<Long,Long>
public void setIpv6v6only(boolean ipv6v6only)
public boolean getIpv6v6only()
public void setSendfileSize(int sendfileSize)
public int getSendfileSize()
public int getPollTime()
public void setPollTime(int pollTime)
public void setUseSendfile(boolean useSendfile)
setUseSendfile
in class AbstractEndpoint<Long,Long>
public AprEndpoint.Poller getPoller()
public AprEndpoint.Sendfile getSendfile()
public InetSocketAddress getLocalAddress() throws IOException
AbstractEndpoint
getLocalAddress
in class AbstractEndpoint<Long,Long>
IOException
- If there is a problem determining the currently bound
socketpublic void setMaxConnections(int maxConnections)
-1
for unlimited connections,
nor does it support setting this attribute while the endpoint is running.
setMaxConnections
in class AbstractEndpoint<Long,Long>
public int getKeepAliveCount()
public int getSendfileCount()
public void bind() throws Exception
bind
in class AbstractEndpoint<Long,Long>
Exception
protected void createSSLContext(SSLHostConfig sslHostConfig) throws Exception
AbstractEndpoint
createSSLContext
in class AbstractEndpoint<Long,Long>
sslHostConfig
- The SSLHostConfig for which the SSLContext should be
createdException
- If the SSLContext cannot be created for the given
SSLHostConfigpublic long getSslContext(String sniHostName)
SSLContext.SNICallBack
getSslContext
in interface SSLContext.SNICallBack
sniHostName
- The host name requested by the clientpublic boolean isAlpnSupported()
AbstractEndpoint
true
implies that AbstractEndpoint.isSSLEnabled()
will also return
true
.isAlpnSupported
in class AbstractEndpoint<Long,Long>
true
if the endpoint supports ALPN in its current
configuration, otherwise false
.public void startInternal() throws Exception
startInternal
in class AbstractEndpoint<Long,Long>
Exception
public void stopInternal()
stopInternal
in class AbstractEndpoint<Long,Long>
public void unbind() throws Exception
unbind
in class AbstractEndpoint<Long,Long>
Exception
protected void doCloseServerSocket()
AbstractEndpoint
doCloseServerSocket
in class AbstractEndpoint<Long,Long>
protected boolean setSocketOptions(SocketWrapperBase<Long> socketWrapper)
socketWrapper
- The socket wrappertrue
if the socket was correctly configured
and processing may continue, false
if the socket needs to be
close immediatelyprotected long allocatePoller(int size, long pool, int timeout)
size
- The sizepool
- The pool from which the poller will be allocatedtimeout
- The timeoutprotected boolean setSocketOptions(Long socket)
setSocketOptions
in class AbstractEndpoint<Long,Long>
socket
- The sockettrue
if the socket was correctly configured
and processing may continue, false
if the socket needs to be
close immediatelyprotected Long serverSocketAccept() throws Exception
serverSocketAccept
in class AbstractEndpoint<Long,Long>
Exception
protected boolean processSocket(long socket, SocketEvent event)
socket
- The socket to processevent
- The event to processtrue
if the processing completed normally otherwise
false
which indicates an error occurred and that the
socket should be closedprotected SocketProcessorBase<Long> createSocketProcessor(SocketWrapperBase<Long> socketWrapper, SocketEvent event)
createSocketProcessor
in class AbstractEndpoint<Long,Long>
protected void destroySocket(Long socket)
AbstractEndpoint
destroySocket
in class AbstractEndpoint<Long,Long>
socket
- The newly accepted socketprotected Log getLog()
getLog
in class AbstractEndpoint<Long,Long>
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.