Package org.oddjob.framework.util
Class AsyncExecutionSupport
java.lang.Object
org.oddjob.framework.util.AsyncExecutionSupport
Helper class for things that execute jobs in parallel. This class
ensures that all simultaneous executions are tracked, can be stopped,
can be waited for and allows an action to be run on completion of
all the simultaneous jobs.
- Author:
- rob
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncExecutionSupport(Runnable onCompleteAction, Consumer<? super Throwable> exceptionHandler) Create a new instance. -
Method Summary
-
Constructor Details
-
Method Details
-
submitJob
-
joinOnAllJobs
-
startWatchingJobs
public void startWatchingJobs()Start watching jobs for them to finish executing. -
cancelAllPendingJobs
public void cancelAllPendingJobs()Cancel all pending jobs. This will not stop jobs already executing but will cancel pending jobs. Stopping jobs is left to calling code.Also stop watching executing jobs.
-
reset
public void reset()Reset the internal state so that it can be used again with a new set of jobs. -
size
public int size()The number of simultaneous job currently being tracked.- Returns:
-