public abstract class BaseNodeMonitor<T> extends Object
Modifier and Type | Field and Description |
---|---|
protected MonitorConfiguration |
configuration
The configuration of this monitor
|
protected long |
failedAt
The last time this node failed, in ms
|
protected boolean |
isQuarantined
Whether this node is quarantined for unstability
|
protected boolean |
isWorking |
protected static Logger |
log |
protected T |
node
The object representing the monitored node
|
protected long |
respondedAt
The last time this node responded (failed or succeeded), in ms
|
protected long |
succeededAt
The last time this node responded successfully
|
Constructor and Description |
---|
BaseNodeMonitor(boolean internal) |
Modifier and Type | Method and Description |
---|---|
abstract void |
failed(ErrorMessage error)
Called when this node fails.
|
T |
getNode() |
boolean |
isIdle() |
boolean |
isInternal()
Returns whether or not this is monitoring an internal node.
|
boolean |
isQuarantined() |
boolean |
isWorking()
Returns whether this node is currently in a state suitable
for receiving traffic.
|
protected long |
now() |
abstract void |
responded()
Called when a response is received from this node.
|
protected abstract void |
setWorking(boolean working,
String explanation)
Thread-safely changes the state of this node if required
|
protected static Logger log
protected T node
protected boolean isWorking
protected boolean isQuarantined
protected long failedAt
protected long respondedAt
protected long succeededAt
protected MonitorConfiguration configuration
public T getNode()
public boolean isWorking()
public boolean isQuarantined()
public abstract void failed(ErrorMessage error)
error
- a description of the errorpublic abstract void responded()
public boolean isIdle()
protected long now()
protected abstract void setWorking(boolean working, String explanation)
public boolean isInternal()
Copyright © 2018. All rights reserved.