T
- public abstract class ProMFuture<T>
extends java.lang.Object
implements java.util.concurrent.Future<T>
Constructor and Description |
---|
ProMFuture(java.lang.Class<? extends T> resultClass,
java.lang.String label)
Instantiates a ProMFuture object of the given type and with the given
label.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
protected abstract T |
doInBackground()
This method should be implemented by all subclasses of ProMFuture.
|
protected void |
done()
This method is called by the runnable of this future as soon as the
computation of the result is ready, but before any listeners are notified
of the completion.
|
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
FutureListener.ListenerList |
getFutureListeners()
Returns a ListenerList containing the registered future listeners
|
java.lang.String |
getLabel()
returns the label of this future
|
NameChangeListener.ListenerList |
getNameChangeListeners()
Returns a ListenerList containing the registered name change listeners
|
java.lang.Class<?> |
getReturnType()
The return type of this future.
|
java.lang.Runnable |
getRunnable()
Returns the Runnable representing the execution that needs to be
performed to produce the result of this future.
|
boolean |
isCancelled() |
boolean |
isDone() |
void |
setLabel(java.lang.String label)
Sets the label of this future to the given label and fires name change
events in any registered name change listeners.
|
java.lang.String |
toString()
Return a string representation of this future.
|
public ProMFuture(java.lang.Class<? extends T> resultClass, java.lang.String label)
getRunnable()
method and once executed,
it will execute the doInBackground()
method of this
ProMFuture.
When finished, the done()
method is invoked, after which any
Future listeners are notified that this future is ready.resultClass
- Any type that extends T. However, no subtype of ProMFuture can
be provided.label
- protected void done()
public java.lang.Runnable getRunnable()
public java.lang.Class<?> getReturnType()
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<T>
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.CancellationException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.CancellationException
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException, java.util.concurrent.CancellationException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
java.util.concurrent.CancellationException
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<T>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<T>
protected abstract T doInBackground() throws java.lang.Exception
java.lang.Exception
- This exception should be any exception thrown by the logic of
the underlying method. Note that "wrapper"-Exceptions such as
InvocationTargetException and ExecutionException should be
unwrapped.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getLabel()
public void setLabel(java.lang.String label)
label
- public NameChangeListener.ListenerList getNameChangeListeners()
public FutureListener.ListenerList getFutureListeners()