|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.util.ThreadPool | +--org.mortbay.util.ThreadedServer
Threaded socket server. This class listens at a socket and gives the connections received to a pool of Threads
The class is abstract and derived classes must provide the handling for the connections.
The properties THREADED_SERVER_MIN_THREADS and THREADED_SERVER_MAX_THREADS can be set to control the number of threads created.
Inner classes inherited from class org.mortbay.util.ThreadPool |
ThreadPool.PoolThread |
Fields inherited from class org.mortbay.util.ThreadPool |
__nullLockChecks |
Constructor Summary | |
ThreadedServer()
|
|
ThreadedServer(java.net.InetAddress address,
int port)
Construct for specific address and port. |
|
ThreadedServer(InetAddrPort address)
Construct for specific address and port. |
|
ThreadedServer(int port)
Construct for specific port. |
|
ThreadedServer(java.lang.String host,
int port)
Construct for specific address and port. |
Method Summary | |
void |
destroy()
Destroy the ThreadPool. |
java.lang.String |
getHost()
|
java.net.InetAddress |
getInetAddress()
|
InetAddrPort |
getInetAddrPort()
|
int |
getLingerTimeSecs()
|
int |
getMaxReadTimeMs()
|
int |
getPort()
|
java.net.ServerSocket |
getServerSocket()
|
void |
handle(java.lang.Object job)
Handle Job. |
void |
setAddress(InetAddrPort address)
Set the server InetAddress and port. |
void |
setHost(java.lang.String host)
|
void |
setInetAddress(java.net.InetAddress addr)
|
void |
setLingerTimeSecs(int ls)
|
void |
setMaxReadTimeMs(int ms)
Set Max Read Time. |
void |
setPort(int port)
|
void |
start()
Start the LifeCycle. |
void |
stop()
Stop the ThreadPool. |
java.lang.String |
toString()
|
Methods inherited from class org.mortbay.util.ThreadPool |
getIdleThreads, getMaxIdleTimeMs, getMaxSize, getMaxStopTimeMs, getMaxThreads, getMinSize, getMinThreads, getName, getSize, getThreadClass, getThreads, initialize, isDestroyed, isStarted, join, run, setMaxIdleTimeMs, setMaxSize, setMaxStopTimeMs, setMaxThreads, setMinSize, setMinThreads, setName, setThreadClass |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ThreadedServer()
public ThreadedServer(int port)
public ThreadedServer(java.net.InetAddress address, int port)
public ThreadedServer(java.lang.String host, int port) throws java.net.UnknownHostException
public ThreadedServer(InetAddrPort address)
Method Detail |
public java.net.ServerSocket getServerSocket()
public void setAddress(InetAddrPort address)
address
- The Address to listen on, or 0.0.0.0:port for
all interfaces.public void setHost(java.lang.String host) throws java.net.UnknownHostException
host
- public void setInetAddress(java.net.InetAddress addr)
addr
- public void setPort(int port)
port
- public void setMaxReadTimeMs(int ms)
ms
- Max read time in ms or 0 for no limit.public int getMaxReadTimeMs()
public void setLingerTimeSecs(int ls)
sec
- seconds to linger or -1 to disable linger.public int getLingerTimeSecs()
public InetAddrPort getInetAddrPort()
public java.net.InetAddress getInetAddress()
public java.lang.String getHost()
public int getPort()
public void handle(java.lang.Object job)
job
- A Connection.public void start() throws java.lang.Exception
LifeCycle
start
in class ThreadPool
org.mortbay.util.LifeCycle
java.lang.Exception
- An arbitrary exception may be thrown.public void stop() throws java.lang.InterruptedException
ThreadPool
stop
in class ThreadPool
public void destroy()
ThreadPool
destroy
in class ThreadPool
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |