Package com.yahoo.search.cluster
Class ClusterMonitor<T>
java.lang.Object
com.yahoo.search.cluster.ClusterMonitor<T>
Monitors of a cluster of remote nodes.
The monitor uses an internal thread for node monitoring.
All public methods of this class are multithread safe.
- Author:
- bratseth
-
Constructor Summary
ConstructorDescriptionClusterMonitor
(NodeManager<T> manager) Deprecated.It is not advised to start the monitoring thread in the constructor.ClusterMonitor
(NodeManager<T> manager, boolean startPingThread) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new node for monitoring.void
failed
(T node, ErrorMessage error) Called from ClusterSearcher/NodeManager when a node failedReturns the configuration of this cluster monitorgetNodeMonitor
(T node) Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in Vespa 8.boolean
isClosed()
Returns a thread-safe snapshot of the NodeMonitors of all added nodesReturns a thread-safe snapshot of the NodeMonitors of all added nodesvoid
Ping all nodes which needs pinging to discover state changesvoid
Called when a node respondedvoid
shutdown()
Must be called when this goes out of usevoid
start()
-
Constructor Details
-
ClusterMonitor
Deprecated.It is not advised to start the monitoring thread in the constructor. Use ClusterMonitor(NodeManager manager, false) and explicit start(). -
ClusterMonitor
-
-
Method Details
-
start
public void start() -
getConfiguration
Returns the configuration of this cluster monitor -
isClosed
public boolean isClosed() -
add
Adds a new node for monitoring. The object representing the node must- Have a sensible toString
- Have a sensible identity (equals and hashCode)
- Parameters:
node
- the object representing the nodeinternal
- whether or not this node is internal to this cluster
-
getNodeMonitor
Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in Vespa 8.Returns the monitor of the given node, or null if this node has not been added -
failed
Called from ClusterSearcher/NodeManager when a node failed -
responded
Called when a node responded -
ping
Ping all nodes which needs pinging to discover state changes -
nodeMonitorIterator
Returns a thread-safe snapshot of the NodeMonitors of all added nodes -
nodeMonitors
Returns a thread-safe snapshot of the NodeMonitors of all added nodes -
shutdown
public void shutdown()Must be called when this goes out of use
-