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