Class CompositeBackgroundJob
- java.lang.Object
-
- org.evolvis.tartools.backgroundjobs.CompositeBackgroundJob
-
- All Implemented Interfaces:
BackgroundJob<java.util.List<?>>
public class CompositeBackgroundJob extends java.lang.Object implements BackgroundJob<java.util.List<?>>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCompositeBackgroundJob.SubJobMonitor
-
Constructor Summary
Constructors Constructor Description CompositeBackgroundJob(java.lang.String description, BackgroundJob<?>... steps)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription()Describe the job.java.util.List<?>work(BackgroundJobMonitor monitor)Execute the Job.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.evolvis.tartools.backgroundjobs.BackgroundJob
isCancellationSupported, isVisible
-
-
-
-
Constructor Detail
-
CompositeBackgroundJob
public CompositeBackgroundJob(java.lang.String description, BackgroundJob<?>... steps)
-
-
Method Detail
-
work
public java.util.List<?> work(BackgroundJobMonitor monitor) throws java.lang.Exception
Description copied from interface:BackgroundJobExecute the Job. This method is typically called by some sort of scheduler. This method should never be called twice on the same instance! While executing, implementations should use theBackgroundJobMonitorto communicate with the scheduler:- Progress should be reported to the
BackgroundJobMonitorthrough theBackgroundJobMonitor.announceTotal(int),BackgroundJobMonitor.reportProgressAbsolute(int)andBackgroundJobMonitor.reportProgressIncrement(int)methods. - All logging should use the
BackgroundJobMonitor.log(org.evolvis.tartools.backgroundjobs.BackgroundJobMonitor.Severity, Object)Method. - Long-running operations should periodically poll the state of the
BackgroundJobMonitor.isAborting()property, to check whether a cancellation was requested. If this is the case, this method should return as quickly as possible. - Implementations can obtain a unique identifier for the current
execution of this job using the
BackgroundJobMonitor.getScheduledJobId()Method.
- Specified by:
workin interfaceBackgroundJob<java.util.List<?>>- Parameters:
monitor- The job monitor that should be used to communicate with the scheduler.- Returns:
- the result produced by this job. Schedulers should ignore the returned value if the job has been aborted before finishing normally.
- Throws:
java.lang.Exception- The scheduler should be prepared to deal with any kind of exception by marking the job as failed.
- Progress should be reported to the
-
getDescription
public java.lang.String getDescription()
Description copied from interface:BackgroundJobDescribe the job.- Specified by:
getDescriptionin interfaceBackgroundJob<java.util.List<?>>- Returns:
- a human-readable Description of the job.
-
-