org.apache.tomcat.util.net
Class PoolTcpEndpoint

java.lang.Object
  |
  +--org.apache.tomcat.util.net.PoolTcpEndpoint

public class PoolTcpEndpoint
extends java.lang.Object

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]

Field Summary
protected  Log _log
           
protected  int linger
           
protected  int socketTimeout
           
protected  boolean tcpNoDelay
           
 
Constructor Summary
PoolTcpEndpoint()
           
 
Method Summary
 java.net.InetAddress getAddress()
           
 int getBacklog()
           
 TcpConnectionHandler getConnectionHandler()
           
 int getMaxSpareThreads()
           
 int getMaxThreads()
           
 int getMinSpareThreads()
           
 int getPort()
           
 boolean isPoolOn()
           
 boolean isRunning()
           
 void log(java.lang.String msg)
           
 void log(java.lang.String msg, int level)
           
 void log(java.lang.String msg, java.lang.Throwable t)
           
 void log(java.lang.String msg, java.lang.Throwable t, int level)
           
 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 setMaxSpareThreads(int maxThreads)
           
 void setMaxThreads(int maxThreads)
           
 void setMinSpareThreads(int minThreads)
           
 void setPoolOn(boolean isPool)
           
 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 setTcpNoDelay(boolean b)
           
 void startEndpoint()
           
 void stopEndpoint()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected Log _log

tcpNoDelay

protected boolean tcpNoDelay

linger

protected int linger

socketTimeout

protected int socketTimeout
Constructor Detail

PoolTcpEndpoint

public PoolTcpEndpoint()
Method Detail

setPoolOn

public void setPoolOn(boolean isPool)

isPoolOn

public boolean isPoolOn()

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()

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()

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.


setTcpNoDelay

public void setTcpNoDelay(boolean b)

setSoLinger

public void setSoLinger(int i)

setSoTimeout

public void setSoTimeout(int i)

setServerSoTimeout

public void setServerSoTimeout(int i)

startEndpoint

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

stopEndpoint

public void stopEndpoint()

log

public void log(java.lang.String msg)

log

public void log(java.lang.String msg,
                java.lang.Throwable t)

log

public void log(java.lang.String msg,
                int level)

log

public void log(java.lang.String msg,
                java.lang.Throwable t,
                int level)


Copyright © 2001 Apache Software Foundation. All Rights Reserved.