Package edu.wisc.ssec.mcidasv.util
Class BackgroundTask<V>
java.lang.Object
edu.wisc.ssec.mcidasv.util.BackgroundTask<V>
- Direct Known Subclasses:
Submitter
Background task class supporting cancellation, completion notification,
and progress notification. Courtesy of Java Concurrency in Practice,
written by Brian Goetz and Tim Peierls.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) protected abstract Vcompute()get()booleanbooleanisDone()protected voidonCompletion(V result, Throwable exception, boolean cancelled) protected voidonProgress(int current, int max) voidrun()protected voidsetProgress(int current, int max) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Field Details
-
computation
-
-
Constructor Details
-
BackgroundTask
public BackgroundTask()
-
-
Method Details
-
setProgress
-
compute
- Throws:
Exception
-
onCompletion
-
onProgress
-
cancel
-
get
- Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionException
-
get
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
isCancelled
- Specified by:
isCancelledin interfaceFuture<V>
-
isDone
-
run
-