public abstract class BackgroundTask<V>
extends java.lang.Object
implements java.lang.Runnable, java.util.concurrent.Future<V>
Modifier and Type | Class and Description |
---|---|
static class |
BackgroundTask.Status |
Modifier and Type | Field and Description |
---|---|
protected ProgressReport |
report |
protected BackgroundTask.Status |
status |
Constructor and Description |
---|
BackgroundTask(ProgressReport report) |
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) |
ProgressReport |
getProgressReport() |
BackgroundTask.Status |
getStatus() |
boolean |
isCancelled() |
boolean |
isDone() |
protected void |
onCompletion(V result,
java.lang.Throwable exception,
boolean cancelled,
boolean outOfMemory) |
protected void |
onProgress(int current,
int max) |
void |
run() |
protected void |
setProgressReport(ProgressReport pr) |
void |
setStatus(BackgroundTask.Status v) |
protected volatile BackgroundTask.Status status
protected ProgressReport report
public BackgroundTask(ProgressReport report)
protected void setProgressReport(ProgressReport pr)
public ProgressReport getProgressReport()
protected abstract V compute() throws java.lang.Exception
java.lang.Exception
protected void onCompletion(V result, java.lang.Throwable exception, boolean cancelled, boolean outOfMemory)
public BackgroundTask.Status getStatus()
public void setStatus(BackgroundTask.Status v)
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 boolean isDone()
isDone
in interface java.util.concurrent.Future<V>
public void run()
run
in interface java.lang.Runnable
Copyright 2003 Ralph Freese. All Rights Reserved.