public abstract class BackgroundTask<V> extends Object implements Runnable, Future<V>
Modifier and Type | Class and Description |
---|---|
private class |
BackgroundTask.Computation |
Modifier and Type | Field and Description |
---|---|
private FutureTask<V> |
computation |
Constructor and Description |
---|
BackgroundTask() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
protected abstract V |
compute() |
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
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) |
private final FutureTask<V> computation
public BackgroundTask()
protected void setProgress(int current, int max)
protected void onCompletion(V result, Throwable exception, boolean cancelled)
protected void onProgress(int current, int max)
public boolean cancel(boolean mayInterruptIfRunning)
public V get() throws InterruptedException, ExecutionException
get
in interface Future<V>
InterruptedException
ExecutionException
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<V>
InterruptedException
ExecutionException
TimeoutException
public boolean isCancelled()
isCancelled
in interface Future<V>