com.espertech.esper.metrics.codahale_metrics.metrics.core
Class HealthCheck

java.lang.Object
  extended by com.espertech.esper.metrics.codahale_metrics.metrics.core.HealthCheck
Direct Known Subclasses:
DeadlockHealthCheck

public abstract class HealthCheck
extends java.lang.Object

A health check for a component of your application.


Nested Class Summary
static class HealthCheck.Result
          The result of a HealthCheck being run.
 
Constructor Summary
protected HealthCheck(java.lang.String name)
          Create a new HealthCheck instance with the given name.
 
Method Summary
protected abstract  HealthCheck.Result check()
          Perform a check of the application component.
 HealthCheck.Result execute()
          Executes the health check, catching and handling any exceptions raised by check().
 java.lang.String getName()
          Returns the health check's name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HealthCheck

protected HealthCheck(java.lang.String name)
Create a new HealthCheck instance with the given name.

Parameters:
name - the name of the health check (and, ideally, the name of the underlying component the health check tests)
Method Detail

getName

public java.lang.String getName()
Returns the health check's name.

Returns:
the health check's name

check

protected abstract HealthCheck.Result check()
                                     throws java.lang.Exception
Perform a check of the application component.

Returns:
if the component is healthy, a healthy HealthCheck.Result; otherwise, an unhealthy HealthCheck.Result with a descriptive error message or exception
Throws:
java.lang.Exception - if there is an unhandled error during the health check; this will result in a failed health check

execute

public HealthCheck.Result execute()
Executes the health check, catching and handling any exceptions raised by check().

Returns:
if the component is healthy, a healthy HealthCheck.Result; otherwise, an unhealthy HealthCheck.Result with a descriptive error message or exception

© 2006-2016 EsperTech Inc.
All rights reserved.
Visit us at espertech.com