Package util

Class ObjExecutor

All Implemented Interfaces:
Serializable, Runnable

public class ObjExecutor extends Executor
Class for executing an object as a thread.

When the object execution terminates, regardless of whether it terminates successfully or with failure, a listener function is notified, with an identifier of the event that occurred.

Since:
2007.05.02
See Also:
  • Constructor Details

    • ObjExecutor

      public ObjExecutor(Executable obj, ActionListener listener)
      Create an object executor.

      On termination, the listener is notified. The identifier of the action event that is passed to the listener is OK if the object's exec() method terminated successfully, ABORTED if the execution was aborted by a call to the function abort() and FAILURE otherwise.

      Parameters:
      obj - the object to execute as a thread
      listener - the listener to notify on completion
      Since:
      2007.05.03 (Christian Borgelt)
  • Method Details

    • run

      public void run()
      Function for thread execution.
      Specified by:
      run in interface Runnable
      Specified by:
      run in class Executor
      Since:
      2007.05.03 (Christian Borgelt)
    • abort

      public void abort()
      Abort the execution.
      Overrides:
      abort in class Executor
      Since:
      2007.05.02 (Christian Borgelt)
    • getObject

      public Executable getObject()
      Get the object to execute as a thread.
      Returns:
      the object to execute as a thread
      Since:
      2007.05.03 (Christian Borgelt)