Apache Tomcat 7.0.22

org.apache.tomcat.util.net
Class AbstractEndpoint

java.lang.Object
  extended by org.apache.tomcat.util.net.AbstractEndpoint
Direct Known Subclasses:
AprEndpoint, JIoEndpoint, NioEndpoint

public abstract class AbstractEndpoint
extends java.lang.Object

Author:
fhanik, Mladen Turk, Remy Maucherat

Nested Class Summary
protected static class AbstractEndpoint.BindState
           
static interface AbstractEndpoint.Handler
           
 
Field Summary
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 Summary
AbstractEndpoint()
           
 
Method Summary
 java.lang.String adjustRelativePath(java.lang.String path, java.lang.String relativeTo)
           
abstract  void bind()
           
protected  long countDownConnection()
           
protected  void countUpOrAwaitConnection()
           
 void createExecutor()
           
 void destroy()
           
 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[] getCiphersArray()
           
 java.lang.String getClientAuth()
           
 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()
           
 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()
           
protected abstract  Log getLog()
           
 int getMaxConnections()
           
 int getMaxKeepAliveRequests()
           
 int getMaxThreads()
           
 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()
           
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.
protected  void releaseConnectionLatch()
           
 void resume()
          Resume the endpoint, which will make it start accepting new connections again.
 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 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 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 shutdownExecutor()
           
 void start()
           
abstract  void startInternal()
           
 void stop()
           
abstract  void stopInternal()
           
abstract  void unbind()
           
protected  void unlockAccept()
          Unlock the server socket accept using a bogus connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sm

protected static final StringManager sm

running

protected volatile boolean running
Running state of the endpoint.


paused

protected volatile boolean paused
Will be set to true whenever the endpoint is paused.


internalExecutor

protected volatile boolean internalExecutor
Are we using an internal executor


socketProperties

protected SocketProperties socketProperties
Socket properties


threadPriority

protected int threadPriority
Priority of the worker threads.


attributes

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. One example of such a sub-component is the ServerSocketFactory.

Constructor Detail

AbstractEndpoint

public AbstractEndpoint()
Method Detail

getSocketProperties

public SocketProperties getSocketProperties()

setMaxConnections

public void setMaxConnections(int maxCon)

getMaxConnections

public int getMaxConnections()

setExecutor

public void setExecutor(java.util.concurrent.Executor executor)

getExecutor

public java.util.concurrent.Executor getExecutor()

getPort

public int getPort()

setPort

public void setPort(int port)

getAddress

public java.net.InetAddress getAddress()

setAddress

public void setAddress(java.net.InetAddress address)

setBacklog

public void setBacklog(int backlog)

getBacklog

public int getBacklog()

getBindOnInit

public boolean getBindOnInit()

setBindOnInit

public void setBindOnInit(boolean b)

getKeepAliveTimeout

public int getKeepAliveTimeout()

setKeepAliveTimeout

public void setKeepAliveTimeout(int keepAliveTimeout)

getTcpNoDelay

public boolean getTcpNoDelay()
Socket TCP no delay.


setTcpNoDelay

public void setTcpNoDelay(boolean tcpNoDelay)

getSoLinger

public int getSoLinger()
Socket linger.


setSoLinger

public void setSoLinger(int soLinger)

getSoTimeout

public int getSoTimeout()
Socket timeout.


setSoTimeout

public void setSoTimeout(int soTimeout)

isSSLEnabled

public boolean isSSLEnabled()

setSSLEnabled

public void setSSLEnabled(boolean SSLEnabled)

getMinSpareThreads

public int getMinSpareThreads()

setMinSpareThreads

public void setMinSpareThreads(int minSpareThreads)

setMaxThreads

public void setMaxThreads(int maxThreads)

getMaxThreads

public int getMaxThreads()

getMaxKeepAliveRequests

public int getMaxKeepAliveRequests()

setMaxKeepAliveRequests

public void setMaxKeepAliveRequests(int maxKeepAliveRequests)

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

setDaemon

public void setDaemon(boolean b)

getDaemon

public boolean getDaemon()

setThreadPriority

public void setThreadPriority(int threadPriority)

getThreadPriority

public int getThreadPriority()

getDeferAccept

protected abstract boolean getDeferAccept()

setAttribute

public 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. The specific setter will call this method to populate the attributes.


getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Used by sub-components to retrieve configuration information.


setProperty

public boolean setProperty(java.lang.String name,
                           java.lang.String value)

getProperty

public java.lang.String getProperty(java.lang.String name)

getCurrentThreadCount

public int getCurrentThreadCount()
Return the amount of threads that are managed by the pool.

Returns:
the amount of threads that are managed by the pool

getCurrentThreadsBusy

public int getCurrentThreadsBusy()
Return the amount of threads that are in use

Returns:
the amount of threads that are in use

isRunning

public boolean isRunning()

isPaused

public boolean isPaused()

createExecutor

public void createExecutor()

shutdownExecutor

public void shutdownExecutor()

unlockAccept

protected void unlockAccept()
Unlock the server socket accept using a bogus connection.


bind

public abstract void bind()
                   throws java.lang.Exception
