Class CompositeBackgroundJob
java.lang.Object
org.evolvis.tartools.backgroundjobs.CompositeBackgroundJob
- All Implemented Interfaces:
BackgroundJob<List<?>>
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDescribe the job.List<?>work(BackgroundJobMonitor monitor) Execute the Job.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.evolvis.tartools.backgroundjobs.BackgroundJob
isCancellationSupported, isVisible
-
Constructor Details
-
CompositeBackgroundJob
-
-
Method Details
-
work
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<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:
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
Description copied from interface:BackgroundJobDescribe the job.- Specified by:
getDescriptionin interfaceBackgroundJob<List<?>>- Returns:
- a human-readable Description of the job.
-