Top Inners Fields Constructors Methods
org.apache.coyote

public abstract Class AbstractProtocol<S>

extends Object
implements ProtocolHandler, MBeanRegistration
Class Inheritance
All Implemented Interfaces
javax.management.MBeanRegistration, org.apache.coyote.ProtocolHandler
Known Direct Subclasses
org.apache.coyote.ajp.AbstractAjpProtocol, org.apache.coyote.http11.AbstractHttp11Protocol
Imports
java.io.IOException, java.net.InetAddress, .SocketException, java.nio.ByteBuffer, java.util.Set, java.util.concurrent.ConcurrentHashMap, .ExecutionException, .Executor, .ScheduledExecutorService, .ScheduledFuture, .TimeUnit, java.util.concurrent.atomic.AtomicInteger, .AtomicLong, javax.management.InstanceNotFoundException, .MBeanRegistration, .MBeanRegistrationException, .MBeanServer, .MalformedObjectNameException, .ObjectName, jakarta.servlet.http.HttpUpgradeHandler, .WebConnection, org.apache.coyote.http11.upgrade.InternalHttpUpgradeHandler, org.apache.juli.logging.Log, org.apache.tomcat.InstanceManager, org.apache.tomcat.util.ExceptionUtils, org.apache.tomcat.util.collections.SynchronizedStack, org.apache.tomcat.util.modeler.Registry, org.apache.tomcat.util.net.AbstractEndpoint, .AbstractEndpoint.Handler, .SocketEvent, .SocketWrapperBase, org.apache.tomcat.util.res.StringManager

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
protected static class

Field Summary

Modifier and TypeField and Description
protected Adapter
adapter

The adapter provides the link between the ProtocolHandler and the connector.

private String
protected String
private final AbstractEndpoint<S, ?>
endpoint

Endpoint that provides low-level network I/O - must be matched to the ProtocolHandler implementation (ProtocolHandler using NIO, requires NIO Endpoint etc.).

private AbstractEndpoint.Handler<S>
private int
private ScheduledFuture<?>
protected MBeanServer
private static final AtomicInteger
nameCounter

Counter used to generate unique JMX names for connectors using automatic port binding.

private int
nameIndex

Unique ID for this connector.

protected ObjectName
protected int
processorCache

The maximum number of idle processors that will be retained in the cache and re-used with a subsequent request.

protected ObjectName
rgOname

Name of MBean for the Global Request Processor.

private static final StringManager
sm

The string manager for this package.

private ScheduledFuture<?>
timeoutFuture

Controller for the timeout scheduling.

private final Set<Processor>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public long
awaitConnectionsClose(long
The maximum time to wait in milliseconds for the client connections to close.
waitMillis
)

Implements org.apache.coyote.ProtocolHandler.awaitConnectionsClose.

Wait for the client connections to the server to close gracefully.

public void
closeServerSocketGraceful()

Implements org.apache.coyote.ProtocolHandler.closeServerSocketGraceful.

