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 TypeMethodDescriptionboolean
cancel
(boolean mayInterruptIfRunning) protected abstract V
compute()
get()
boolean
boolean
isDone()
protected void
onCompletion
(V result, Throwable exception, boolean cancelled) protected void
onProgress
(int current, int max) void
run()
protected void
setProgress
(int current, int max) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
get
in interfaceFuture<V>
- Throws:
InterruptedException
ExecutionException
-
get
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<V>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
isCancelled
- Specified by:
isCancelled
in interfaceFuture<V>
-
isDone
-
run
-