oracle.ide.inspector.task
Class BackgroundTask<V>
java.lang.Object
oracle.ide.inspector.task.BackgroundTask<V>
- All Implemented Interfaces:
- java.lang.Runnable, java.util.concurrent.Future<V>
public abstract class BackgroundTask<V>
- extends java.lang.Object
- implements java.lang.Runnable, java.util.concurrent.Future<V>
BackgroundTask
Background task class supporting cancellation, completion notification, and
progress notification
Method Summary |
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BackgroundTask
public BackgroundTask()
setProgress
protected void setProgress(int current,
int max)
compute
protected abstract V compute()
throws java.lang.Exception
- Throws:
java.lang.Exception
onCompletion
protected void onCompletion(V result,
java.lang.Throwable exception,
boolean cancelled)
onProgress
protected void onProgress(int current,
int max)
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interface java.util.concurrent.Future<V>
get
public V get()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
- Specified by:
get
in interface java.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
get
public V get(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
- Specified by:
get
in interface java.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface java.util.concurrent.Future<V>
isDone
public boolean isDone()
- Specified by:
isDone
in interface java.util.concurrent.Future<V>
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
Copyright © 1997, 2013, Oracle. All rights reserved.