-
Notifications
You must be signed in to change notification settings - Fork 923
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
Provide a way to terminate unfinished requests after graceful shutdown #5941
Draft
ikhoon
wants to merge
7
commits into
line:main
Choose a base branch
from
ikhoon:shutting-down-exception
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Oct 16, 2024
-
Provide a way to terminate unfinished requests after graceful shutdown
Motivation: Unfinished requests even after graceful shutdown period are forcivily closed with `ClosedSessionException`. As `ClosedSessionException` indicates that the connection was unexpectedly disconnected, `ClosedSessionException` is not suitable for graceful shutdown. In this PR, I propose to add `ShuttingDownException` to terminate unfinished requests when a server stops. Modifications: - Introduce `GracefulShutdown` to customize graceful shutdown behavior. - Users can specify a error function to create an exception to unfinished terminate requests. - Fixed `HttpServerHandler` to send error responses using the error function of `GracefulShutdown` - Fixed `Server` to send error respones first and then close the connnections. - Deprecation) `ServerConfig.gracefulShutdownQuietPeriod()` and `ServerConfig.gracefulShutdownTimeout()` have been deprecated in favor of `ServerConfig.gracefulShutdown()`. Result: You can now use `GracefulShutdown` to terminate unfinished requests when a server stops. ```java GracefulShutdown gracefulShutdown = GracefulShutdown .builder() .quietPeriod(Duration.ofSeconds(10)) .timeout(Duration.ofSeconds(15)) .shutdownErrorFunction((ctx, req) -> { return new ServerStopException(); }) .build(); Server .builder() .gracefulShutdown(gracefulShutdown); ```
Configuration menu - View commit details
-
Copy full SHA for b5949a4 - Browse repository at this point
Copy the full SHA b5949a4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7277f60 - Browse repository at this point
Copy the full SHA 7277f60View commit details
Commits on Oct 18, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 9d83337 - Browse repository at this point
Copy the full SHA 9d83337View commit details -
Configuration menu - View commit details
-
Copy full SHA for 685f93d - Browse repository at this point
Copy the full SHA 685f93dView commit details
Commits on Oct 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 227b6b4 - Browse repository at this point
Copy the full SHA 227b6b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a40aa8 - Browse repository at this point
Copy the full SHA 0a40aa8View commit details
Commits on Nov 11, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 538deba - Browse repository at this point
Copy the full SHA 538debaView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.