Class LogicRun

java.lang.Object
com.github.sttk.sabi.LogicRun

public final class LogicRun extends Object
Executes a sequence of Logic units in a non-transactional scope.

A LogicRun is started via LogicRunner.start() or DataAcc.start() and terminated by calling end(). Logic units can be chained with run(Logic), runForce(Logic), and runOrBlock(Logic) to control error propagation across steps.

  • Method Details

    • run

      public <D> LogicRun run(Logic<D> logic)
      Executes the specified Logic if no prior Err has occurred and execution has not been blocked or terminated abnormally.

      If logic throws an Err, it is recorded and reported when end() is called. If an unhandled RuntimeException or Error is thrown, the underlying DataHub is terminated abnormally and the exception or error is rethrown.

      Type Parameters:
      D - the type of data access interface expected by the logic
      Parameters:
      logic - the logic unit to execute
      Returns:
      this LogicRun instance for method chaining
    • runForce

      public <D> LogicRun runForce(Logic<D> logic)
      Executes the specified Logic even if a prior run(Logic) or runForce(Logic) call recorded an Err, provided execution has not been blocked by runOrBlock(Logic), setup did not fail, and the DataHub is not in an abnormal state.
      Type Parameters:
      D - the type of data access interface expected by the logic
      Parameters:
      logic - the logic unit to execute
      Returns:
      this LogicRun instance for method chaining
    • runOrBlock

      public <D> LogicRun runOrBlock(Logic<D> logic)
      Executes the specified Logic if no prior Err has occurred, and blocks all subsequent run(Logic), runForce(Logic), and runOrBlock(Logic) calls in this chain if it throws an Err.
      Type Parameters:
      D - the type of data access interface expected by the logic
      Parameters:
      logic - the logic unit to execute
      Returns:
      this LogicRun instance for method chaining
    • end

      public void end() throws com.github.sttk.errs.Err
      Completes this LogicRun sequence, closing connections created during a top-level run and throwing an Err if setup failed, any chained logic failed, or the DataHub is in an abnormal state.
      Throws:
      com.github.sttk.errs.Err - if local data source setup failed, one or more logic executions threw an Err, or the DataHub is in an abnormal state