code convention fixes, javadoc update

This commit is contained in:
Thomas Becker 2011-09-30 12:04:17 +02:00 committed by Jesse McConnell
parent 37845a1a4f
commit 3e73e79c1e
1 changed files with 17 additions and 10 deletions

View File

@ -26,8 +26,10 @@ import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* A handler that shuts the server down on a valid request. Used to do "soft" restarts from Java. This handler is a contribution from Johannes Brodwall: * A handler that shuts the server down on a valid request. Used to do "soft" restarts from Java. If _exitJvm ist set to true a hard System.exit() call is being
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=357687 * made.
*
* This handler is a contribution from Johannes Brodwall: https://bugs.eclipse.org/bugs/show_bug.cgi?id=357687
* *
* Usage: * Usage:
* *
@ -44,11 +46,11 @@ public class ShutdownHandler extends AbstractHandler
{ {
private static final Logger LOG = Log.getLogger(ShutdownHandler.class); private static final Logger LOG = Log.getLogger(ShutdownHandler.class);
private final String shutdownToken; private final String _shutdownToken;
private final Server jettyServer; private final Server _jettyServer;
private boolean exitJvm = false; private boolean _exitJvm = false;
/** /**
* Creates a listener that lets the server be shut down remotely (but only from localhost). * Creates a listener that lets the server be shut down remotely (but only from localhost).
@ -60,8 +62,8 @@ public class ShutdownHandler extends AbstractHandler
*/ */
public ShutdownHandler(Server server, String shutdownToken) public ShutdownHandler(Server server, String shutdownToken)
{ {
this.jettyServer = server; this._jettyServer = server;
this.shutdownToken = shutdownToken; this._shutdownToken = shutdownToken;
} }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
@ -112,14 +114,19 @@ public class ShutdownHandler extends AbstractHandler
private boolean hasCorrectSecurityToken(HttpServletRequest request) private boolean hasCorrectSecurityToken(HttpServletRequest request)
{ {
return shutdownToken.equals(request.getParameter("token")); return _shutdownToken.equals(request.getParameter("token"));
} }
void shutdownServer() throws Exception void shutdownServer() throws Exception
{ {
jettyServer.stop(); _jettyServer.stop();
if (exitJvm) if (_exitJvm)
System.exit(0); System.exit(0);
} }
public void setExitJvm(boolean exitJvm)
{
this._exitJvm = exitJvm;
}
} }