Class JobMonitor

All Implemented Interfaces:
AutoCloseable, EventListener, JobMonitoringHandler, TopologyListener

public class JobMonitor extends TopologyListenerAdapter implements JobMonitoringHandler
This class provides a representation of the jobs and corresponding node dispatches executing in a JPPF grid.
Since:
5.1
Author:
Laurent Cohen
  • Constructor Details

    • JobMonitor

      public JobMonitor(TopologyManager topologyManager, JobMonitoringListener... listeners)
      Initialize this job manager with the specified topology manager in IMMEDIATE_NOTFICATIONS mode.
      Parameters:
      topologyManager - the topology manager to use.
      listeners - optional listeners that can be registered immediately with this job monitor.
    • JobMonitor

      public JobMonitor(JobMonitorUpdateMode updateMode, long period, TopologyManager topologyManager, JobMonitoringListener... listeners)
      Initialize this job manager with the specified topology manager and event mode.
      Parameters:
      updateMode - the update mode which determines how job monitoring events are generated.
      period - the interval between publications of updates. This is not used in IMMEDIATE_NOTFICATIONS mode.
      topologyManager - the topology manager to use.
      listeners - optional listeners that can be registered immediately with this job monitor.
  • Method Details

    • getTopologyManager

      public TopologyManager getTopologyManager()
      Get the topology manager associated with this job monitor.
      Returns:
      a TopologyManager object.
    • getJobDriver

      public JobDriver getJobDriver(String driverUuid)
      Get the driver with the specified uuid.
      Parameters:
      driverUuid - the uuid of the driver to retrieve.
      Returns:
      a JobDriver object, or null if there si no such driver.
    • getJobDrivers

      public List<JobDriver> getJobDrivers()
      Get the drivers monitored by this job monitor.
      Returns:
      a list of JobDriver objects.
    • getDriversForJob

      public List<JobDriver> getDriversForJob(String jobUuid)
      Get the drivers to which a job was submitted, either in parallel from the same client, or from one driver to another in a multi-driver topology.
      Parameters:
      jobUuid - the uuid of the job for which to find the drivers.
      Returns:
      a list of JobDriver instances, possibly empty.
    • getAllJobDispatches

      public List<JobDispatch> getAllJobDispatches(String jobUuid)
      Get the dispatches of the specified job accrosss the entire topology. This will return a list of dispatches where the nodes may be attached to more than one server.
      Parameters:
      jobUuid - the uuid of the job for which to find the dispatches.
      Returns:
      a list of JobDispatch instances, possibly empty.
    • addJobMonitoringListener

      public void addJobMonitoringListener(JobMonitoringListener listener)
      Add a listener to the events emitted by this job monitor.
      Parameters:
      listener - the listener to add.
    • removeJobMonitoringListener

      public void removeJobMonitoringListener(JobMonitoringListener listener)
      Remove a listener to the events emitted by this job monitor.
      Parameters:
      listener - the listener to remove.
    • driverAdded

      public void driverAdded(TopologyEvent event)
      Called when a driver is added.
      Specified by:
      driverAdded in interface TopologyListener
      Overrides:
      driverAdded in class TopologyListenerAdapter
      Parameters:
      event - the event encapsulating the change information.
    • driverRemoved

      public void driverRemoved(TopologyEvent event)
      Called when a driver is removed.
      Specified by:
      driverRemoved in interface TopologyListener
      Overrides:
      driverRemoved in class TopologyListenerAdapter
      Parameters:
      event - the event encapsulating the change information.
    • close

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