Class ProMFuture<T>
java.lang.Object
org.processmining.framework.plugin.ProMFuture<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
Future<T>
Class to represent a future on an object.
- Author:
- bfvdonge
-
Constructor Summary
ConstructorsConstructorDescriptionProMFuture
(Class<? extends T> resultClass, String label) Instantiates a ProMFuture object of the given type and with the given label. -
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel
(boolean mayInterruptIfRunning) protected abstract T
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.get()
Returns a ListenerList containing the registered future listenersgetLabel()
returns the label of this futureReturns a ListenerList containing the registered name change listenersClass<?>
The return type of this future.Returns the Runnable representing the execution that needs to be performed to produce the result of this future.boolean
boolean
isDone()
void
Sets the label of this future to the given label and fires name change events in any registered name change listeners.toString()
Return a string representation of this future.
-
Constructor Details
-
ProMFuture
Instantiates a ProMFuture object of the given type and with the given label. A SwingWorker is instantiated by the constructor. This SwingWorker is provided through thegetRunnable()
method and once executed, it will execute thedoInBackground()
method of this ProMFuture. When finished, thedone()
method is invoked, after which any Future listeners are notified that this future is ready.- Parameters:
resultClass
- Any type that extends T. However, no subtype of ProMFuture can be provided.label
-
-
-
Method Details
-
done
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. Any overriding implementation can use the get() method to return the object computed, as this method is guaranteed not to throw exceptions when done() is reached. -
getRunnable
Returns the Runnable representing the execution that needs to be performed to produce the result of this future.- Returns:
-
getReturnType
The return type of this future.- Returns:
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
get
- Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
CancellationException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException, CancellationException - Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
TimeoutException
CancellationException
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceFuture<T>
-
isDone
public boolean isDone() -
doInBackground
This method should be implemented by all subclasses of ProMFuture. Here, the object of type T is computed and returned.- Returns:
- Throws:
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.
-
toString
Return a string representation of this future. -
getLabel
returns the label of this future- Returns:
-
setLabel
Sets the label of this future to the given label and fires name change events in any registered name change listeners.- Parameters:
label
-
-
getNameChangeListeners
Returns a ListenerList containing the registered name change listeners- Returns:
-
getFutureListeners
Returns a ListenerList containing the registered future listeners- Returns:
-