Close the server socket (to prevent further connections) if the server socket was bound on start() (rather than on init() but do not perform any further shutdown.

private ObjectName
protected abstract Processor

Returns:

A fully configured Processor instance that is ready to use
createProcessor
()

Create and configure a new Processor instance for the current protocol implementation.

protected abstract Processor
public void
destroy()

Implements org.apache.coyote.ProtocolHandler.destroy.

Destroy the protocol (optional).

public int
public int
public Adapter
getAdapter()

Implements org.apache.coyote.ProtocolHandler.getAdapter.

Return the adapter associated with the protocol handler.

public InetAddress
public String

Returns:

The name of the JSSE provider to use
getClientCertProvider
()

When client certificate information is presented in a form other than instances of java.security.cert.X509Certificate it needs to be converted before it can be used and this property controls which JSSE provider is used to perform the conversion.

public long
public int
public int
public String
protected AbstractEndpoint<S, ?>
public Executor
getExecutor()

Implements org.apache.coyote.ProtocolHandler.getExecutor.

The executor, provide access to the underlying thread pool.

public ObjectName
protected AbstractEndpoint.Handler<S>
public String
getId()

Overrides default org.apache.coyote.ProtocolHandler.getId.

The default behavior is to identify connectors uniquely with address and port.

public int

Returns:

The timeout in milliseconds
getKeepAliveTimeout
()

The time Tomcat will wait for a subsequent request before closing the connection.

public int
protected abstract Log

Returns:

the logger
getLog
()

Concrete implementations need to provide access to their logger to be used by the abstract classes.

public int
public int
public int
public int
public String

Returns:

A name for this protocol instance that is appropriately quoted for use in an ObjectName.
getName
()

The name will be prefix-address-port if address is non-null and prefix-port if the address is null.

public synchronized int
private String
protected abstract String

Returns:

the prefix
getNamePrefix
()

Obtain the prefix to be used when construction a name for this protocol handler.

protected abstract UpgradeProtocol

Returns:

The instance where UpgradeProtocol#getAlpnName() matches the requested protocol
getNegotiatedProtocol
(String
The name of the requested negotiated protocol.
name
)

Find a suitable handler for the protocol negotiated at the network layer.

public ObjectName
public int
public int
public int
public int
public String

Returns:

The value of the property converted to a string
getProperty
(String
The name of the property to get
name
)

Generic property getter used by the digester.

protected abstract String

Returns:

the protocol name
getProtocolName
()

Obtain the name of the protocol, (Http, Ajp, etc.).

public boolean
public int
protected abstract UpgradeProtocol

Returns:

The instance where UpgradeProtocol#getAlpnName() matches the requested protocol
getUpgradeProtocol
(String
The name of the requested negotiated protocol.
name
)

Find a suitable handler for the protocol upgraded name specified.

public ScheduledExecutorService
getUtilityExecutor()

Implements org.apache.coyote.ProtocolHandler.getUtilityExecutor.

Get the utility executor that should be used by the protocol handler.

public int
public void
init()

Implements org.apache.coyote.ProtocolHandler.init.

Initialise the protocol.

public boolean
public boolean
isSendfileSupported()

Implements org.apache.coyote.ProtocolHandler.isSendfileSupported.

Does this ProtocolHandler support sendfile?

private void
public void
pause()

Implements org.apache.coyote.ProtocolHandler.pause.

Pause the protocol (optional).

public void
postDeregister()

Implements javax.management.MBeanRegistration.postDeregister.

Allows the MBean to perform any operations needed after having been unregistered in the MBean server.

public void
postRegister(Boolean
Indicates whether or not the MBean has been successfully registered in the MBean server. The value false means that the registration phase has failed.
registrationDone
)

Implements javax.management.MBeanRegistration.postRegister.

Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

public void
preDeregister()

Implements javax.management.MBeanRegistration.preDeregister.

Allows the MBean to perform any operations it needs before being unregistered by the MBean server.

public ObjectName
preRegister(MBeanServer
The MBean Server in which the MBean will be registered.
server
,
ObjectName
The object name of the MBean. This name is null if the name parameter to one of the createMBean or registerMBean methods in the MBeanServer interface is null. In that case, this method must return a non-null ObjectName for the new MBean.
name
)

Implements javax.management.MBeanRegistration.preRegister.

Allows the MBean to perform any operations it needs before being registered in the MBean Server.

public void
public void
resume()

Implements org.apache.coyote.ProtocolHandler.resume.

Resume the protocol (optional).

public void
setAcceptCount(int acceptCount)

public void
setAcceptorThreadPriority(int threadPriority)

public void
setAdapter(Adapter
The adapter to associate
adapter
)

Implements org.apache.coyote.ProtocolHandler.setAdapter.

The adapter, used to call the connector.

public void
public void
public void
setConnectionLinger(int connectionLinger)

public void
setConnectionTimeout(int timeout)

public void
setExecutor(Executor
the executor
executor
)

Implements org.apache.coyote.ProtocolHandler.setExecutor.

Set the optional executor that will be used by the connector.

protected void
public void
setKeepAliveTimeout(int keepAliveTimeout)

public void
setMaxConnections(int maxConnections)

public void
setMaxHeaderCount(int maxHeaderCount)

public void
setMaxThreads(int maxThreads)

public void
setMinSpareThreads(int minSpareThreads)

public void
setPort(int port)

public void
setPortOffset(int portOffset)

public void
setProcessorCache(int processorCache)

public boolean

Returns:

true if the property was set successfully, otherwise false
setProperty
(String
The name of the property to set
name
,
String
The value, in string form, to set for the property
value
)

Generic property setter used by the digester.

public void
setTcpNoDelay(boolean tcpNoDelay)

public void
setThreadPriority(int threadPriority)

public void
setUtilityExecutor(ScheduledExecutorService
the executor
utilityExecutor
)

Implements org.apache.coyote.ProtocolHandler.setUtilityExecutor.

Set the utility executor that should be used by the protocol handler.

public void
start()

Implements org.apache.coyote.ProtocolHandler.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.

public void
stop()

Implements org.apache.coyote.ProtocolHandler.stop.

Stop the protocol.

protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait