Interface IBeanProcess<T>

Type Parameters:
T - the type of bean this process is for
All Superinterfaces:
IPublishable<T>
All Known Implementing Classes:
AbstractLockingPausableProcess, CommandProcess, ScanProcess

public interface IBeanProcess<T> extends IPublishable<T>
A bean process is a process that can be created from a bean which defines it. For example a ScanBean defines a scan process.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Execute the process, if an exception is thrown the process is set to failed and the message is the message of the exception.
    default boolean
     
    boolean
    Returns whether the process is paused.
    void
    Call to pause the running process.
    void
    Call to resume the process.
    default void
    If the process is non-blocking this method will start a thread which calls execute (and the method will return).
    void
    Please provide a termination for the process by implementing this method.

    Methods inherited from interface org.eclipse.scanning.api.event.core.IPublishable

    getBean, getPublisher
  • Method Details

    • execute

      void execute() throws EventException, InterruptedException
      Execute the process, if an exception is thrown the process is set to failed and the message is the message of the exception. This is the blocking method to run the process. The start method will be called by the IJobQueue's consumer thread running the process and by default terminate is called in the same thread.
      Throws:
      Exception
      EventException
      InterruptedException
    • start

      default void start() throws EventException, InterruptedException
      If the process is non-blocking this method will start a thread which calls execute (and the method will return). By default a process blocks until it is done. isBlocking() and start() may be overridden to redefine this.
      Throws:
      EventException
      InterruptedException
    • isBlocking

      default boolean isBlocking()
    • terminate

      void terminate() throws EventException
      Please provide a termination for the process by implementing this method. If the process has a stop file, write it now; if it needs to be killed, get its pid and kill it; if it is running on a cluster, use the qdel or dramaa api.
      Throws:
      EventException
    • pause

      void pause() throws EventException
      Call to pause the running process.
      Throws:
      EventException
    • resume

      void resume() throws EventException
      Call to resume the process.
      Throws:
      EventException
    • isPaused

      boolean isPaused()
      Returns whether the process is paused. If using AbstractLockingPausableProcess, it will be automatically.
      Returns:
      true if the process is paused, false otherwise