public abstract class AbstractEndpoint<S>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
AbstractEndpoint.Acceptor |
protected static class |
AbstractEndpoint.BindState |
static interface |
AbstractEndpoint.Handler |
Modifier and Type | Field and Description |
---|---|
protected AbstractEndpoint.Acceptor[] |
acceptors
Threads used to accept new connections and pass them to worker threads.
|
protected int |
acceptorThreadCount
Acceptor thread count.
|
protected int |
acceptorThreadPriority
Priority of the acceptor threads.
|
protected java.util.HashMap<java.lang.String,java.lang.Object> |
attributes
Attributes provide a way for configuration to be passed to sub-components
without the
ProtocolHandler being aware of the
properties available on those sub-components. |
protected boolean |
internalExecutor
Are we using an internal executor
|
protected boolean |
paused
Will be set to true whenever the endpoint is paused.
|
protected boolean |
running
Running state of the endpoint.
|
protected static StringManager |
sm |
protected SocketProperties |
socketProperties
Socket properties
|
protected int |
threadPriority
Priority of the worker threads.
|
Constructor and Description |
---|
AbstractEndpoint() |
Modifier and Type | Method and Description |
---|---|
abstract void |
bind() |
protected void |
configureUseServerCipherSuitesOrder(javax.net.ssl.SSLEngine engine)
Configures SSLEngine to honor cipher suites ordering based upon
endpoint configuration.
|
protected long |
countDownConnection() |
protected void |
countUpOrAwaitConnection() |
protected abstract AbstractEndpoint.Acceptor |
createAcceptor()
Hook to allow Endpoints to provide a specific Acceptor implementation.
|
void |
createExecutor() |
void |
destroy() |
int |
getAcceptorThreadCount() |
int |
getAcceptorThreadPriority() |
java.net.InetAddress |
getAddress() |
java.lang.String |
getAlgorithm() |
java.lang.String |
getAllowUnsafeLegacyRenegotiation() |
java.lang.Object |
getAttribute(java.lang.String key)
Used by sub-components to retrieve configuration information.
|
int |
getBacklog() |
boolean |
getBindOnInit() |
java.lang.String |
getCiphers() |
java.lang.String |
getClientAuth() |
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
-1 if they are not. |
java.lang.String |
getCrlFile() |
int |
getCurrentThreadCount()
Return the amount of threads that are managed by the pool.
|
int |
getCurrentThreadsBusy()
Return the amount of threads that are in use
|
boolean |
getDaemon() |
protected abstract boolean |
getDeferAccept() |
java.util.concurrent.Executor |
getExecutor() |
long |
getExecutorTerminationTimeoutMillis() |
int |
getKeepAliveTimeout() |
java.lang.String |
getKeyAlias() |
java.lang.String |
getKeyPass() |
java.lang.String |
getKeystoreFile() |
java.lang.String |
getKeystorePass() |
java.lang.String |
getKeystoreProvider() |
java.lang.String |
getKeystoreType() |
abstract int |
getLocalPort() |
protected abstract Log |
getLog() |
int |
getMaxConnections() |
int |
getMaxHeaderCount() |
int |
getMaxKeepAliveRequests() |
int |
getMaxThreads() |
protected int |
getMaxThreadsExecutor(boolean useExecutor) |
int |
getMinSpareThreads() |
java.lang.String |
getName() |
int |
getPort() |
java.lang.String |
getProperty(java.lang.String name) |
java.lang.String |
getSessionCacheSize() |
java.lang.String |
getSessionTimeout() |
SocketProperties |
getSocketProperties() |
int |
getSoLinger()
Socket linger.
|
int |
getSoTimeout()
Socket timeout.
|
java.lang.String[] |
getSslEnabledProtocolsArray() |
java.lang.String |
getSslProtocol() |
boolean |
getTcpNoDelay()
Socket TCP no delay.
|
int |
getThreadPriority() |
java.lang.String |
getTrustManagerClassName() |
java.lang.String |
getTrustMaxCertLength() |
java.lang.String |
getTruststoreAlgorithm() |
java.lang.String |
getTruststoreFile() |
java.lang.String |
getTruststorePass() |
java.lang.String |
getTruststoreProvider() |
java.lang.String |
getTruststoreType() |
abstract boolean |
getUseComet() |
abstract boolean |
getUseCometTimeout() |
abstract boolean |
getUsePolling() |
abstract boolean |
getUseSendfile() |
java.lang.String |
getUseServerCipherSuitesOrder() |
protected int |
handleExceptionWithDelay(int currentErrorDelay)
Provides a common approach for sub-classes to handle exceptions where a
delay is required to prevent a Thread from entering a tight loop which
will consume CPU and may also trigger large amounts of logging.
|
void |
init() |
protected LimitLatch |
initializeConnectionLatch() |
boolean |
isPaused() |
boolean |
isRunning() |
boolean |
isSSLEnabled() |
void |
pause()
Pause the endpoint, which will stop it accepting new connections.
|
abstract void |
processSocketAsync(SocketWrapper<S> socketWrapper,
SocketStatus socketStatus) |
protected void |
releaseConnectionLatch() |
abstract void |
removeWaitingRequest(SocketWrapper<S> socketWrapper) |
void |
resume()
Resume the endpoint, which will make it start accepting new connections
again.
|
void |
setAcceptorThreadCount(int acceptorThreadCount) |
void |
setAcceptorThreadPriority(int acceptorThreadPriority) |
void |
setAddress(java.net.InetAddress address) |
void |
setAlgorithm(java.lang.String s) |
void |
setAllowUnsafeLegacyRenegotiation(java.lang.String s) |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Generic property setter called when a property for which a specific
setter already exists within the
ProtocolHandler needs to be made available to
sub-components. |
void |
setBacklog(int backlog) |
void |
setBindOnInit(boolean b) |
void |
setCiphers(java.lang.String s) |
void |
setClientAuth(java.lang.String s) |
void |
setCrlFile(java.lang.String crlFile) |
void |
setDaemon(boolean b) |
void |
setExecutor(java.util.concurrent.Executor executor) |
void |
setExecutorTerminationTimeoutMillis(long executorTerminationTimeoutMillis) |
void |
setKeepAliveTimeout(int keepAliveTimeout) |
void |
setKeyAlias(java.lang.String s) |
void |
setKeyPass(java.lang.String s) |
void |
setKeystoreFile(java.lang.String s) |
void |
setKeystorePass(java.lang.String s) |
void |
setKeystoreProvider(java.lang.String s) |
void |
setKeystoreType(java.lang.String s) |
void |
setMaxConnections(int maxCon) |
void |
setMaxHeaderCount(int maxHeaderCount) |
void |
setMaxKeepAliveRequests(int maxKeepAliveRequests) |
void |
setMaxThreads(int maxThreads) |
void |
setMinSpareThreads(int minSpareThreads) |
void |
setName(java.lang.String name) |
void |
setPort(int port) |
boolean |
setProperty(java.lang.String name,
java.lang.String value) |
void |
setSessionCacheSize(java.lang.String s) |
void |
setSessionTimeout(java.lang.String s) |
void |
setSoLinger(int soLinger) |
void |
setSoTimeout(int soTimeout) |
void |
setSSLEnabled(boolean SSLEnabled) |
void |
setSslEnabledProtocols(java.lang.String s) |
void |
setSslProtocol(java.lang.String s) |
void |
setTcpNoDelay(boolean tcpNoDelay) |
void |
setThreadPriority(int threadPriority) |
void |
setTrustManagerClassName(java.lang.String trustManagerClassName) |
void |
setTrustMaxCertLength(java.lang.String trustMaxCertLength) |
void |
setTruststoreAlgorithm(java.lang.String truststoreAlgorithm) |
void |
setTruststoreFile(java.lang.String s) |
void |
setTruststorePass(java.lang.String truststorePass) |
void |
setTruststoreProvider(java.lang.String truststoreProvider) |
void |
setTruststoreType(java.lang.String truststoreType) |
void |
setUseServerCipherSuitesOrder(java.lang.String s) |
void |
shutdownExecutor() |
void |
start() |
protected void |
startAcceptorThreads() |
abstract void |
startInternal() |
void |
stop() |
abstract void |
stopInternal() |
abstract void |
unbind() |
protected void |
unlockAccept()
Unlock the server socket accept using a bogus connection.
|
protected static final StringManager sm
protected volatile boolean running
protected volatile boolean paused
protected volatile boolean internalExecutor
protected SocketProperties socketProperties
protected AbstractEndpoint.Acceptor[] acceptors
protected int acceptorThreadCount
protected int acceptorThreadPriority
protected int threadPriority
protected java.util.HashMap<java.lang.String,java.lang.Object> attributes
ProtocolHandler
being aware of the
properties available on those sub-components. One example of such a
sub-component is the
ServerSocketFactory
.public SocketProperties getSocketProperties()
public long getExecutorTerminationTimeoutMillis()
public void setExecutorTerminationTimeoutMillis(long executorTerminationTimeoutMillis)
public void setAcceptorThreadCount(int acceptorThreadCount)
public int getAcceptorThreadCount()
public void setAcceptorThreadPriority(int acceptorThreadPriority)
public int getAcceptorThreadPriority()
public void setMaxConnections(int maxCon)
public int getMaxConnections()
public long getConnectionCount()
-1
if 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.
public void setExecutor(java.util.concurrent.Executor executor)
public java.util.concurrent.Executor getExecutor()
public int getPort()
public void setPort(int port)
public abstract int getLocalPort()
public java.net.InetAddress getAddress()
public void setAddress(java.net.InetAddress address)
public void setBacklog(int backlog)
public int getBacklog()
public boolean getBindOnInit()
public void setBindOnInit(boolean b)
public int getKeepAliveTimeout()
public void setKeepAliveTimeout(int keepAliveTimeout)
public boolean getTcpNoDelay()
public void setTcpNoDelay(boolean tcpNoDelay)
public int getSoLinger()
public void setSoLinger(int soLinger)
public int getSoTimeout()
public void setSoTimeout(int soTimeout)
public boolean isSSLEnabled()
public void setSSLEnabled(boolean SSLEnabled)
public int getMinSpareThreads()
public void setMinSpareThreads(int minSpareThreads)
public void setMaxThreads(int maxThreads)
public int getMaxThreads()
protected int getMaxThreadsExecutor(boolean useExecutor)
public int getMaxKeepAliveRequests()
public void setMaxKeepAliveRequests(int maxKeepAliveRequests)
public int getMaxHeaderCount()
public void setMaxHeaderCount(int maxHeaderCount)
public void setName(java.lang.String name)
public java.lang.String getName()
public void setDaemon(boolean b)
public boolean getDaemon()
public void setThreadPriority(int threadPriority)
public int getThreadPriority()
protected abstract boolean getDeferAccept()
public void setAttribute(java.lang.String name, java.lang.Object value)
ProtocolHandler
needs to be made available to
sub-components. The specific setter will call this method to populate the
attributes.public java.lang.Object getAttribute(java.lang.String key)
public boolean setProperty(java.lang.String name, java.lang.String value)
public java.lang.String getProperty(java.lang.String name)
public int getCurrentThreadCount()
public int getCurrentThreadsBusy()
public boolean isRunning()
public boolean isPaused()
public void createExecutor()
public void shutdownExecutor()
protected void unlockAccept()
public abstract void processSocketAsync(SocketWrapper<S> socketWrapper, SocketStatus socketStatus)
public abstract void removeWaitingRequest(SocketWrapper<S> socketWrapper)
public abstract void bind() throws java.lang.Exception
java.lang.Exception
public abstract void unbind() throws java.lang.Exception
java.lang.Exception
public abstract void startInternal() throws java.lang.Exception
java.lang.Exception
public abstract void stopInternal() throws java.lang.Exception
java.lang.Exception
public final void init() throws java.lang.Exception
java.lang.Exception
public final void start() throws java.lang.Exception
java.lang.Exception
protected final void startAcceptorThreads()
protected abstract AbstractEndpoint.Acceptor createAcceptor()
public void pause()
public void resume()
public final void stop() throws java.lang.Exception
java.lang.Exception
public final void destroy() throws java.lang.Exception
java.lang.Exception
protected abstract Log getLog()
public abstract boolean getUseSendfile()
public abstract boolean getUseComet()
public abstract boolean getUseCometTimeout()
public abstract boolean getUsePolling()
protected LimitLatch initializeConnectionLatch()
protected void releaseConnectionLatch()
protected void countUpOrAwaitConnection() throws java.lang.InterruptedException
java.lang.InterruptedException
protected long countDownConnection()
protected int handleExceptionWithDelay(int currentErrorDelay)
currentErrorDelay
- The current delay being applied on failurepublic java.lang.String getAlgorithm()
public void setAlgorithm(java.lang.String s)
public java.lang.String getClientAuth()
public void setClientAuth(java.lang.String s)
public java.lang.String getKeystoreFile()
public void setKeystoreFile(java.lang.String s)
public java.lang.String getKeystorePass()
public void setKeystorePass(java.lang.String s)
public java.lang.String getKeystoreType()
public void setKeystoreType(java.lang.String s)
public java.lang.String getKeystoreProvider()
public void setKeystoreProvider(java.lang.String s)
public java.lang.String getSslProtocol()
public void setSslProtocol(java.lang.String s)
public java.lang.String getCiphers()
public void setCiphers(java.lang.String s)
public java.lang.String getUseServerCipherSuitesOrder()
public void setUseServerCipherSuitesOrder(java.lang.String s)
public java.lang.String getKeyAlias()
public void setKeyAlias(java.lang.String s)
public java.lang.String getKeyPass()
public void setKeyPass(java.lang.String s)
public java.lang.String getTruststoreFile()
public void setTruststoreFile(java.lang.String s)
public java.lang.String getTruststorePass()
public void setTruststorePass(java.lang.String truststorePass)
public java.lang.String getTruststoreType()
public void setTruststoreType(java.lang.String truststoreType)
public java.lang.String getTruststoreProvider()
public void setTruststoreProvider(java.lang.String truststoreProvider)
public java.lang.String getTruststoreAlgorithm()
public void setTruststoreAlgorithm(java.lang.String truststoreAlgorithm)
public java.lang.String getTrustManagerClassName()
public void setTrustManagerClassName(java.lang.String trustManagerClassName)
public java.lang.String getCrlFile()
public void setCrlFile(java.lang.String crlFile)
public java.lang.String getTrustMaxCertLength()
public void setTrustMaxCertLength(java.lang.String trustMaxCertLength)
public java.lang.String getSessionCacheSize()
public void setSessionCacheSize(java.lang.String s)
public java.lang.String getSessionTimeout()
public void setSessionTimeout(java.lang.String s)
public java.lang.String getAllowUnsafeLegacyRenegotiation()
public void setAllowUnsafeLegacyRenegotiation(java.lang.String s)
public java.lang.String[] getSslEnabledProtocolsArray()
public void setSslEnabledProtocols(java.lang.String s)
protected void configureUseServerCipherSuitesOrder(javax.net.ssl.SSLEngine engine)
InvalidAlgorithmParameterException
- If the runtime JVM doesn't
support this setting.Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.