Package com.iizigo

Class JobRescheduler

  • All Implemented Interfaces:
    org.eclipse.core.runtime.jobs.IJobChangeListener

    public class JobRescheduler
    extends java.lang.Object
    implements org.eclipse.core.runtime.jobs.IJobChangeListener
    Class that is used to resquedule all jobs but certain ones. This is used during project loading and workbench start-up.
    Author:
    Christopher Mindus
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void aboutToRun​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
      Reschedules all jobs that are not listed as exceptions.
      void addExceptionJob​(org.eclipse.core.runtime.jobs.Job job)
      Adds a job as exception to what is allowed to run without being rescheduled.
      void awake​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)  
      void done​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
      Called when a job is done (cancel, failure or success).
      static JobRescheduler getRunnningInstance()
      Gets the started instance.
      static void initialize()
      Initializes the rescheduler at startup.
      static boolean isRunning()
      Checks if the rescheduler is started.
      void running​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)  
      void scheduled​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)  
      void sleeping​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)  
      static boolean start​(java.lang.String why, boolean holdBuildJobsOnly)
      Static method to start the job rescheduler.
      static boolean stop()
      Static method to stop the job rescheduler.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • initialize

        public static void initialize()
        Initializes the rescheduler at startup. This method should be called from many threads and as soon as possible. Only one instance can be started anyway.
      • start

        public static boolean start​(java.lang.String why,
                                    boolean holdBuildJobsOnly)
        Static method to start the job rescheduler. 71
        Parameters:
        why - Short description why the rescheduler is needed, e.g. "Startup" or "Project loading".
        holdBuildJobsOnly - Flag to hold build jobs only.
        Returns:
        true for success, false if it cannot be started yet, or if one is already running.
      • isRunning

        public static boolean isRunning()
        Checks if the rescheduler is started.
        Returns:
        true if rescheduler is started, false otherwise.
      • stop

        public static boolean stop()
        Static method to stop the job rescheduler.
        Returns:
        true for success, false if not started.
      • getRunnningInstance

        public static JobRescheduler getRunnningInstance()
        Gets the started instance.
        Returns:
        The started instance of the rescheduler, or null for none.
      • addExceptionJob

        public void addExceptionJob​(org.eclipse.core.runtime.jobs.Job job)
        Adds a job as exception to what is allowed to run without being rescheduled.
        Parameters:
        job - The job to allow even if the rescheduler is active.
      • aboutToRun

        public void aboutToRun​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Reschedules all jobs that are not listed as exceptions.
        Specified by:
        aboutToRun in interface org.eclipse.core.runtime.jobs.IJobChangeListener
        Parameters:
        event - The job change event.
      • done

        public void done​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Called when a job is done (cancel, failure or success).
        Specified by:
        done in interface org.eclipse.core.runtime.jobs.IJobChangeListener
      • awake

        public void awake​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Specified by:
        awake in interface org.eclipse.core.runtime.jobs.IJobChangeListener
      • running

        public void running​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Specified by:
        running in interface org.eclipse.core.runtime.jobs.IJobChangeListener
      • scheduled

        public void scheduled​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Specified by:
        scheduled in interface org.eclipse.core.runtime.jobs.IJobChangeListener
      • sleeping

        public void sleeping​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Specified by:
        sleeping in interface org.eclipse.core.runtime.jobs.IJobChangeListener