Skip to content
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

Add shutdown hook to gracefully shut down Grizzly #2384

Merged
merged 2 commits into from Dec 30, 2016

Conversation

@jcassee
Copy link
Contributor

@jcassee jcassee commented Dec 23, 2016

This PR moves the call to HttpServer.shutdown to a JVM shutdown hook, in order to gracefully shut down the Grizzly server in case a TERM signal is received.

@@ -131,7 +136,8 @@ public void run() {
} catch (InterruptedException ie) {
LOG.info("Interrupted, shutting down.");
}
httpServer.shutdown();
Copy link
Collaborator

@novalis novalis Dec 30, 2016

I'm confused about this bottom set of changes. It seems to me that we should just keep the hook, and let it happen at the bottom of run().

Copy link
Contributor Author

@jcassee jcassee Dec 30, 2016

Good question. Initially I kept the hook, but this method is potentially called multiple times from OTPMain. However, I now see that I should not have removed the call to httpServer.shutdown(). Adding a commit that puts it back.

@novalis
Copy link
Collaborator

@novalis novalis commented Dec 30, 2016

Looks good. Please squash these two commits.

@barbeau
Copy link
Collaborator

@barbeau barbeau commented Dec 30, 2016

@novalis novalis merged commit 21c3fc2 into opentripplanner:master Dec 30, 2016
1 check passed
@novalis
Copy link
Collaborator

@novalis novalis commented Dec 30, 2016

Oops, I hadn't noticed that! Neat!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants