Class ProMFuture<T>

java.lang.Object
org.processmining.framework.plugin.ProMFuture<T>
Type Parameters:
T -
All Implemented Interfaces:
Future<T>

public abstract class ProMFuture<T> extends Object implements Future<T>
Class to represent a future on an object.
Author:
bfvdonge
  • Constructor Details

    • ProMFuture

      public ProMFuture(Class<? extends T> resultClass, String label)
      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 the 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.
      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

      public Runnable getRunnable()
      Returns the Runnable representing the execution that needs to be performed to produce the result of this future.
      Returns:
    • getReturnType

      public Class<?> getReturnType()
      The return type of this future.
      Returns:
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      Specified by:
      cancel in interface Future<T>
    • get

      Specified by:
      get in interface Future<T>
      Throws:
      InterruptedException
      ExecutionException
      CancellationException
    • get

      Specified by:
      get in interface Future<T>
      Throws:
      InterruptedException
      ExecutionException
      TimeoutException
      CancellationException
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface Future<T>
    • isDone

      public boolean isDone()
      Specified by:
      isDone in interface Future<T>
    • doInBackground

      protected abstract T doInBackground() throws Exception
      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

      public String toString()
      Return a string representation of this future.
      Overrides:
      toString in class Object
    • getLabel

      public String getLabel()
      returns the label of this future
      Returns:
    • setLabel

      public void setLabel(String label)
      Sets the label of this future to the given label and fires name change events in any registered name change listeners.
      Parameters:
      label -
    • getNameChangeListeners

      public NameChangeListener.ListenerList getNameChangeListeners()
      Returns a ListenerList containing the registered name change listeners
      Returns:
    • getFutureListeners

      public FutureListener.ListenerList getFutureListeners()
      Returns a ListenerList containing the registered future listeners
      Returns: