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

(#609) Introducing async health checks #1077

Merged

Conversation

arkigabor
Copy link
Contributor

A backward compatible solution for asynchronous health checks (#609). HealthCheck implementations can be marked with the Async annotation while providing:

  • execution period (mandatory)
  • scheduling type (fixed rate or fixed delay)
  • initial delay before first execution
  • unit of period and delay
  • initial health state until the first result is available

Async checks can be registered the same way regular health checks. On registration the health check registry is wrapping the async health check with a decorator that caches the last result and schedules a periodic execution. This decorator object is put into the underlying map and when its check is invoked it simply returns a cached result. On unregistration the registry cancels the task. To preserve the asynchronous behavior elsewhere the listeners are notified with the async decorator instead of the original health check.

@arteam arteam merged commit 51ab8d7 into dropwizard:3.2-development Feb 24, 2017
@arteam
Copy link
Member

arteam commented Feb 24, 2017

Generally looks good to me. Thanks for your contribution! This could be a very useful feature and using annotations makes it very easy for users to convert a health check to an async health check. My biggest concern is to how correctly shut down a HealthCheckRegistry with async executors. Let me play a little bit with it, maybe I will add a follow-up a PR.

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

Successfully merging this pull request may close these issues.

None yet

2 participants