-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jetty 12 - Introduce GracefulShutdownHandler
and Test
#9174
Jetty 12 - Introduce GracefulShutdownHandler
and Test
#9174
Conversation
+ started with removing `@Disabled` from `GracefulStopTest.java`
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
…0.x/core-graceful-shutdown-handler
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
...ore/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulShutdownHandler.java
Outdated
Show resolved
Hide resolved
// Increment the counter before the test for isShutdown(), to avoid race conditions. | ||
ShutdownTrackingCallback shutdownCallback = new ShutdownTrackingCallback(request, response, callback); | ||
|
||
Handler handler = getHandler(); | ||
if (handler == null || !isStarted() || isShutdown()) | ||
{ | ||
if (LOG.isDebugEnabled()) | ||
LOG.debug("Service Unavailable: {}", request.getHttpURI()); | ||
Response.writeError(request, response, shutdownCallback, HttpStatus.SERVICE_UNAVAILABLE_503); | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still does not feel correct. If we are not started, then we should not be processing the request, even for a 503.
// Increment the counter before the test for isShutdown(), to avoid race conditions. | |
ShutdownTrackingCallback shutdownCallback = new ShutdownTrackingCallback(request, response, callback); | |
Handler handler = getHandler(); | |
if (handler == null || !isStarted() || isShutdown()) | |
{ | |
if (LOG.isDebugEnabled()) | |
LOG.debug("Service Unavailable: {}", request.getHttpURI()); | |
Response.writeError(request, response, shutdownCallback, HttpStatus.SERVICE_UNAVAILABLE_503); | |
return true; | |
} | |
Handler handler = getHandler(); | |
if (handler == null || !isStarted()) | |
return false; | |
// Increment the counter before the test for isShutdown(), to avoid race conditions. | |
ShutdownTrackingCallback shutdownCallback = new ShutdownTrackingCallback(request, response, callback); | |
if (isShutdown()) | |
{ | |
if (LOG.isDebugEnabled()) | |
LOG.debug("Service Unavailable: {}", request.getHttpURI()); | |
Response.writeError(request, response, shutdownCallback, HttpStatus.SERVICE_UNAVAILABLE_503); | |
return true; | |
} |
The handler==null
case can be before or after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
Before I dive into the jetty-start module for this ... I'm wondering if this is the right name for this handler? |
@Disabled
fromGracefulStopTest.java