Class MCRJobMaster

java.lang.Object
org.mycore.services.queuedjob.MCRJobMaster
All Implemented Interfaces:
Comparable<MCRShutdownHandler.Closeable>, Runnable, MCRShutdownHandler.Closeable

public class MCRJobMaster extends Object implements Runnable, MCRShutdownHandler.Closeable
The master of all MCRJobThreads threads.
Author:
René Adler
  • Method Details

    • getInstance

      public static MCRJobMaster getInstance(Class<? extends MCRJobAction> action)
      Returns an singleton instance of this class.
      Parameters:
      action - the MCRJobAction or null
      Returns:
      the instance of this class
    • isRunning

      public static boolean isRunning(Class<? extends MCRJobAction> action)
      Return if MCRJobMaster is running.
      Returns:
      if is running
    • startMasterThread

      public static void startMasterThread(Class<? extends MCRJobAction> action)
      Starts the local MCRJobMaster. Can be auto started if "MCR.QueuedJob.{?MCRJobAction?.}autostart" is set to true.
    • run

      public void run()
      Starts local threads (MCRJobThread) and gives MCRJob instances to them. Use property "MCR.QueuedJob.JobThreads" to specify how many concurrent threads should be running. "MCR.QueuedJob.activated" can be used activate or deactivate general MCRJob running.
      Specified by:
      run in interface Runnable
    • prepareClose

      public void prepareClose()
      stops transmitting MCRJob to MCRJobThread and prepares shutdown.
      Specified by:
      prepareClose in interface MCRShutdownHandler.Closeable
    • close

      public void close()
      Shuts down this thread and every local threads spawned by run().
      Specified by:
      close in interface MCRShutdownHandler.Closeable
    • getPriority

      public int getPriority()
      Description copied from interface: MCRShutdownHandler.Closeable
      Returns the priority. A Closeable with a higher priority will be closed before a Closeable with a lower priority. Default priority is 5.
      Specified by:
      getPriority in interface MCRShutdownHandler.Closeable
    • getPreLabel

      protected String getPreLabel()
    • getName

      public String getName()
      Returns the name of this job master.
      Returns:
    • getProcessableCollection

      public MCRProcessableCollection getProcessableCollection()
      Returns the processable collection assigned to this job master.
      Returns:
      the processable collection