org.apache.tomcat.util.net
Class PoolTcpEndpoint

java.lang.Object
  extended byorg.apache.tomcat.util.net.PoolTcpEndpoint
All Implemented Interfaces:
java.lang.Runnable

public class PoolTcpEndpoint
extends java.lang.Object
implements java.lang.Runnable

Handle incoming TCP connections. This class implement a simple server model: one listener thread accepts on a socket and creates a new worker thread for each incoming connection. More advanced Endpoints will reuse the threads, use queues, etc.

Author:
James Duncan Davidson [duncan@eng.sun.com], Jason Hunter [jch@eng.sun.com], James Todd [gonzo@eng.sun.com], Costin@eng.sun.com, Gal Shachor [shachor@il.ibm.com], Yoav Shapira

Field Summary
protected  int linger
           
protected  int socketTimeout
           
protected  boolean tcpNoDelay
           
 
Constructor Summary
PoolTcpEndpoint()
           
PoolTcpEndpoint(ThreadPool tp)
           
 
Method Summary
protected  void closeServerSocket()
           
 java.net.InetAddress getAddress()
           
 int getBacklog()
           
 TcpConnectionHandler getConnectionHandler()
           
 int getCurrentThreadCount()
           
 int getCurrentThreadsBusy()
           
 int getMaxHeaderCount()
           
 int getMaxSpareThreads()
           
 int getMaxThreads()
           
 int getMinSpareThreads()
           
 int getPort()
           
 int getServerSoTimeout()
           
 int getSoLinger()
           
 int getSoTimeout()
           
 java.lang.String getStrategy()
           
 boolean getTcpNoDelay()
           
 int getThreadPriority()
           
 void initEndpoint()
           
 boolean isPaused()
           
 boolean isRunning()
           
 void pauseEndpoint()
           
 void resumeEndpoint()
           
 void run()
          The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.
 void setAddress(java.net.InetAddress inet)
           
 void setBacklog(int backlog)
          Allows the server developer to specify the backlog that should be used for server sockets.
 void setConnectionHandler(TcpConnectionHandler handler)
           
 void setMaxHeaderCount(int maxHeaderCount)
           
 void setMaxSpareThreads(int maxThreads)
           
 void setMaxThreads(int maxThreads)
           
 void setMinSpareThreads(int minThreads)
           
 void setPort(int port)
           
 void setServerSocket(java.net.ServerSocket ss)
           
 void setServerSocketFactory(ServerSocketFactory factory)
           
 void setServerSoTimeout(int i)
           
 void setServerTimeout(int timeout)
          Sets the timeout in ms of the server sockets created by this server.
 void setSoLinger(int i)
           
 void setSoTimeout(int i)
           
 void setStrategy(java.lang.String strategy)
           
 void setTcpNoDelay(boolean b)
           
 void setThreadPriority(int threadPriority)
           
 void startEndpoint()
           
 void stopEndpoint()
           
protected  void unlockAccept()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tcpNoDelay

protected boolean tcpNoDelay

linger

protected int linger

socketTimeout

protected int socketTimeout
Constructor Detail

PoolTcpEndpoint

public PoolTcpEndpoint()

PoolTcpEndpoint

public PoolTcpEndpoint(ThreadPool tp)
Method Detail

setMaxThreads

public void setMaxThreads(int maxThreads)

getMaxThreads

public int getMaxThreads()

setMaxSpareThreads

public void setMaxSpareThreads(int maxThreads)

getMaxSpareThreads

public int getMaxSpareThreads()

setMinSpareThreads

public void setMinSpareThreads(int minThreads)

getMinSpareThreads

public int getMinSpareThreads()

setThreadPriority

public void setThreadPriority(int threadPriority)

getThreadPriority

public int getThreadPriority()

getPort

public int getPort()

setPort

public void setPort(int port)

getAddress

public java.net.InetAddress getAddress()

setAddress

public void setAddress(java.net.InetAddress inet)

setServerSocket

public void setServerSocket(java.net.ServerSocket ss)

setServerSocketFactory

public void setServerSocketFactory(ServerSocketFactory factory)

setConnectionHandler

public void setConnectionHandler(TcpConnectionHandler handler)

getConnectionHandler

public TcpConnectionHandler getConnectionHandler()

isRunning

public boolean isRunning()

isPaused

public boolean isPaused()

setBacklog

public void setBacklog(int backlog)
Allows the server developer to specify the backlog that should be used for server sockets. By default, this value is 100.


getBacklog

public int getBacklog()

setServerTimeout

public void setServerTimeout(int timeout)
Sets the timeout in ms of the server sockets created by this server. This method allows the developer to make servers more or less responsive to having their server sockets shut down.

By default this value is 1000ms.


getTcpNoDelay

public boolean getTcpNoDelay()

setTcpNoDelay

public void setTcpNoDelay(boolean b)

getSoLinger

public int getSoLinger()

setSoLinger

public void setSoLinger(int i)

getSoTimeout

public int getSoTimeout()

setSoTimeout

public void setSoTimeout(int i)

getServerSoTimeout

public int getServerSoTimeout()

setServerSoTimeout

public void setServerSoTimeout(int i)

getStrategy

public java.lang.String getStrategy()

setStrategy

public void setStrategy(java.lang.String strategy)

getMaxHeaderCount

public int getMaxHeaderCount()

setMaxHeaderCount

public void setMaxHeaderCount(int maxHeaderCount)

getCurrentThreadCount

public int getCurrentThreadCount()

getCurrentThreadsBusy

public int getCurrentThreadsBusy()

initEndpoint

public void initEndpoint()
                  throws java.io.IOException,
                         java.lang.InstantiationException
Throws:
java.io.IOException
java.lang.InstantiationException

startEndpoint

public void startEndpoint()
                   throws java.io.IOException,
                          java.lang.InstantiationException
Throws:
java.io.IOException
java.lang.InstantiationException

pauseEndpoint

public void pauseEndpoint()

resumeEndpoint

public void resumeEndpoint()

stopEndpoint

public void stopEndpoint()

closeServerSocket

protected void closeServerSocket()

unlockAccept

protected void unlockAccept()

run

public void run()
The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.

Specified by:
run in interface java.lang.Runnable


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