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

Async health check #973

wants to merge 2 commits into
base: master


None yet
4 participants

tomfitzhenry commented Jul 1, 2016

For issue #609

Proposed API for users is:

HealthCheckRegistry registry = new HealthCheckRegistry();
ScheduledExecutorService e = new ScheduledThreadPoolExecutor(1);
HealthCheck foo = ...
AsyncHealthCheck asyncFoo = new AsyncHealthCheck(foo, 2, TimeUnit.MINUTES);
e.scheduleWithFixedDelay(asyncFoo, 0, 30, TimeUnit.SECONDS);
registry.register("foo", asyncFoo)

In the above example, the ScheduledExecutorService will execute the health checks with 30s delay. The health check will fail if its cached result is older than 2 minutes.

Design choices:

  • Give user control over the async checking, so they can plug it into whatever executor service they have
  • Reads must be quick
  • Detect if the cached result is too old, and allow user to define what too old is

This comment has been minimized.

tomfitzhenry commented Jul 1, 2016

For users that are happy to cede control over the execution of the health check run() methods, perhaps HealthCheckRegister#registerAsync(HealthCheck, int refreshFrequency, TimeUnit refreshFrequencyUnit, int int staleAge, TimeUnit staleAgeUnit) could be added, which managed an internal ScheduledExecutorService

@ryantenney ryantenney closed this Jul 12, 2016

@ryantenney ryantenney reopened this Jul 12, 2016


This comment has been minimized.

vbauer commented Jan 12, 2017

Any about this PR?... We'd like to have async-feature too


This comment has been minimized.


arteam commented Feb 24, 2017

Contributed in #1077

@arteam arteam closed this Feb 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment