Mercurial Hosting > luan
changeset 995:0eba8f555c19
remove Server.Graceful
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 18 Oct 2016 18:38:05 -0600 |
parents | 4e9d373bf6e9 |
children | d9cfec64899c |
files | src/org/eclipse/jetty/server/Server.java src/org/eclipse/jetty/server/handler/ContextHandler.java |
diffstat | 2 files changed, 5 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
diff -r 4e9d373bf6e9 -r 0eba8f555c19 src/org/eclipse/jetty/server/Server.java --- a/src/org/eclipse/jetty/server/Server.java Tue Oct 18 16:34:18 2016 -0600 +++ b/src/org/eclipse/jetty/server/Server.java Tue Oct 18 18:38:05 2016 -0600 @@ -180,11 +180,12 @@ * Called by doStop if a {@link #setGracefulShutdown} period is set. * TODO move this somewhere better */ +/* public interface Graceful extends Handler { public void setShutdown(boolean shutdown); } - +*/ public final boolean isLowOnThreads() {
diff -r 4e9d373bf6e9 -r 0eba8f555c19 src/org/eclipse/jetty/server/handler/ContextHandler.java --- a/src/org/eclipse/jetty/server/handler/ContextHandler.java Tue Oct 18 16:34:18 2016 -0600 +++ b/src/org/eclipse/jetty/server/handler/ContextHandler.java Tue Oct 18 18:38:05 2016 -0600 @@ -67,7 +67,6 @@ import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HandlerContainer; import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.AttributesMap; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; @@ -85,7 +84,7 @@ * This handler wraps a call to handle by setting the context and servlet path. * */ -public final class ContextHandler extends HandlerWrapper implements Server.Graceful +public final class ContextHandler extends HandlerWrapper { private static final Logger LOG = LoggerFactory.getLogger(ContextHandler.class); @@ -93,11 +92,6 @@ private Resource _baseResource; private Logger _logger; - private boolean _shutdown = false; - private volatile int _availability; // 0=STOPPED, 1=AVAILABLE, 2=SHUTDOWN, 3=UNAVAILABLE - - private final static int __STOPPED = 0, __AVAILABLE = 1, __SHUTDOWN = 2; - public ContextHandler() { super(); @@ -132,42 +126,18 @@ } /* ------------------------------------------------------------ */ - /** - * Set shutdown status. This field allows for graceful shutdown of a context. A started context may be put into non accepting state so that existing - * requests can complete, but no new requests are accepted. - * - * @param shutdown - * true if this context is (not?) accepting new requests - */ - public void setShutdown(boolean shutdown) - { - synchronized (this) - { - _shutdown = shutdown; - _availability = isRunning()?(_shutdown?__SHUTDOWN:__AVAILABLE):__STOPPED; - } - } - - /* ------------------------------------------------------------ */ /* * @see org.eclipse.thread.AbstractLifeCycle#doStart() */ @Override protected void doStart() throws Exception { - _availability = __STOPPED; - if (_contextPath == null) throw new IllegalStateException("Null contextPath"); _logger = LoggerFactory.getLogger(getContextPath()); super.doStart(); - - synchronized(this) - { - _availability = _shutdown?__SHUTDOWN:__AVAILABLE; - } } /* ------------------------------------------------------------ */ @@ -177,23 +147,14 @@ @Override protected void doStop() throws Exception { - _availability = __STOPPED; - super.doStop(); LOG.info("stopped {}",this); } private boolean checkContext(final String target, final Request baseRequest, final HttpServletResponse response) throws IOException, ServletException { - switch (_availability) - { - case __STOPPED: - case __SHUTDOWN: - return false; - default: - if (baseRequest.isHandled()) - return false; - } + if (baseRequest.isHandled()) + return false; // Are we not the root context? if (_contextPath.length() > 1)