Class SettableHealthChecker
java.lang.Object
com.linecorp.armeria.common.util.AbstractListenable<HealthChecker>
com.linecorp.armeria.server.healthcheck.SettableHealthChecker
- All Implemented Interfaces:
Listenable<HealthChecker>
,HealthChecker
,ListenableHealthChecker
public final class SettableHealthChecker
extends AbstractListenable<HealthChecker>
implements ListenableHealthChecker
A simple
ListenableHealthChecker
whose state can be set by a caller. This can be used in case server
health should have additional conditions besides the state of the Server
. e.g. it should depend on
the health of a backend.-
Constructor Summary
ConstructorDescriptionConstructs a newSettableHealthChecker
which starts out in a healthy state and can be changed usingsetHealthy(boolean)
.SettableHealthChecker
(boolean isHealthy) Constructs a newSettableHealthChecker
which starts out in the specified health state and can be changed usingsetHealthy(boolean)
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
if and only if theServer
is healthy.protected HealthChecker
Returns the latest value notified before.setHealthy
(boolean isHealthy) Sets if theServer
is healthy or not.toString()
Methods inherited from class com.linecorp.armeria.common.util.AbstractListenable
addListener, addListener, notifyListeners, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.common.util.Listenable
addListener, removeListener
-
Constructor Details
-
SettableHealthChecker
public SettableHealthChecker()Constructs a newSettableHealthChecker
which starts out in a healthy state and can be changed usingsetHealthy(boolean)
. -
SettableHealthChecker
public SettableHealthChecker(boolean isHealthy) Constructs a newSettableHealthChecker
which starts out in the specified health state and can be changed usingsetHealthy(boolean)
.
-
-
Method Details
-
isHealthy
public boolean isHealthy()Description copied from interface:HealthChecker
Returnstrue
if and only if theServer
is healthy.- Specified by:
isHealthy
in interfaceHealthChecker
-
setHealthy
Sets if theServer
is healthy or not. -
latestValue
Description copied from class:AbstractListenable
Returns the latest value notified before.null
if the value has not been initialized yet or the implementation of this class cannot cache it.- Overrides:
latestValue
in classAbstractListenable<HealthChecker>
-
toString
-