Package com.iizigo
Class JobRescheduler
java.lang.Object
com.iizigo.JobRescheduler
- All Implemented Interfaces:
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
Modifier and TypeMethodDescriptionvoid
aboutToRun
(IJobChangeEvent event) Reschedules all jobs that are not listed as exceptions.void
addExceptionJob
(Job job) Adds a job as exception to what is allowed to run without being rescheduled.void
awake
(IJobChangeEvent event) void
done
(IJobChangeEvent event) Called when a job is done (cancel, failure or success).static JobRescheduler
Gets the started instance.static void
Initializes the rescheduler at startup.static boolean
Checks if the rescheduler is started.void
running
(IJobChangeEvent event) void
scheduled
(IJobChangeEvent event) void
sleeping
(IJobChangeEvent event) static boolean
Static method to start the job rescheduler.static boolean
stop()
Static method to stop the job rescheduler.
Method Details
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
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
Gets the started instance.- Returns:
- The started instance of the rescheduler, or null for none.
addExceptionJob
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
Reschedules all jobs that are not listed as exceptions.- Specified by:
aboutToRun
in interfaceIJobChangeListener
- Parameters:
event
- The job change event.
done
Called when a job is done (cancel, failure or success).- Specified by:
done
in interfaceIJobChangeListener
awake
- Specified by:
awake
in interfaceIJobChangeListener
running
- Specified by:
running
in interfaceIJobChangeListener
scheduled
- Specified by:
scheduled
in interfaceIJobChangeListener
sleeping
- Specified by:
sleeping
in interfaceIJobChangeListener