Hi,

I thought a bit more about the SLING-3278 HealthCheckExecutor service,
and a fluent interface might be useful:

interface HealthCheckExecutor {
 /** Select all HealthChecks for execution */
 HealthCheckContext all();

 /** Select a single HealthCheck for execution */
 HealthCheckContext for(HealthCheck hc);

 /** Select HealthChecks by tag for execution */
HealthCheckContext forTags(String ...tags);
}

/** Context holds execution options and triggers the actual execution */
interface HealthCheckContext {
  void withTimeout(int timeout, TimeUnits units);
  void clearCache();
  AggregatedResult getResult();
  List<Result> getAllResults();
}

Which allows for writing things like

  executor.all().getAllResults();
  executor.for(hc).getResult();

  executor
    .forTags("foo", "-bar")
    .withTimeout(5, TimeUnit.SECONDS)
    .getResult();

  // Clear cache before execution
  executor.forTags("security").clearCache().getAllResults();

  // Clear all cached Results
  executor.all().clearCache();

AggregatedResult extends Result with a List<Result> getResults()
method. Its status is the highest of the aggregated statuses, and its
log is the concatenation of all individual logs.

WDYT?
-Bertrand

Reply via email to