Class TopologyManager
java.lang.Object
org.jppf.client.event.ConnectionPoolListenerAdapter
org.jppf.client.monitoring.topology.TopologyManager
- All Implemented Interfaces:
AutoCloseable,EventListener,ConnectionPoolListener
Instances of this class discover and maintain a representation of a JPPF grid topology.
- Since:
- 5.0
- Author:
- Laurent Cohen
-
Constructor Summary
ConstructorsConstructorDescriptionTopologyManager(long topologyRefreshInterval, long jvmHealthRefreshInterval, JPPFClient client, boolean loadSystemInfo, TopologyListener... listeners) Initialize this topology manager with the specifiedJPPFClientand listeners.TopologyManager(long topologyRefreshInterval, long jvmHealthRefreshInterval, JPPFClient client, TopologyListener... listeners) Initialize this topology manager with the specifiedJPPFClientand listeners.TopologyManager(long topologyRefreshInterval, long jvmHealthRefreshInterval, TopologyListener... listeners) Initialize this topology manager with a newJPPFClientand the specified listeners.TopologyManager(JPPFClient client, TopologyListener... listeners) Initialize this topology manager with the specifiedJPPFClientand listeners.TopologyManager(TopologyListener... listeners) Initialize this topology manager with a newJPPFClientand the specified listeners. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTopologyListener(TopologyListener listener) Add a topology change listener.voidclose()voidCalled when a new connection is created.voidCalled when a connection pool is removed.Get the driver with the specified uuid.intGet the number of drivers currently handled.Get the drivers currently handled.Get the JPPF client.Get the node with the specified uuid.intGet the number of nodes currently handled.org.jppf.management.NodeSelectorGet the node selector used to filter the nodes and associated events.getNodeOrPeer(String uuid) Get the node with the psecified uuid.getNodes()Get the nodes currently handled.Get the peer with the specified uuid.intGet the number of peers currently handled.getPeers()Get the peers currently handled.getSlaveNodes(String masterNodeUuid) Get the nodes that are slaves of the specified master node.voidremoveTopologyListener(TopologyListener listener) Remove a topology change listener.voidsetNodeFilter(org.jppf.management.NodeSelector nodeFilter) Set the node selector used to filter the nodes and associated events.Methods inherited from class org.jppf.client.event.ConnectionPoolListenerAdapter
connectionPoolAdded, connectionPoolRemoved
-
Constructor Details
-
TopologyManager
Initialize this topology manager with a newJPPFClientand the specified listeners. The refresh intervals are determined from the configuration, or take a default value of 1000L if they are not configured.- Parameters:
listeners- a set of listeners to subscribe immediately for topology events.
-
TopologyManager
public TopologyManager(long topologyRefreshInterval, long jvmHealthRefreshInterval, TopologyListener... listeners) Initialize this topology manager with a newJPPFClientand the specified listeners.- Parameters:
topologyRefreshInterval- the interval in millis between refreshes of the topology.jvmHealthRefreshInterval- the interval in millis between refreshes of the JVM health data.listeners- a set of listeners to subscribe immediately for topology events.
-
TopologyManager
Initialize this topology manager with the specifiedJPPFClientand listeners. The refresh intervals are determined from the configuration, or take a default value of 1000L if they are not configured.- Parameters:
client- the JPPF client used to discover and monitor the grid topology.listeners- a set of listeners to subscribe immediately for topology events.
-
TopologyManager
public TopologyManager(long topologyRefreshInterval, long jvmHealthRefreshInterval, JPPFClient client, TopologyListener... listeners) Initialize this topology manager with the specifiedJPPFClientand listeners.- Parameters:
topologyRefreshInterval- the interval in millis between refreshes of the topology.jvmHealthRefreshInterval- the interval in millis between refreshes of the JVM health data.client- the JPPF client used to discover and monitor the grid topology.listeners- a set of listeners to subscribe immediately for topology events.
-
TopologyManager
public TopologyManager(long topologyRefreshInterval, long jvmHealthRefreshInterval, JPPFClient client, boolean loadSystemInfo, TopologyListener... listeners) Initialize this topology manager with the specifiedJPPFClientand listeners.- Parameters:
topologyRefreshInterval- the interval in millis between refreshes of the topology.jvmHealthRefreshInterval- the interval in millis between refreshes of the JVM health data.client- the JPPF client used to discover and monitor the grid topology.listeners- a set of listeners to subscribe immediately for topology events.loadSystemInfo- whether the system info of the nodes should be loaded.
-
-
Method Details
-
getDrivers
Get the drivers currently handled.- Returns:
- a list of
TopologyDriverinstances.
-
getDriver
Get the driver with the specified uuid.- Parameters:
uuid- the uuid of the driver to lookup.- Returns:
- a
TopologyDriverinstance.
-
getNodes
Get the nodes currently handled.- Returns:
- a list of
TopologyNodeinstances.
-
getSlaveNodes
Get the nodes that are slaves of the specified master node.- Parameters:
masterNodeUuid- the UUID of the master node whose slaves to lookup.- Returns:
- a list of
TopologyNodeinstances, possibly empty but nevernull. - Since:
- 6.0
-
getNode
Get the node with the specified uuid.- Parameters:
uuid- the uuid of the driver to lookup.- Returns:
- a
TopologyNodeinstance.
-
getPeers
Get the peers currently handled.- Returns:
- a list of
TopologyPeerinstances.
-
getPeer
Get the peer with the specified uuid.- Parameters:
uuid- the uuid of the driver to lookup.- Returns:
- a
TopologyPeerinstance.
-
getDriverCount
public int getDriverCount()Get the number of drivers currently handled.- Returns:
- the number of drivers.
-
getNodeCount
public int getNodeCount()Get the number of nodes currently handled.- Returns:
- the number of nodes.
-
getPeerCount
public int getPeerCount()Get the number of peers currently handled.- Returns:
- the number of peers.
-
getNodeOrPeer
Get the node with the psecified uuid.- Parameters:
uuid- the uuid of the node to lookup.- Returns:
- a
TopologyNodeinstance.
-
connectionAdded
Called when a new connection is created.}- Specified by:
connectionAddedin interfaceConnectionPoolListener- Overrides:
connectionAddedin classConnectionPoolListenerAdapter- Parameters:
event- encapsulates the information about the event.
-
connectionRemoved
Called when a connection pool is removed.}- Specified by:
connectionRemovedin interfaceConnectionPoolListener- Overrides:
connectionRemovedin classConnectionPoolListenerAdapter- Parameters:
event- encapsulates the information about the event.
-
addTopologyListener
Add a topology change listener.- Parameters:
listener- the listener to add.
-
removeTopologyListener
Remove a topology change listener.- Parameters:
listener- the listener to remove.
-
getJPPFClient
Get the JPPF client.- Returns:
- a
JPPFClientobject.
-
getNodeFilter
public org.jppf.management.NodeSelector getNodeFilter()Get the node selector used to filter the nodes and associated events.- Returns:
- a
NodeSelectorinstance. - Since:
- 5.2
-
setNodeFilter
public void setNodeFilter(org.jppf.management.NodeSelector nodeFilter) Set the node selector used to filter the nodes and associated events.- Parameters:
nodeFilter- aNodeSelectorinstance.- Since:
- 5.2
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-