public class ClusterMonitor<T> extends Object
Modifier and Type | Class and Description |
---|---|
private class |
ClusterMonitor.MonitorThread |
Modifier and Type | Field and Description |
---|---|
private MonitorConfiguration |
configuration |
private static Logger |
log |
private ClusterMonitor.MonitorThread |
monitorThread |
private NodeManager<T> |
nodeManager |
private Map<T,BaseNodeMonitor<T>> |
nodeMonitors
A map from Node to corresponding MonitoredNode
|
private boolean |
shutdown |
Constructor and Description |
---|
ClusterMonitor(NodeManager<T> manager) |
ClusterMonitor(NodeManager<T> manager,
String ignored)
Deprecated.
use the constructor with just the first argument instead
|
Modifier and Type | Method and Description |
---|---|
void |
add(T node,
boolean internal)
Adds a new node for monitoring.
|
void |
failed(T node,
ErrorMessage error)
Called from ClusterSearcher/NodeManager when a node failed
|
MonitorConfiguration |
getConfiguration()
Returns the configuration of this cluster monitor
|
BaseNodeMonitor<T> |
getNodeMonitor(T node)
Returns the monitor of the given node, or null if this node has not been added
|
Iterator<BaseNodeMonitor<T>> |
nodeMonitorIterator()
Returns a thread-safe snapshot of the NodeMonitors of all added nodes
|
List<BaseNodeMonitor<T>> |
nodeMonitors()
Returns a thread-safe snapshot of the NodeMonitors of all added nodes
|
void |
ping(Executor executor)
Ping all nodes which needs pinging to discover state changes
|
void |
responded(T node)
Called when a node responded
|
void |
shutdown()
Must be called when this goes out of use
|
private MonitorConfiguration configuration
private static Logger log
private NodeManager<T> nodeManager
private ClusterMonitor.MonitorThread monitorThread
private volatile boolean shutdown
private final Map<T,BaseNodeMonitor<T>> nodeMonitors
@Deprecated public ClusterMonitor(NodeManager<T> manager, String ignored)
public ClusterMonitor(NodeManager<T> manager)
public MonitorConfiguration getConfiguration()
public void add(T node, boolean internal)
node
- the object representing the nodeinternal
- whether or not this node is internal to this clusterpublic BaseNodeMonitor<T> getNodeMonitor(T node)
public void failed(T node, ErrorMessage error)
public void responded(T node)
public void ping(Executor executor)
public Iterator<BaseNodeMonitor<T>> nodeMonitorIterator()
public List<BaseNodeMonitor<T>> nodeMonitors()
public void shutdown()
Copyright © 2018. All rights reserved.