org.codehaus.spice.netserve.connection.handlers
Class ThreadPerRequestHandler

java.lang.Object
  extended byorg.codehaus.spice.netserve.connection.handlers.AbstractRequestHandler
      extended byorg.codehaus.spice.netserve.connection.handlers.DelegatingRequestHandler
          extended byorg.codehaus.spice.netserve.connection.handlers.ThreadPerRequestHandler
All Implemented Interfaces:
RequestHandler

public class ThreadPerRequestHandler
extends DelegatingRequestHandler

A Handler that uses a thread from a pool for each different request.

Version:
$Revision: 1.2 $ $Date: 2004/03/21 23:42:58 $
Author:
Peter Donald

Constructor Summary
ThreadPerRequestHandler(RequestHandler handler, org.codehaus.spice.threadpool.ThreadPool threadPool)
          Create handler.
 
Method Summary
protected  void endConnection(Socket socket)
          Remove ThreadControl from list of active threads.
 void handleConnection(Socket socket)
          Execute each request in a separate thread.
 void shutdown(long timeout)
          Shutdown all requests including those executing in thread pool.
 
Methods inherited from class org.codehaus.spice.netserve.connection.handlers.DelegatingRequestHandler
doPerformRequest
 
Methods inherited from class org.codehaus.spice.netserve.connection.handlers.AbstractRequestHandler
createRunnable, errorClosingConnection, errorHandlingConnection, getThreadName, isShutdown, markAsShutdown, performRequest, setupThreadName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPerRequestHandler

public ThreadPerRequestHandler(RequestHandler handler,
                               org.codehaus.spice.threadpool.ThreadPool threadPool)
Create handler.

Parameters:
handler - the underlying handler
threadPool - the thread pool to use to create handler threads
Method Detail

handleConnection

public void handleConnection(Socket socket)
Execute each request in a separate thread.

Specified by:
handleConnection in interface RequestHandler
Overrides:
handleConnection in class AbstractRequestHandler
Parameters:
socket - the socket to handle

endConnection

protected void endConnection(Socket socket)
Remove ThreadControl from list of active threads.

Overrides:
endConnection in class AbstractRequestHandler
Parameters:
socket - the socket

shutdown

public void shutdown(long timeout)
Shutdown all requests including those executing in thread pool.

Specified by:
shutdown in interface RequestHandler
Overrides:
shutdown in class DelegatingRequestHandler
Parameters:
timeout - the timeout
See Also:
AbstractRequestHandler.shutdown(long)


Copyright © 1999-2004 Codehaus. All Rights Reserved.