Interface BackgroundJobStatus<T>
-
- Type Parameters:
T-
- All Superinterfaces:
BackgroundJobInfo
- All Known Implementing Classes:
BackgroundJobStatusDecorator
public interface BackgroundJobStatus<T> extends BackgroundJobInfo
A handle on a scheduledBackgroundJob.
This interface extends theBackgroundJobInfocontract by adding methods toabort()orjoin(long)a scheduled job, and to obtain itsresult()once it is done.- Author:
- lukas
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.evolvis.tartools.backgroundjobs.BackgroundJobInfo
BackgroundJobInfo.State
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidabort()Request the cancellation of a job.voidaddJobListener(JobListener l)booleanisCancellationSupported()Whether this job can be canceled.
voidjoin(long timeout)Join the thread executing the job.voidremoveJobListener(JobListener l)Tresult()Obtain the result produced by the job, waiting for its completion if necessary.-
Methods inherited from interface org.evolvis.tartools.backgroundjobs.BackgroundJobInfo
getDescription, getId, getJobClass, getLastModified, getStartTime, getState, getWorkDone, getWorkTotal, isVisible
-
-
-
-
Method Detail
-
abort
void abort()
Request the cancellation of a job.
This will try to interrupt the thread executing the job and it will makeBackgroundJobMonitor.isAborting()return false. Nevertheless it may take some time until the job actually stops whatever it is doing.
-
join
void join(long timeout) throws java.lang.InterruptedException
Join the thread executing the job.- Parameters:
timeout- the maximum number of milliseconds to wait for the job.- Throws:
java.lang.InterruptedException
-
result
T result() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Obtain the result produced by the job, waiting for its completion if necessary.- Returns:
- the result.
- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionException
-
isCancellationSupported
boolean isCancellationSupported()
Whether this job can be canceled.
- Returns:
- a
booleanindicating whether this job can be canceled once its execution has started. - Since:
- 1.21
- See Also:
BackgroundJob.isCancellationSupported()
-
addJobListener
void addJobListener(JobListener l)
-
removeJobListener
void removeJobListener(JobListener l)
-
-