Throws:
java.lang.Exception

unbind

public abstract void unbind()
                     throws java.lang.Exception
Throws:
java.lang.Exception

startInternal

public abstract void startInternal()
                            throws java.lang.Exception
Throws:
java.lang.Exception

stopInternal

public abstract void stopInternal()
                           throws java.lang.Exception
Throws:
java.lang.Exception

init

public final void init()
                throws java.lang.Exception
Throws:
java.lang.Exception

start

public final void start()
                 throws java.lang.Exception
Throws:
java.lang.Exception

pause

public void pause()
Pause the endpoint, which will stop it accepting new connections.


resume

public void resume()
Resume the endpoint, which will make it start accepting new connections again.


stop

public final void stop()
                throws java.lang.Exception
Throws:
java.lang.Exception

destroy

public final void destroy()
                   throws java.lang.Exception
Throws:
java.lang.Exception

adjustRelativePath

public java.lang.String adjustRelativePath(java.lang.String path,
                                           java.lang.String relativeTo)

getLog

protected abstract Log getLog()

getUseSendfile

public abstract boolean getUseSendfile()

getUseComet

public abstract boolean getUseComet()

getUseCometTimeout

public abstract boolean getUseCometTimeout()

getUsePolling

public abstract boolean getUsePolling()

initializeConnectionLatch

protected LimitLatch initializeConnectionLatch()

releaseConnectionLatch

protected void releaseConnectionLatch()

countUpOrAwaitConnection

protected void countUpOrAwaitConnection()
                                 throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

countDownConnection

protected long countDownConnection()

handleExceptionWithDelay

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. For example, this can happen with the Acceptor thread if the ulimit for open files is reached.

Parameters:
currentErrorDelay - The current delay beign applied on failure
Returns:
The delay to apply on the next failure

getAlgorithm

public java.lang.String getAlgorithm()

setAlgorithm

public void setAlgorithm(java.lang.String s)

getClientAuth

public java.lang.String getClientAuth()

setClientAuth

public void setClientAuth(java.lang.String s)

getKeystoreFile

public java.lang.String getKeystoreFile()

setKeystoreFile

public void setKeystoreFile(java.lang.String s)

getKeystorePass

public java.lang.String getKeystorePass()

setKeystorePass

public void setKeystorePass(java.lang.String s)

getKeystoreType

public java.lang.String getKeystoreType()

setKeystoreType

public void setKeystoreType(java.lang.String s)

getKeystoreProvider

public java.lang.String getKeystoreProvider()

setKeystoreProvider

public void setKeystoreProvider(java.lang.String s)

getSslProtocol

public java.lang.String getSslProtocol()

setSslProtocol

public void setSslProtocol(java.lang.String s)

getCiphersArray

public java.lang.String[] getCiphersArray()

getCiphers

public java.lang.String getCiphers()

setCiphers

public void setCiphers(java.lang.String s)

getKeyAlias

public java.lang.String getKeyAlias()

setKeyAlias

public void setKeyAlias(java.lang.String s)

getKeyPass

public java.lang.String getKeyPass()

setKeyPass

public void setKeyPass(java.lang.String s)

getTruststoreFile

public java.lang.String getTruststoreFile()

setTruststoreFile

public void setTruststoreFile(java.lang.String s)

getTruststorePass

public java.lang.String getTruststorePass()

setTruststorePass

public void setTruststorePass(java.lang.String truststorePass)

getTruststoreType

public java.lang.String getTruststoreType()

setTruststoreType

public void setTruststoreType(java.lang.String truststoreType)

getTruststoreProvider

public java.lang.String getTruststoreProvider()

setTruststoreProvider

public void setTruststoreProvider(java.lang.String truststoreProvider)

getTruststoreAlgorithm

public java.lang.String getTruststoreAlgorithm()

setTruststoreAlgorithm

public void setTruststoreAlgorithm(java.lang.String truststoreAlgorithm)

getTrustManagerClassName

public java.lang.String getTrustManagerClassName()

setTrustManagerClassName

public void setTrustManagerClassName(java.lang.String trustManagerClassName)

getCrlFile

public java.lang.String getCrlFile()

setCrlFile

public void setCrlFile(java.lang.String crlFile)

getTrustMaxCertLength

public java.lang.String getTrustMaxCertLength()

setTrustMaxCertLength

public void setTrustMaxCertLength(java.lang.String trustMaxCertLength)

getSessionCacheSize

public java.lang.String getSessionCacheSize()

setSessionCacheSize

public void setSessionCacheSize(java.lang.String s)

getSessionTimeout

public java.lang.String getSessionTimeout()

setSessionTimeout

public void setSessionTimeout(java.lang.String s)

getAllowUnsafeLegacyRenegotiation

public java.lang.String getAllowUnsafeLegacyRenegotiation()

setAllowUnsafeLegacyRenegotiation

public void setAllowUnsafeLegacyRenegotiation(java.lang.String s)

getSslEnabledProtocolsArray

public java.lang.String[] getSslEnabledProtocolsArray()

setSslEnabledProtocols

public void setSslEnabledProtocols(java.lang.String s)

Apache Tomcat 7.0.22

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