Apache Tomcat 7.0.28

org.apache.tomcat.util.net
Class AprEndpoint

java.lang.Object
  extended by org.apache.tomcat.util.net.AbstractEndpoint
      extended by org.apache.tomcat.util.net.AprEndpoint

public class AprEndpoint
extends AbstractEndpoint

APR tailored thread pool, providing the following services:

When switching to Java 5, there's an opportunity to use the virtual machine's thread pool.

Author:
Mladen Turk, Remy Maucherat

Nested Class Summary
protected  class AprEndpoint.Acceptor
          The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.
protected  class AprEndpoint.AsyncTimeout
          Async timeout thread
static interface AprEndpoint.Handler
          Bare bones interface used for socket processing.
 class AprEndpoint.Poller
          Poller class.
 class AprEndpoint.Sendfile
          Sendfile class.
static class AprEndpoint.SendfileData
          SendfileData class.
protected  class AprEndpoint.SocketEventProcessor
          This class is the equivalent of the Worker, but will simply use in an external Executor thread pool.
protected  class AprEndpoint.SocketProcessor
          This class is the equivalent of the Worker, but will simply use in an external Executor thread pool.
protected  class AprEndpoint.SocketWithOptionsProcessor
          This class is the equivalent of the Worker, but will simply use in an external Executor thread pool.
 
Nested classes/interfaces inherited from class org.apache.tomcat.util.net.AbstractEndpoint
AbstractEndpoint.BindState
 
Field Summary
protected  int cometPollerRoundRobin
           
protected  AprEndpoint.Poller[] cometPollers
          The socket poller used for Comet support.
protected  boolean deferAccept
          Defer accept.
protected  AprEndpoint.Handler handler
          Handling of accepted sockets.
protected  int pollerRoundRobin
           
protected  AprEndpoint.Poller[] pollers
          The socket poller.
protected  int pollerThreadCount
          Poller thread count.
protected  int pollTime
          Poll interval, in microseconds.
protected  long rootPool
          Root APR memory pool.
protected  int sendfileRoundRobin
           
protected  AprEndpoint.Sendfile[] sendfiles
          The static file sender.
protected  int sendfileSize
          Size of the sendfile (= concurrent files which can be served).
protected  int sendfileThreadCount
          Sendfile thread count.
protected  long serverSock
          Server socket "pointer".
protected  long serverSockPool
          APR memory pool for the server socket.
protected  String SSLCACertificateFile
          SSL CA certificate file.
protected  String SSLCACertificatePath
          SSL CA certificate path.
protected  String SSLCARevocationFile
          SSL CA revocation file.
protected  String SSLCARevocationPath
          SSL CA revocation path.
protected  String SSLCertificateChainFile
          SSL certificate chain file.
protected  String SSLCertificateFile
          SSL certificate file.
protected  String SSLCertificateKeyFile
          SSL certificate key file.
protected  String SSLCipherSuite
          SSL cipher suite.
protected  long sslContext
          SSL context.
protected  boolean SSLInsecureRenegotiation
          SSL allow insecure renegotiation for the the client that does not support the secure renegotiation.
protected  String SSLPassword
          SSL password (if a cert is encrypted, and no password has been provided, a callback will ask for a password).
protected  String SSLProtocol
          SSL protocols.
protected  String SSLVerifyClient
          SSL verify client.
protected  int SSLVerifyDepth
          SSL verify depth.
protected  boolean useComet
          Allow comet request handling.
protected  boolean useSendfile
          Use sendfile for sending static files.
protected  ConcurrentLinkedQueue<SocketWrapper<Long>> waitingRequests
           
 
Fields inherited from class org.apache.tomcat.util.net.AbstractEndpoint
acceptors, acceptorThreadCount, acceptorThreadPriority, attributes, internalExecutor, paused, running, sm, socketProperties, threadPriority
 
Constructor Summary
AprEndpoint()
           
 
Method Summary
protected  long allocatePoller(int size, long pool, int timeout)
          Allocate a new poller of the specified size.
 void bind()
          Initialize the endpoint.
protected  AbstractEndpoint.Acceptor createAcceptor()
          Hook to allow Endpoints to provide a specific Acceptor implementation.
 AprEndpoint.Poller getCometPoller()
           
 boolean getDeferAccept()
           
 AprEndpoint.Handler getHandler()
           
 int getKeepAliveCount()
          Number of keepalive sockets.
 int getLocalPort()
          Port in use.
protected  Log getLog()
           
 AprEndpoint.Poller getPoller()
           
 int getPollerThreadCount()
           
 int getPollTime()
           
 AprEndpoint.Sendfile getSendfile()
           
 int getSendfileCount()
          Number of sendfile sockets.
 int getSendfileSize()
           
 int getSendfileThreadCount()
           
 String getSSLCACertificateFile()
           
 String getSSLCACertificatePath()
           
 String getSSLCARevocationFile()
           
 String getSSLCARevocationPath()
           
 String getSSLCertificateChainFile()
           
 String getSSLCertificateFile()
           
 String getSSLCertificateKeyFile()
           
 String getSSLCipherSuite()
           
 boolean getSSLInsecureRenegotiation()
           
 String getSSLPassword()
           
 String getSSLProtocol()
           
 String getSSLVerifyClient()
           
 int getSSLVerifyDepth()
           
 boolean getUseComet()
           
 boolean getUseCometTimeout()
           
 boolean getUsePolling()
           
 boolean getUseSendfile()
           
protected  boolean processSocket(long socket)
          Process given socket.
protected  boolean processSocket(long socket, SocketStatus status)
          Process given socket for an event.
 boolean processSocketAsync(SocketWrapper<Long> socket, SocketStatus status)
           
protected  boolean processSocketWithOptions(long socket)
          Process given socket.
 void setDeferAccept(boolean deferAccept)
           
 void setHandler(AprEndpoint.Handler handler)
           
 void setPollerThreadCount(int pollerThreadCount)
           
 void setPollTime(int pollTime)
           
 void setSendfileSize(int sendfileSize)
           
 void setSendfileThreadCount(int sendfileThreadCount)
           
protected  boolean setSocketOptions(long socket)
          Process the specified connection.
 void setSSLCACertificateFile(String SSLCACertificateFile)
           
 void setSSLCACertificatePath(String SSLCACertificatePath)
           
 void setSSLCARevocationFile(String SSLCARevocationFile)
           
 void setSSLCARevocationPath(String SSLCARevocationPath)
           
 void setSSLCertificateChainFile(String SSLCertificateChainFile)
           
 void setSSLCertificateFile(String SSLCertificateFile)
           
 void setSSLCertificateKeyFile(String SSLCertificateKeyFile)
           
 void setSSLCipherSuite(String SSLCipherSuite)
           
 void setSSLInsecureRenegotiation(boolean SSLInsecureRenegotiation)
           
 void setSSLPassword(String SSLPassword)
           
 void setSSLProtocol(String SSLProtocol)
           
 void setSSLVerifyClient(String SSLVerifyClient)
           
 void setSSLVerifyDepth(int SSLVerifyDepth)
           
 void setUseComet(boolean useComet)
           
 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.
 
Methods inherited from class org.apache.tomcat.util.net.AbstractEndpoint
adjustRelativePath, countDownConnection, countUpOrAwaitConnection, createExecutor, destroy, getAcceptorThreadCount, getAcceptorThreadPriority, getAddress, getAlgorithm, getAllowUnsafeLegacyRenegotiation, getAttribute, getBacklog, getBindOnInit, getCiphers, getCiphersArray, getClientAuth, getConnectionCount, getCrlFile, getCurrentThreadCount, getCurrentThreadsBusy, getDaemon, getExecutor, getKeepAliveTimeout, getKeyAlias, getKeyPass, getKeystoreFile, getKeystorePass, getKeystoreProvider, getKeystoreType, getMaxConnections, getMaxHeaderCount, getMaxKeepAliveRequests, getMaxThreads, getMaxThreadsExecutor, getMinSpareThreads, getName, getPort, getProperty, getSessionCacheSize, getSessionTimeout, getSocketProperties, getSoLinger, getSoTimeout, getSslEnabledProtocolsArray, getSslProtocol, getTcpNoDelay, getThreadPriority, getTrustManagerClassName, getTrustMaxCertLength, getTruststoreAlgorithm, getTruststoreFile, getTruststorePass, getTruststoreProvider, getTruststoreType, handleExceptionWithDelay, init, initializeConnectionLatch, isPaused, isRunning, isSSLEnabled, pause, releaseConnectionLatch, resume, setAcceptorThreadCount, setAcceptorThreadPriority, setAddress, setAlgorithm, setAllowUnsafeLegacyRenegotiation, setAttribute, setBacklog, setBindOnInit, setCiphers, setClientAuth, setCrlFile, setDaemon, setExecutor, setKeepAliveTimeout, setKeyAlias, setKeyPass, setKeystoreFile, setKeystorePass, setKeystoreProvider, setKeystoreType, setMaxConnections, setMaxHeaderCount, setMaxKeepAliveRequests, setMaxThreads, setMinSpareThreads, setName, setPort, setProperty, setSessionCacheSize, setSessionTimeout, setSoLinger, setSoTimeout, setSSLEnabled, setSslEnabledProtocols, setSslProtocol, setTcpNoDelay, setThreadPriority, setTrustManagerClassName, setTrustMaxCertLength, setTruststoreAlgorithm, setTruststoreFile, setTruststorePass, setTruststoreProvider, setTruststoreType, shutdownExecutor, start, startAcceptorThreads, stop, unlockAccept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootPool

