public abstract class AbstractProtocol<S> extends java.lang.Object implements ProtocolHandler, javax.management.MBeanRegistration
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractProtocol.ConnectionHandler<S> |
protected static class |
AbstractProtocol.RecycledProcessors |
| Modifier and Type | Field and Description |
|---|---|
protected Adapter |
adapter
The adapter provides the link between the ProtocolHandler and the connector.
|
protected java.lang.String |
domain |
protected javax.management.MBeanServer |
mserver |
protected javax.management.ObjectName |
oname |
protected int |
processorCache
The maximum number of idle processors that will be retained in the cache and re-used with a subsequent request.
|
protected javax.management.ObjectName |
rgOname
Name of MBean for the Global Request Processor.
|
| Constructor and Description |
|---|
AbstractProtocol(AbstractEndpoint<S,?> endpoint) |
| Modifier and Type | Method and Description |
|---|---|
void |
addWaitingProcessor(Processor processor) |
long |
awaitConnectionsClose(long waitMillis)
Wait for the client connections to the server to close gracefully.
|
void |
closeServerSocketGraceful()
Close the server socket (to prevent further connections) if the server socket was bound on
ProtocolHandler.start()
(rather than on ProtocolHandler.init() but do not perform any further shutdown. |
protected abstract Processor |
createProcessor()
Create and configure a new Processor instance for the current protocol implementation.
|
protected abstract Processor |
createUpgradeProcessor(SocketWrapperBase<?> socket,
UpgradeToken upgradeToken) |
void |
destroy()
Destroy the protocol (optional).
|
int |
getAcceptCount() |
int |
getAcceptorThreadCount()
Deprecated.
Will be removed in Tomcat 10.
|
int |
getAcceptorThreadPriority() |
Adapter |
getAdapter()
Return the adapter associated with the protocol handler.
|
java.net.InetAddress |
getAddress() |
java.lang.String |
getClientCertProvider()
When client certificate information is presented in a form other than instances of
X509Certificate it needs to be converted before it can be used and this property
controls which JSSE provider is used to perform the conversion. |
long |
getConnectionCount() |
int |
getConnectionLinger() |
int |
getConnectionTimeout() |
java.lang.String |
getDomain() |
protected AbstractEndpoint<S,?> |
getEndpoint() |
java.util.concurrent.Executor |
getExecutor()
The executor, provide access to the underlying thread pool.
|
javax.management.ObjectName |
getGlobalRequestProcessorMBeanName() |
protected AbstractEndpoint.Handler<S> |
getHandler() |
java.lang.String |
getId()
The default behavior is to identify connectors uniquely with address and port.
|
int |
getKeepAliveTimeout()
The time Tomcat will wait for a subsequent request before closing the connection.
|
int |
getLocalPort() |
protected abstract Log |
getLog()
Concrete implementations need to provide access to their logger to be used by the abstract classes.
|
int |
getMaxConnections() |
int |
getMaxHeaderCount() |
int |
getMaxThreads() |
int |
getMinSpareThreads() |
java.lang.String |
getName()
The name will be prefix-address-port if address is non-null and prefix-port if the address is null.
|
int |
getNameIndex() |
protected abstract java.lang.String |
getNamePrefix()
Obtain the prefix to be used when construction a name for this protocol handler.
|
protected abstract UpgradeProtocol |
getNegotiatedProtocol(java.lang.String name)
Find a suitable handler for the protocol negotiated at the network layer.
|
javax.management.ObjectName |
getObjectName() |
int |
getPort() |
int |
getPortOffset() |
int |
getPortWithOffset() |
int |
getProcessorCache() |
java.lang.String |
getProperty(java.lang.String name)
Generic property getter used by the digester.
|
protected abstract java.lang.String |
getProtocolName()
Obtain the name of the protocol, (Http, Ajp, etc.).
|
boolean |
getTcpNoDelay() |
int |
getThreadPriority() |
protected abstract UpgradeProtocol |
getUpgradeProtocol(java.lang.String name)
Find a suitable handler for the protocol upgraded name specified.
|
java.util.concurrent.ScheduledExecutorService |
getUtilityExecutor()
Get the utility executor that should be used by the protocol handler.
|
int |
getWaitingProcessorCount() |
void |
init()
Initialise the protocol.
|
boolean |
isAprRequired()
Requires APR/native library
|
boolean |
isPaused() |
boolean |
isSendfileSupported()
Does this ProtocolHandler support sendfile?
|
void |
pause()
Pause the protocol (optional).
|
void |
postDeregister() |
void |
postRegister(java.lang.Boolean registrationDone) |
void |
preDeregister() |
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name) |
void |
removeWaitingProcessor(Processor processor) |
void |
resume()
Resume the protocol (optional).
|
void |
setAcceptCount(int acceptCount) |
void |
setAcceptorThreadCount(int threadCount)
Deprecated.
Will be removed in Tomcat 10.
|
void |
setAcceptorThreadPriority(int threadPriority) |
void |
setAdapter(Adapter adapter)
The adapter, used to call the connector.
|
void |
setAddress(java.net.InetAddress ia) |
void |
setClientCertProvider(java.lang.String s) |
void |
setConnectionLinger(int connectionLinger) |
void |
setConnectionTimeout(int timeout) |
void |
setExecutor(java.util.concurrent.Executor executor)
Set the optional executor that will be used by the connector.
|
protected void |
setHandler(AbstractEndpoint.Handler<S> handler) |
void |
setKeepAliveTimeout(int keepAliveTimeout) |
void |
setMaxConnections(int maxConnections) |
void |
setMaxHeaderCount(int maxHeaderCount) |
void |
setMaxThreads(int maxThreads) |
void |
setMinSpareThreads(int minSpareThreads) |
void |
setPort(int port) |
void |
setPortOffset(int portOffset) |
void |
setProcessorCache(int processorCache) |
boolean |
setProperty(java.lang.String name,
java.lang.String value)
Generic property setter used by the digester.
|
void |
setTcpNoDelay(boolean tcpNoDelay) |
void |
setThreadPriority(int threadPriority) |
void |
setUtilityExecutor(java.util.concurrent.ScheduledExecutorService utilityExecutor)
Set the utility executor that should be used by the protocol handler.
|
void |
start()
Start the protocol.
|
protected void |
startAsyncTimeout()
Note: The name of this method originated with the Servlet 3.0 asynchronous processing but evolved over time to
represent a timeout that is triggered independently of the socket read/write timeouts.
|
void |
stop()
Stop the protocol.
|
protected void |
stopAsyncTimeout() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddSslHostConfig, addSslHostConfig, addUpgradeProtocol, create, findSslHostConfigs, findUpgradeProtocols, getDesiredBufferSizeprotected javax.management.ObjectName rgOname
protected Adapter adapter
protected int processorCache
getMaxConnections() although it will usually be closer to
getMaxThreads().protected java.lang.String domain
protected javax.management.ObjectName oname
protected javax.management.MBeanServer mserver
public AbstractProtocol(AbstractEndpoint<S,?> endpoint)
public boolean setProperty(java.lang.String name,
java.lang.String value)
name - The name of the property to setvalue - The value, in string form, to set for the propertytrue if the property was set successfully, otherwise falsepublic java.lang.String getProperty(java.lang.String name)
name - The name of the property to getpublic javax.management.ObjectName getGlobalRequestProcessorMBeanName()
public void setAdapter(Adapter adapter)
ProtocolHandlersetAdapter in interface ProtocolHandleradapter - The adapter to associatepublic Adapter getAdapter()
ProtocolHandlergetAdapter in interface ProtocolHandlerpublic int getProcessorCache()
public void setProcessorCache(int processorCache)
public java.lang.String getClientCertProvider()
X509Certificate it needs to be converted before it can be used and this property
controls which JSSE provider is used to perform the conversion. For example it is used with the AJP connectors,
the HTTP APR connector and with the SSLValve. If not specified, the default
provider will be used.public void setClientCertProvider(java.lang.String s)
public int getMaxHeaderCount()
public void setMaxHeaderCount(int maxHeaderCount)
public boolean isAprRequired()
ProtocolHandlerisAprRequired in interface ProtocolHandlertrue if this Protocol Handler requires the APR/native library, otherwise falsepublic boolean isSendfileSupported()
ProtocolHandlerisSendfileSupported in interface ProtocolHandlertrue if this Protocol Handler supports sendfile, otherwise falsepublic java.lang.String getId()
ProtocolHandlergetId in interface ProtocolHandlerpublic java.util.concurrent.Executor getExecutor()
ProtocolHandlergetExecutor in interface ProtocolHandlerpublic void setExecutor(java.util.concurrent.Executor executor)
ProtocolHandlersetExecutor in interface ProtocolHandlerexecutor - the executorpublic java.util.concurrent.ScheduledExecutorService getUtilityExecutor()
ProtocolHandlergetUtilityExecutor in interface ProtocolHandlerpublic void setUtilityExecutor(java.util.concurrent.ScheduledExecutorService utilityExecutor)
ProtocolHandlersetUtilityExecutor in interface ProtocolHandlerutilityExecutor - the executorpublic int getMaxThreads()
public void setMaxThreads(int maxThreads)
public int getMaxConnections()
public void setMaxConnections(int maxConnections)
public int getMinSpareThreads()
public void setMinSpareThreads(int minSpareThreads)
public int getThreadPriority()
public void setThreadPriority(int threadPriority)
public int getAcceptCount()
public void setAcceptCount(int acceptCount)
public boolean getTcpNoDelay()
public void setTcpNoDelay(boolean tcpNoDelay)
public int getConnectionLinger()
public void setConnectionLinger(int connectionLinger)
public int getKeepAliveTimeout()
getConnectionTimeout().public void setKeepAliveTimeout(int keepAliveTimeout)
public java.net.InetAddress getAddress()
public void setAddress(java.net.InetAddress ia)
public int getPort()
public void setPort(int port)
public int getPortOffset()
public void setPortOffset(int portOffset)
public int getPortWithOffset()
public int getLocalPort()
public int getConnectionTimeout()
public void setConnectionTimeout(int timeout)
public long getConnectionCount()
@Deprecated public void setAcceptorThreadCount(int threadCount)
threadCount - Unused@Deprecated public int getAcceptorThreadCount()
public void setAcceptorThreadPriority(int threadPriority)
public int getAcceptorThreadPriority()
public int getNameIndex()
public java.lang.String getName()
public void addWaitingProcessor(Processor processor)
public void removeWaitingProcessor(Processor processor)
public int getWaitingProcessorCount()
protected AbstractEndpoint<S,?> getEndpoint()
protected AbstractEndpoint.Handler<S> getHandler()
protected void setHandler(AbstractEndpoint.Handler<S> handler)
protected abstract Log getLog()
protected abstract java.lang.String getNamePrefix()
protected abstract java.lang.String getProtocolName()
protected abstract UpgradeProtocol getNegotiatedProtocol(java.lang.String name)
name - The name of the requested negotiated protocol.UpgradeProtocol.getAlpnName() matches the requested protocolprotected abstract UpgradeProtocol getUpgradeProtocol(java.lang.String name)
name - The name of the requested negotiated protocol.UpgradeProtocol.getAlpnName() matches the requested protocolprotected abstract Processor createProcessor()
protected abstract Processor createUpgradeProcessor(SocketWrapperBase<?> socket, UpgradeToken upgradeToken)
public javax.management.ObjectName getObjectName()
public java.lang.String getDomain()
public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
throws java.lang.Exception
preRegister in interface javax.management.MBeanRegistrationjava.lang.Exceptionpublic void postRegister(java.lang.Boolean registrationDone)
postRegister in interface javax.management.MBeanRegistrationpublic void preDeregister()
throws java.lang.Exception
preDeregister in interface javax.management.MBeanRegistrationjava.lang.Exceptionpublic void postDeregister()
postDeregister in interface javax.management.MBeanRegistrationpublic void init()
throws java.lang.Exception
ProtocolHandlerinit in interface ProtocolHandlerjava.lang.Exception - If the protocol handler fails to initialisepublic void start()
throws java.lang.Exception
ProtocolHandlerstart in interface ProtocolHandlerjava.lang.Exception - If the protocol handler fails to startprotected void startAsyncTimeout()
protected void stopAsyncTimeout()
public void pause()
throws java.lang.Exception
ProtocolHandlerpause in interface ProtocolHandlerjava.lang.Exception - If the protocol handler fails to pausepublic boolean isPaused()
public void resume()
throws java.lang.Exception
ProtocolHandlerresume in interface ProtocolHandlerjava.lang.Exception - If the protocol handler fails to resumepublic void stop()
throws java.lang.Exception
ProtocolHandlerstop in interface ProtocolHandlerjava.lang.Exception - If the protocol handler fails to stoppublic void destroy()
throws java.lang.Exception
ProtocolHandlerdestroy in interface ProtocolHandlerjava.lang.Exception - If the protocol handler fails to destroypublic void closeServerSocketGraceful()
ProtocolHandlerProtocolHandler.start()
(rather than on ProtocolHandler.init() but do not perform any further shutdown.closeServerSocketGraceful in interface ProtocolHandlerpublic long awaitConnectionsClose(long waitMillis)
ProtocolHandlerwaitTimeMillis.awaitConnectionsClose in interface ProtocolHandlerwaitMillis - The maximum time to wait in milliseconds for the client connections to close.Copyright © 2000-2024 Apache Software Foundation.
Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo are either registered trademarks or trademarks of the Apache Software Foundation.