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

Projects
None yet
3 participants
@jcassee
Contributor

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();

This comment has been minimized.

@novalis

novalis Dec 30, 2016

Collaborator

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().

This comment has been minimized.

@jcassee

jcassee Dec 30, 2016

Contributor

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

This comment has been minimized.

Collaborator

novalis commented Dec 30, 2016

Looks good. Please squash these two commits.

@barbeau

This comment has been minimized.

Collaborator

barbeau commented Dec 30, 2016

@novalis novalis merged commit 21c3fc2 into opentripplanner:master Dec 30, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@novalis

This comment has been minimized.

Collaborator

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