protected long rootPool
Root APR memory pool.


serverSock

protected long serverSock
Server socket "pointer".


serverSockPool

protected long serverSockPool
APR memory pool for the server socket.


sslContext

protected long sslContext
SSL context.


waitingRequests

protected ConcurrentLinkedQueue<SocketWrapper<Long>> waitingRequests

deferAccept

protected boolean deferAccept
Defer accept.


sendfileSize

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


handler

protected AprEndpoint.Handler handler
Handling of accepted sockets.


pollTime

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


useSendfile

protected boolean useSendfile
Use sendfile for sending static files.


useComet

protected boolean useComet
Allow comet request handling.


sendfileThreadCount

protected int sendfileThreadCount
Sendfile thread count.


pollerThreadCount

protected int pollerThreadCount
Poller thread count.


pollers

protected AprEndpoint.Poller[] pollers
The socket poller.


pollerRoundRobin

protected int pollerRoundRobin

cometPollers

protected AprEndpoint.Poller[] cometPollers
The socket poller used for Comet support.


cometPollerRoundRobin

protected int cometPollerRoundRobin

sendfiles

protected AprEndpoint.Sendfile[] sendfiles
The static file sender.


sendfileRoundRobin

protected int sendfileRoundRobin

SSLProtocol

protected String SSLProtocol
SSL protocols.


SSLPassword

protected String SSLPassword
SSL password (if a cert is encrypted, and no password has been provided, a callback will ask for a password).


SSLCipherSuite

protected String SSLCipherSuite
SSL cipher suite.


SSLCertificateFile

protected String SSLCertificateFile
SSL certificate file.


SSLCertificateKeyFile

protected String SSLCertificateKeyFile
SSL certificate key file.


SSLCertificateChainFile

protected String SSLCertificateChainFile
SSL certificate chain file.


SSLCACertificatePath

protected String SSLCACertificatePath
SSL CA certificate path.


SSLCACertificateFile

protected String SSLCACertificateFile
SSL CA certificate file.


SSLCARevocationPath

protected String SSLCARevocationPath
SSL CA revocation path.


SSLCARevocationFile

protected String SSLCARevocationFile
SSL CA revocation file.


SSLVerifyClient

protected String SSLVerifyClient
SSL verify client.


SSLVerifyDepth

protected int SSLVerifyDepth
SSL verify depth.


SSLInsecureRenegotiation

protected boolean SSLInsecureRenegotiation
SSL allow insecure renegotiation for the the client that does not support the secure renegotiation.

Constructor Detail

AprEndpoint

public AprEndpoint()
Method Detail

setDeferAccept

public void setDeferAccept(boolean deferAccept)

getDeferAccept

public boolean getDeferAccept()
Specified by:
getDeferAccept in class AbstractEndpoint

setSendfileSize

public void setSendfileSize(int sendfileSize)

getSendfileSize

public int getSendfileSize()

setHandler

public void setHandler(AprEndpoint.Handler handler)

getHandler

public AprEndpoint.Handler getHandler()

getPollTime

public int getPollTime()

setPollTime

public void setPollTime(int pollTime)

setUseSendfile

public void setUseSendfile(boolean useSendfile)

getUseSendfile

public boolean getUseSendfile()
Specified by:
getUseSendfile in class AbstractEndpoint

setUseComet

public void setUseComet(boolean useComet)

getUseComet

public boolean getUseComet()
Specified by:
getUseComet in class AbstractEndpoint

getUseCometTimeout

public boolean getUseCometTimeout()
Specified by:
getUseCometTimeout in class AbstractEndpoint

getUsePolling

public boolean getUsePolling()
Specified by:
getUsePolling in class AbstractEndpoint

setSendfileThreadCount

