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

Implement destroy() method for graceful shutdown of MetricsStreamServlet #128

Merged
merged 1 commit into from
Mar 20, 2013
Merged

Implement destroy() method for graceful shutdown of MetricsStreamServlet #128

merged 1 commit into from
Mar 20, 2013

Conversation

benjchristensen
Copy link
Contributor

#127

This has NOT been tested but is a possible fix to this issue.

@ogafosir I don't have time to validate this but this is probably what is needed. If you can confirm this works then I can merge it in, or if it doesn't go ahead and implement a valid fix and submit a new pull request.

@cloudbees-pull-request-builder

Hystrix-pull-requests #4 SUCCESS
This pull request looks good

@@ -126,8 +138,15 @@ private void handleRequest(HttpServletRequest request, HttpServletResponse respo
response.getWriter().println("data: " + json + "\n");
}
}

/* shortcut breaking out of loop if we have been destroyed */
if(isDestroyed) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this if really necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's not. I put it there just so destroying wouldn't potentially wait for the Thread.sleep but that's generally 500ms to maybe 2000ms - but someone could theoretically inject a very long delay. That's the only edge case this doesn't gracefully handle (someone putting in a 10000ms delay for example) since we don't interrupt the threads (and we don't track them all) but I don't know that this edge case is a big concern.

Short answer - probably not worth the optimization.

@ogafosir
Copy link

This implementation looks almost identical to mine :-). I will try this out probably tomorrow, and report then

@benjchristensen
Copy link
Contributor Author

Thanks, I'll look for your report back.

@ogafosir
Copy link

Looks good... Problem have disapeared after introduction of this fix.

@benjchristensen
Copy link
Contributor Author

Great, I'll merge it. Thanks for testing and reporting back.

benjchristensen added a commit that referenced this pull request Mar 20, 2013
…s-servlet

Implement destroy() method for graceful shutdown of MetricsStreamServlet
@benjchristensen benjchristensen merged commit b08161e into Netflix:master Mar 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants