Interface ChangeSetContextRunner


public interface ChangeSetContextRunner
  • Method Details

    • markTransactional

      ChangeSetContextRunner markTransactional()
      Eagerly marks the ChangeSetContext as transactional (see ChangeSetContext.markTransactional()). Transactional ChangeSetContexts ensure to allocate transactions and corresponding resources (e.g. SQL connections), upon first interaction with a transactional data sources. Those resources are released only after closing the ChangeSetContext. A transactional data source might mark the ChangeSetContext as transactional, if it requires a transaction (e.g. when executing a CqnInsert, CqnUpdate, CqnDelete or CqnSelect with locks). ChangeSetContext that are not marked transactional allow transactional data sources to free resources earlier, e.g. after each interaction. For example in case of JDBC data sources, SQL connections can be returned to the connection pool after executing a CqnSelect without locks. In that case they are not required to be kept for the entire ChangeSetContext scope. Once a ChangeSetContext is marked as transactional it can't be unmarked again.
      Returns:
      the ChangeSetContextRunner
    • run

      <T> T run(Function<ChangeSetContext,T> changeSetHandler)
      Opens a ChangeSetContext and runs the given handler within its scope. The ChangeSetContext marks a scope in which all opened transactions etc. are committed cancelled together. Note that single transactions may fail during commit but others might be successful.

      The ChangeSetContext will be propagated to all EventContext instances in the service call hierarchy.

      Type Parameters:
      T - The type of the response
      Parameters:
      changeSetHandler - The handler for processing the request within the context
      Returns:
      A generic response object of the handler
    • run

      void run(Consumer<ChangeSetContext> changeSetHandler)
      Opens a ChangeSetContext and runs the given handler within its scope. The ChangeSetContext marks a scope in which all opened transactions etc. are committed cancelled together. Note that single transactions may fail during commit but others might be successful.

      The ChangeSetContext will be propagated to all EventContext instances in the service call hierarchy.

      Parameters:
      changeSetHandler - The handler for processing the request within the context