com.twitter.common.net.http.handlers
Class QuitHandler

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.twitter.common.net.http.handlers.QuitHandler
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class QuitHandler
extends javax.servlet.http.HttpServlet

A servlet that provides a way to remotely signal the process to initiate a clean shutdown sequence.

See Also:
Serialized Form

Field Summary
static String QUIT_HANDLER_KEY
          A @Named binding key for the QuitHandler listener.
 
Constructor Summary
QuitHandler(Runnable quitListener)
          Constructs a new QuitHandler that will notify the given quitListener when the servlet is accessed.
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUIT_HANDLER_KEY

public static final String QUIT_HANDLER_KEY
A @Named binding key for the QuitHandler listener.

See Also:
Constant Field Values
Constructor Detail

QuitHandler

@Inject
public QuitHandler(Runnable quitListener)
Constructs a new QuitHandler that will notify the given quitListener when the servlet is accessed. It is the responsibility of the listener to initiate a clean shutdown of the process.

Parameters:
quitListener - Runnable to notify when the servlet is accessed.
Method Detail

doGet

protected void doGet(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              throws IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse resp)
               throws IOException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
IOException