public void setSendfileThreadCount(int sendfileThreadCount)

getSendfileThreadCount

public int getSendfileThreadCount()

setPollerThreadCount

public void setPollerThreadCount(int pollerThreadCount)

getPollerThreadCount

public int getPollerThreadCount()

getPoller

public AprEndpoint.Poller getPoller()

getCometPoller

public AprEndpoint.Poller getCometPoller()

getSendfile

public AprEndpoint.Sendfile getSendfile()

getSSLProtocol

public String getSSLProtocol()

setSSLProtocol

public void setSSLProtocol(String SSLProtocol)

getSSLPassword

public String getSSLPassword()

setSSLPassword

public void setSSLPassword(String SSLPassword)

getSSLCipherSuite

public String getSSLCipherSuite()

setSSLCipherSuite

public void setSSLCipherSuite(String SSLCipherSuite)

getSSLCertificateFile

public String getSSLCertificateFile()

setSSLCertificateFile

public void setSSLCertificateFile(String SSLCertificateFile)

getSSLCertificateKeyFile

public String getSSLCertificateKeyFile()

setSSLCertificateKeyFile

public void setSSLCertificateKeyFile(String SSLCertificateKeyFile)

getSSLCertificateChainFile

public String getSSLCertificateChainFile()

setSSLCertificateChainFile

public void setSSLCertificateChainFile(String SSLCertificateChainFile)

getSSLCACertificatePath

public String getSSLCACertificatePath()

setSSLCACertificatePath

public void setSSLCACertificatePath(String SSLCACertificatePath)

getSSLCACertificateFile

public String getSSLCACertificateFile()

setSSLCACertificateFile

public void setSSLCACertificateFile(String SSLCACertificateFile)

getSSLCARevocationPath

public String getSSLCARevocationPath()

setSSLCARevocationPath

public void setSSLCARevocationPath(String SSLCARevocationPath)

getSSLCARevocationFile

public String getSSLCARevocationFile()

setSSLCARevocationFile

public void setSSLCARevocationFile(String SSLCARevocationFile)

getSSLVerifyClient

public String getSSLVerifyClient()

setSSLVerifyClient

public void setSSLVerifyClient(String SSLVerifyClient)

getSSLVerifyDepth

public int getSSLVerifyDepth()

setSSLVerifyDepth

public void setSSLVerifyDepth(int SSLVerifyDepth)

setSSLInsecureRenegotiation

public void setSSLInsecureRenegotiation(boolean SSLInsecureRenegotiation)

getSSLInsecureRenegotiation

public boolean getSSLInsecureRenegotiation()

getLocalPort

public int getLocalPort()
Port in use.

Specified by:
getLocalPort in class AbstractEndpoint

getKeepAliveCount

public int getKeepAliveCount()
Number of keepalive sockets.


getSendfileCount

public int getSendfileCount()
Number of sendfile sockets.


bind

public void bind()
          throws Exception
Initialize the endpoint.

Specified by:
bind in class AbstractEndpoint
Throws:
Exception

startInternal

public void startInternal()
                   throws Exception
Start the APR endpoint, creating acceptor, poller and sendfile threads.

Specified by:
startInternal in class AbstractEndpoint
Throws:
Exception

stopInternal

public void stopInternal()
Stop the endpoint. This will cause all processing threads to stop.

Specified by:
stopInternal in class AbstractEndpoint

unbind

public void unbind()
            throws Exception
Deallocate APR memory pools, and close server socket.

Specified by:
unbind in class AbstractEndpoint
Throws:
Exception

createAcceptor

protected AbstractEndpoint.Acceptor createAcceptor()
Description copied from class: AbstractEndpoint
Hook to allow Endpoints to provide a specific Acceptor implementation.

Specified by:
createAcceptor in class AbstractEndpoint

setSocketOptions

protected boolean setSocketOptions(long socket)
Process the specified connection.


allocatePoller

protected long allocatePoller(int size,
                              long pool,
                              int timeout)
Allocate a new poller of the specified size.


processSocketWithOptions

protected boolean processSocketWithOptions(long socket)
Process given socket.


processSocket

protected boolean processSocket(long socket)
Process given socket.


processSocket

protected boolean processSocket(long socket,
                                SocketStatus status)
Process given socket for an event.


processSocketAsync

public boolean processSocketAsync(SocketWrapper<Long> socket,
                                  SocketStatus status)

getLog

protected Log getLog()
Specified by:
getLog in class AbstractEndpoint

Apache Tomcat 7.0.28

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.