com.caucho.env.health
Class HealthService

java.lang.Object
  extended by com.caucho.env.service.AbstractResinSubSystem
      extended by com.caucho.env.health.HealthService
All Implemented Interfaces:
ResinSubSystem

@Service
public class HealthService
extends AbstractResinSubSystem


Nested Class Summary
protected  class HealthService.HealthCheckScheduler
           
 
Field Summary
static long DEFAULT_SYSTEM_RECHECK_TIMEOUT
           
static java.lang.String METER_PREFIX
           
static int START_PRIORITY
           
 
Fields inherited from interface com.caucho.env.service.ResinSubSystem
START_PRIORITY_CACHE_SERVICE, START_PRIORITY_CLASSLOADER, START_PRIORITY_CLUSTER_SERVICE, START_PRIORITY_DEFAULT, START_PRIORITY_ENV_SYSTEM, START_PRIORITY_NETWORK_CLUSTER
 
Method Summary
<I extends HealthAction>
I
addHealthAction(I action)
           
 void addHealthCheck(HealthCheck healthCheck)
           
 void addLifecycleListener(LifecycleListener listener)
           
 HealthCheckResult checkHealth()
           
 boolean containsHealthCheck(HealthCheck check)
           
static HealthService createAndAddService()
           
 void destroy()
          Destroys the service.
 void executeActions(HealthEvent event)
           
 void fireEvent(HealthEvent event)
           
 void fireEvent(java.lang.String eventName)
           
 int getCriticalCount(HealthCheck check)
           
 long getCriticalStartTime(HealthCheck check)
           
static HealthService getCurrent()
           
 int getCurrentRecheckCount()
           
 long getDelay()
           
 int getFatalCount(HealthCheck check)
           
 long getFatalStartTime(HealthCheck check)
           
<T extends HealthAction>
T
getHealthAction(java.lang.Class<T> cl)
           
 java.util.List<HealthAction> getHealthActions()
           
<T extends HealthAction>
java.util.List<T>
getHealthActions(java.lang.Class<T> cl)
           
<T extends HealthCheck>
T
getHealthCheck(java.lang.Class<T> cl)
           
 java.util.List<HealthCheck> getHealthChecks()
           
<T extends HealthCheck>
java.util.List<T>
getHealthChecks(java.lang.Class<T> cl)
           
 HealthMeter getHealthMeter(HealthCheck healthCheck)
           
 long getLastCheckFinishTime()
           
 long getLastCheckStartTime()
           
 HealthCheckResult getLastResult(HealthCheck healthCheck)
           
 LifecycleState getLifecycleState()
           
 long getPeriod()
           
 int getRecheckMax()
           
 long getRecheckPeriod()
           
 int getStartPriority()
          Returns the start priority of the service, used to determine which services to start first.
 HealthCheckResult getSummaryResult()
           
 long getSystemRecheckTimeout()
           
 int getWarningCount(HealthCheck check)
           
 long getWarningStartTime(HealthCheck check)
           
 boolean isEnabled()
           
 boolean isStartupDelayExpired(long time)
           
 void setDelay(long delay)
           
 void setEnabled(boolean enabled)
           
 void setPeriod(long period)
           
 void setRecheckMax(int recheckMax)
           
 void setRecheckPeriod(long recheckPeriod)
           
 void setSystemRecheckTimeout(long systemRecheckTimeout)
           
 void start()
          Starts the service.
 void stop()
          Stops the service.
 
Methods inherited from class com.caucho.env.service.AbstractResinSubSystem
getStopPriority, preCreate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

START_PRIORITY

public static final int START_PRIORITY
See Also:
Constant Field Values

METER_PREFIX

public static final java.lang.String METER_PREFIX
See Also:
Constant Field Values

DEFAULT_SYSTEM_RECHECK_TIMEOUT

public static final long DEFAULT_SYSTEM_RECHECK_TIMEOUT
See Also:
Constant Field Values
Method Detail

createAndAddService

public static HealthService createAndAddService()

getCurrent

public static HealthService getCurrent()

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)

getDelay

public long getDelay()

setDelay

public void setDelay(long delay)

getPeriod

public long getPeriod()

setPeriod

public void setPeriod(long period)

getRecheckPeriod

public long getRecheckPeriod()

setRecheckPeriod

public void setRecheckPeriod(long recheckPeriod)

getRecheckMax

public int getRecheckMax()

setRecheckMax

public void setRecheckMax(int recheckMax)

setSystemRecheckTimeout

public void setSystemRecheckTimeout(long systemRecheckTimeout)

getSystemRecheckTimeout

public long getSystemRecheckTimeout()

addHealthCheck

public void addHealthCheck(HealthCheck healthCheck)

getHealthCheck

public <T extends HealthCheck> T getHealthCheck(java.lang.Class<T> cl)

getHealthChecks

public <T extends HealthCheck> java.util.List<T> getHealthChecks(java.lang.Class<T> cl)

containsHealthCheck

public boolean containsHealthCheck(HealthCheck check)

getHealthChecks

public java.util.List<HealthCheck> getHealthChecks()

addHealthAction

public <I extends HealthAction> I addHealthAction(I action)

getHealthAction

public <T extends HealthAction> T getHealthAction(java.lang.Class<T> cl)

getHealthActions

public <T extends HealthAction> java.util.List<T> getHealthActions(java.lang.Class<T> cl)

getHealthActions

public java.util.List<HealthAction> getHealthActions()

getLifecycleState

public LifecycleState getLifecycleState()

addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)

getStartPriority

public int getStartPriority()
Description copied from interface: ResinSubSystem
Returns the start priority of the service, used to determine which services to start first.

Specified by:
getStartPriority in interface ResinSubSystem
Overrides:
getStartPriority in class AbstractResinSubSystem

start

public void start()
Description copied from interface: ResinSubSystem
Starts the service.

Specified by:
start in interface ResinSubSystem
Overrides:
start in class AbstractResinSubSystem

stop

public void stop()
Description copied from interface: ResinSubSystem
Stops the service.

Specified by:
stop in interface ResinSubSystem
Overrides:
stop in class AbstractResinSubSystem

destroy

public void destroy()
Description copied from interface: ResinSubSystem
Destroys the service.

Specified by:
destroy in interface ResinSubSystem
Overrides:
destroy in class AbstractResinSubSystem

getLastResult

public HealthCheckResult getLastResult(HealthCheck healthCheck)

getLastCheckStartTime

public long getLastCheckStartTime()

getLastCheckFinishTime

public long getLastCheckFinishTime()

getCurrentRecheckCount

public int getCurrentRecheckCount()

getSummaryResult

public HealthCheckResult getSummaryResult()

getHealthMeter

public HealthMeter getHealthMeter(HealthCheck healthCheck)

isStartupDelayExpired

public boolean isStartupDelayExpired(long time)

checkHealth

public HealthCheckResult checkHealth()

getWarningStartTime

public long getWarningStartTime(HealthCheck check)

getCriticalStartTime

public long getCriticalStartTime(HealthCheck check)

getFatalStartTime

public long getFatalStartTime(HealthCheck check)

getWarningCount

public int getWarningCount(HealthCheck check)

getCriticalCount

public int getCriticalCount(HealthCheck check)

getFatalCount

public int getFatalCount(HealthCheck check)

fireEvent

public void fireEvent(java.lang.String eventName)

fireEvent

public void fireEvent(HealthEvent event)

executeActions

public void executeActions(HealthEvent event)