Class TopologyManager

java.lang.Object
org.jppf.client.event.ConnectionPoolListenerAdapter
org.jppf.client.monitoring.topology.TopologyManager
All Implemented Interfaces:
AutoCloseable, EventListener, ConnectionPoolListener

public class TopologyManager extends ConnectionPoolListenerAdapter implements AutoCloseable
Instances of this class discover and maintain a representation of a JPPF grid topology.
Since:
5.0
Author:
Laurent Cohen
  • Constructor Details

    • TopologyManager

      public TopologyManager(TopologyListener... listeners)
      Initialize this topology manager with a new JPPFClient and 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 new JPPFClient and 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

      public TopologyManager(JPPFClient client, TopologyListener... listeners)
      Initialize this topology manager with the specified JPPFClient and 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 specified JPPFClient and 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 specified JPPFClient and 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

      public List<TopologyDriver> getDrivers()
      Get the drivers currently handled.
      Returns:
      a list of TopologyDriver instances.
    • getDriver

      public TopologyDriver getDriver(String uuid)
      Get the driver with the specified uuid.
      Parameters:
      uuid - the uuid of the driver to lookup.
      Returns:
      a TopologyDriver instance.
    • getNodes

      public List<TopologyNode> getNodes()
      Get the nodes currently handled.
      Returns:
      a list of TopologyNode instances.
    • getSlaveNodes

      public List<TopologyNode> getSlaveNodes(String masterNodeUuid)
      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 TopologyNode instances, possibly empty but never null.
      Since:
      6.0
    • getNode

      public TopologyNode getNode(String uuid)
      Get the node with the specified uuid.
      Parameters:
      uuid - the uuid of the driver to lookup.
      Returns:
      a TopologyNode instance.
    • getPeers

      public List<TopologyPeer> getPeers()
      Get the peers currently handled.
      Returns:
      a list of TopologyPeer instances.
    • getPeer

      public TopologyPeer getPeer(String uuid)
      Get the peer with the specified uuid.
      Parameters:
      uuid - the uuid of the driver to lookup.
      Returns:
      a TopologyPeer instance.
    • 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

      public TopologyNode getNodeOrPeer(String uuid)
      Get the node with the psecified uuid.
      Parameters:
      uuid - the uuid of the node to lookup.
      Returns:
      a TopologyNode instance.
    • connectionAdded

      public void connectionAdded(ConnectionPoolEvent event)
      Called when a new connection is created.}
      Specified by:
      connectionAdded in interface ConnectionPoolListener
      Overrides:
      connectionAdded in class ConnectionPoolListenerAdapter
      Parameters:
      event - encapsulates the information about the event.
    • connectionRemoved

      public void connectionRemoved(ConnectionPoolEvent event)
      Called when a connection pool is removed.}
      Specified by:
      connectionRemoved in interface ConnectionPoolListener
      Overrides:
      connectionRemoved in class ConnectionPoolListenerAdapter
      Parameters:
      event - encapsulates the information about the event.
    • addTopologyListener

      public void addTopologyListener(TopologyListener listener)
      Add a topology change listener.
      Parameters:
      listener - the listener to add.
    • removeTopologyListener

      public void removeTopologyListener(TopologyListener listener)
      Remove a topology change listener.
      Parameters:
      listener - the listener to remove.
    • getJPPFClient

      public JPPFClient getJPPFClient()
      Get the JPPF client.
      Returns:
      a JPPFClient object.
    • getNodeFilter

      public org.jppf.management.NodeSelector getNodeFilter()
      Get the node selector used to filter the nodes and associated events.
      Returns:
      a NodeSelector instance.
      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 - a NodeSelector instance.
      Since:
      5.2
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable