org.apache.tomcat.util.net

Class BaseEndpoint

public abstract class BaseEndpoint extends Object

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

Field Summary
protected InetAddressaddress
Address for the server socket.
protected intbacklog
Allows the server developer to specify the backlog that should be used for server sockets.
protected intcurThreads
Current worker threads count.
protected intcurThreadsBusy
Current worker threads busy count.
static StringCERTIFICATE_KEY
The Request attribute key for the client certificate chain.
static StringCIPHER_SUITE_KEY
The Request attribute key for the cipher suite.
protected booleandaemon
The default is true - the created threads will be in daemon mode.
protected Executorexecutor
External Executor based thread pool.
protected booleaninitialized
Track the initialization state of the endpoint.
static StringKEY_SIZE_KEY
The Request attribute key for the key size.
protected static Loglog
protected intmaxThreads
Maximum amount of worker threads.
protected Stringname
Name of the thread pool, which will be used for naming child threads.
protected booleanpaused
Will be set to true whenever the endpoint is paused.
protected intport
Server socket port.
protected booleanrunning
Running state of the endpoint.
protected intsequence
Sequence number used to generate thread names.
protected static StringManagersm
protected intsoLinger
Socket linger.
protected intsoTimeout
Socket timeout.
static StringSESSION_ID_KEY
The Request attribute key for the session id.
protected booleantcpNoDelay
Socket TCP no delay.
protected intthreadPriority
Priority of the acceptor and poller threads.
Method Summary
abstract voiddestroy()
Deallocate APR memory pools, and close server socket.
InetAddressgetAddress()
intgetBacklog()
intgetCurrentThreadCount()
Return the amount of threads that are managed by the pool.
intgetCurrentThreadsBusy()
Return the amount of threads currently busy.
booleangetDaemon()
ExecutorgetExecutor()
intgetMaxSpareThreads()
Dummy maxSpareThreads property.
intgetMaxThreads()
intgetMinSpareThreads()
Dummy minSpareThreads property.
StringgetName()
intgetPort()
protected intgetSequence()
Get a sequence number used for thread naming.
intgetSoLinger()
intgetSoTimeout()
booleangetTcpNoDelay()
intgetThreadPriority()
abstract voidinit()
Initialize the endpoint.
booleanisPaused()
Return the state of the endpoint.
booleanisRunning()
Return the state of the endpoint.
voidpause()
Pause the endpoint, which will make it stop accepting new sockets.
voidresume()
Resume the endpoint, which will make it start accepting new sockets again.
voidsetAddress(InetAddress address)
voidsetBacklog(int backlog)
voidsetDaemon(boolean b)
voidsetExecutor(Executor executor)
voidsetMaxThreads(int maxThreads)
voidsetName(String name)
voidsetPort(int port)
voidsetSoLinger(int soLinger)
voidsetSoTimeout(int soTimeout)
voidsetTcpNoDelay(boolean tcpNoDelay)
voidsetThreadPriority(int threadPriority)
abstract voidstart()
Start the APR endpoint, creating acceptor, poller and sendfile threads.
abstract voidstop()
Stop the endpoint.
protected voidunlockAccept()
Unlock the server socket accept using a bugus connection.

Field Detail

address

protected InetAddress address
Address for the server socket.

backlog

protected int backlog
Allows the server developer to specify the backlog that should be used for server sockets. By default, this value is 100.

curThreads

protected int curThreads
Current worker threads count.

curThreadsBusy

protected int curThreadsBusy
Current worker threads busy count.

CERTIFICATE_KEY

public static final String CERTIFICATE_KEY
The Request attribute key for the client certificate chain.

CIPHER_SUITE_KEY

public static final String CIPHER_SUITE_KEY
The Request attribute key for the cipher suite.

daemon

protected boolean daemon
The default is true - the created threads will be in daemon mode. If set to false, the control thread will not be daemon - and will keep the process alive.

executor

protected Executor executor
External Executor based thread pool.

initialized

protected boolean initialized
Track the initialization state of the endpoint.

KEY_SIZE_KEY

public static final String KEY_SIZE_KEY
The Request attribute key for the key size.

log

protected static Log log

maxThreads

protected int maxThreads
Maximum amount of worker threads.

name

protected String name
Name of the thread pool, which will be used for naming child threads.

paused

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

port

protected int port
Server socket port.

running

protected volatile boolean running
Running state of the endpoint.

sequence

protected int sequence
Sequence number used to generate thread names.

sm

protected static StringManager sm

soLinger

protected int soLinger
Socket linger.

soTimeout

protected int soTimeout
Socket timeout.

SESSION_ID_KEY

public static final String SESSION_ID_KEY
The Request attribute key for the session id. This one is a Tomcat extension to the Servlet spec.

tcpNoDelay

protected boolean tcpNoDelay
Socket TCP no delay.

threadPriority

protected int threadPriority
Priority of the acceptor and poller threads.

Method Detail

destroy

public abstract void destroy()
Deallocate APR memory pools, and close server socket.

getAddress

public InetAddress getAddress()

getBacklog

public int getBacklog()

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 currently busy.

Returns: the amount of threads currently busy

getDaemon

public boolean getDaemon()

getExecutor

public Executor getExecutor()

getMaxSpareThreads

public int getMaxSpareThreads()
Dummy maxSpareThreads property.

getMaxThreads

public int getMaxThreads()

getMinSpareThreads

public int getMinSpareThreads()
Dummy minSpareThreads property.

getName

public String getName()

getPort

public int getPort()

getSequence

protected int getSequence()
Get a sequence number used for thread naming.

getSoLinger

public int getSoLinger()

getSoTimeout

public int getSoTimeout()

getTcpNoDelay

public boolean getTcpNoDelay()

getThreadPriority

public int getThreadPriority()

init

public abstract void init()
Initialize the endpoint.

isPaused

public boolean isPaused()
Return the state of the endpoint.

Returns: true if the endpoint is paused, false otherwise

isRunning

public boolean isRunning()
Return the state of the endpoint.

Returns: true if the endpoint is running, false otherwise

pause

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

resume

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

setAddress

public void setAddress(InetAddress address)

setBacklog

public void setBacklog(int backlog)

setDaemon

public void setDaemon(boolean b)

setExecutor

public void setExecutor(Executor executor)

setMaxThreads

public void setMaxThreads(int maxThreads)

setName

public void setName(String name)

setPort

public void setPort(int port)

setSoLinger

public void setSoLinger(int soLinger)

setSoTimeout

public void setSoTimeout(int soTimeout)

setTcpNoDelay

public void setTcpNoDelay(boolean tcpNoDelay)

setThreadPriority

public void setThreadPriority(int threadPriority)

start

public abstract void start()
Start the APR endpoint, creating acceptor, poller and sendfile threads.

stop

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

unlockAccept

protected void unlockAccept()
Unlock the server socket accept using a bugus connection.
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.