Package de.uka.ipd.sdq.workflow.jobs
Class SequentialJob
java.lang.Object
de.uka.ipd.sdq.workflow.jobs.AbstractJob
de.uka.ipd.sdq.workflow.jobs.AbstractCompositeJob
de.uka.ipd.sdq.workflow.jobs.SequentialJob
- All Implemented Interfaces:
ICompositeJob
,IJob
,Iterable<IJob>
,Collection<IJob>
,List<IJob>
- Direct Known Subclasses:
DynamicSequentialJob
,MWE2SequentialJob
,SequentialBlackboardInteractingJob
,Workflow
Implementation of a composite job that guarantees the execution of it's jobs
in the order they were added.
-
Field Summary
Fields inherited from class de.uka.ipd.sdq.workflow.jobs.AbstractCompositeJob
myExecutedJobs, myJobs
Fields inherited from class de.uka.ipd.sdq.workflow.jobs.AbstractJob
logger
-
Constructor Summary
ConstructorDescriptionInstantiates a new order preserving composite job.SequentialJob
(boolean cleanUpImmediately) Instantiates a new sequential job.SequentialJob
(String name) Instantiates a new order preserving composite job with a specific name.SequentialJob
(String name, boolean cleanUpImmediately) Instantiates a new model workflow job with a specific name and specifying the clean up strategy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup
(IProgressMonitor monitor) If the sequential job is configured to not clean up immediately, the parents behavior is triggered.void
execute
(IProgressMonitor monitor) Executes all contained jobs, i.e.protected void
Executes all contained jobs, and runs their clean up methods when all jobs are finished.protected void
Specialty: Calls cleanup after the execution of each nested job and deletes the reference to that nested job.Methods inherited from class de.uka.ipd.sdq.workflow.jobs.AbstractCompositeJob
add, add, addAll, addAll, addFirst, addJob, addLast, clear, clone, contains, containsAll, descendingIterator, element, equals, get, getFirst, getLast, getName, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeAll, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, retainAll, set, setName, size, subList, toArray, toArray, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Constructor Details
-
SequentialJob
public SequentialJob()Instantiates a new order preserving composite job. -
SequentialJob
Instantiates a new order preserving composite job with a specific name.- Parameters:
name
- The name of the job sequence.
-
SequentialJob
public SequentialJob(boolean cleanUpImmediately) Instantiates a new sequential job.- Parameters:
cleanUpImmediately
- Flag if jobs should be cleaned up immediately or not.
-
SequentialJob
Instantiates a new model workflow job with a specific name and specifying the clean up strategy.- Parameters:
name
- The name of the job sequence.cleanUpImmediately
- Flag if jobs should be cleaned up immediately or not.
-
-
Method Details
-
execute
Executes all contained jobs, i.e. call execute() for them. Contained jobs can thus re-implement this method with functionality that should be executed.- Specified by:
execute
in interfaceIJob
- Specified by:
execute
in classAbstractCompositeJob
- Parameters:
monitor
- the monitor- Throws:
JobFailedException
- the job failed exceptionUserCanceledException
- the user canceled exception
-
executeWithDelayedCleanUp
protected void executeWithDelayedCleanUp(IProgressMonitor monitor) throws JobFailedException, UserCanceledException Executes all contained jobs, and runs their clean up methods when all jobs are finished.- Parameters:
monitor
- the monitor- Throws:
JobFailedException
- the job failed exceptionUserCanceledException
- the user canceled exception
-
executeWithImmediateCleanUp
protected void executeWithImmediateCleanUp(IProgressMonitor monitor) throws JobFailedException, UserCanceledException Specialty: Calls cleanup after the execution of each nested job and deletes the reference to that nested job. Thus, you need to make sure that no later jobs depend on these jobs intermediate results that are deleted during cleanup.- Parameters:
monitor
- The monitor to report the progress to.- Throws:
JobFailedException
- identifies a failed job execution.UserCanceledException
- Identifies a user has canceled the execution of the job.
-
cleanup
If the sequential job is configured to not clean up immediately, the parents behavior is triggered. Otherwise, the clean up has already be done. Clean up all temporary side effects of this job. This method will always be called after executing this job to remove automatically created files and to leave the environment in a state in which the whole workflow run can be started again with the same results (i.e. in which executed can be called again). Usually, cleanup is called after the whole workflow is completed to allow other jobs to use intermediate results. In some cases, cleanup can be called earlier. However, in those cases, later jobs might not be able to access the intermediate data anymore.
This method ensures to clean up all child jobs in the reverse order in which they were added.- Specified by:
cleanup
in interfaceIJob
- Overrides:
cleanup
in classAbstractCompositeJob
- Parameters:
monitor
- the monitor- Throws:
CleanupFailedException
- Thrown if a critical error occurred during clean up so that the whole workflow should abort cleaning up further jobs.
-