Interface StepElement

All Superinterfaces:
ChartElement<StepDefinition>

public interface StepElement extends ChartElement<StepDefinition>
This is the control interface for step elements. It represents the 5 different operations that can be performed on a step:
  • Activate - Start execution
  • Deactivate - A subsequent transition has activated. The step may choose to stop immediately, or finish its work.
  • Pause - The step should stop work, expecting to resume later
  • Resume - The step should continue from where pause left off
  • Cancel - The chart or step has been cancelled, the step should stop execution and clean up.

It is important to understand how chart threading works: Each chart (or branch of a parallel block) has a single control thread. Messages are passed on this thread, and are translated into events that end up calling these functions. In other words, all of these functions are called on the control thread. Therefore, blocking in these functions will block the processing of additional messages on the control thread. This may be desirable, but might also have unintended consequences. For example, if an implementation blocks in activateStep, there is no way that a pauseStep or cancelStep can be called.

To handle this, the implementation can use its own thread management, or take advantage of the StepController passed in to activate and resume. The StepController provides an StepController.executeUntilComplete(com.inductiveautomation.sfc.api.util.PausableFutureStepWork) function that registers future-backed work which holds the chart flow at this step until the work's backing future completes (or the step is paused), without blocking the control thread and without parking a dedicated thread.

  • Method Details

    • activateStep

      default void activateStep(StepController context)
      Activate this step. This method should block until activation is complete.
    • deactivateStep

      default void deactivateStep()
      Deactivate this step. This method should block until deactivation is complete.
    • pauseStep

      default void pauseStep()
      Pause this step. This method should block until pausing is complete.
    • resumeStep

      default void resumeStep(StepController context)
      Resume this step. This method should block until resuming is complete.
    • cancelStep

      default void cancelStep()
      Cancel the step. This method can block until cancellation is complete.