Enum Class ModelCommitPolicy

java.lang.Object
java.lang.Enum<ModelCommitPolicy>
io.fluxzero.sdk.modeling.ModelCommitPolicy
All Implemented Interfaces:
CommitPolicy, Serializable, Comparable<ModelCommitPolicy>, Constable

public enum ModelCommitPolicy extends Enum<ModelCommitPolicy> implements CommitPolicy
Controls when an automatic independent-model commit starts and when its completion is awaited.

One command produces one atomic model commit, even when it affects multiple models. The policy therefore applies to the complete consistency boundary rather than to every affected model separately. A validation rejection does not fail independent commands sharing the batch, including deferred commits. Model mutations that read provisional state wait for the producing commit, then reevaluate against durable state regardless of that producer's outcome. Each command retains its own validation and commit result. Ordinary handlers that consumed provisional state still require successful producer completion before publishing their result. An abort of the owning batch stops pending batch work but cannot roll back commits already accepted by storage. When tracking owns the commit-before-result completion, its consumer error handler handles a failed command once; batch completion awaits durability and handling without reporting an already handled failure again. With early responses explicitly enabled, deferred commit failures retain their batch-level error handling.

  • Enum Constant Details

    • DEFAULT

      public static final ModelCommitPolicy DEFAULT
      Resolve the policy from model properties and the active Fluxzero defaults version.
    • SYNC_AFTER_HANDLER

      public static final ModelCommitPolicy SYNC_AFTER_HANDLER
      Commit after the model apply handlers and wait before handler completion finishes.
    • ASYNC_AFTER_HANDLER

      public static final ModelCommitPolicy ASYNC_AFTER_HANDLER
      Start the commit after the model apply handlers and await it in the handler completion phase.
    • ASYNC_AFTER_HANDLER_AWAIT_AFTER_BATCH

      public static final ModelCommitPolicy ASYNC_AFTER_HANDLER_AWAIT_AFTER_BATCH
      Start after the model apply handlers and await all started commits at batch completion.
    • SYNC_AFTER_BATCH

      public static final ModelCommitPolicy SYNC_AFTER_BATCH
      Commit at batch completion and process commits in that completion phase sequentially.
    • ASYNC_AFTER_BATCH

      public static final ModelCommitPolicy ASYNC_AFTER_BATCH
      Start commits concurrently at batch completion and await all of them there.
  • Field Details

    • PROPERTY

      public static final String PROPERTY
      Property that overrides DEFAULT for independent models.
      See Also:
    • AWAIT_AFTER_HANDLER_COMMITS_BEFORE_RESULTS_PROPERTY

      public static final String AWAIT_AFTER_HANDLER_COMMITS_BEFORE_RESULTS_PROPERTY
      Controls whether request results wait for commits started after model apply handlers and awaited at batch end.
      See Also:
  • Method Details

    • values

      public static ModelCommitPolicy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ModelCommitPolicy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • commitAfterBatch

      public boolean commitAfterBatch()
      Description copied from interface: CommitPolicy
      Returns whether commits start at batch completion rather than handler completion.
      Specified by:
      commitAfterBatch in interface CommitPolicy
    • awaitAfterBatch

      public boolean awaitAfterBatch()
      Description copied from interface: CommitPolicy
      Returns whether commit completion is awaited at batch completion rather than handler completion.
      Specified by:
      awaitAfterBatch in interface CommitPolicy
    • async

      public boolean async()
      Description copied from interface: CommitPolicy
      Returns whether multiple commits in the same completion phase may run concurrently.
      Specified by:
      async in interface CommitPolicy
    • resolve

      public static ModelCommitPolicy resolve(ModelCommitPolicy declared)
      Resolves a declared policy using the model override property and the independent-model default.

      Independent models were introduced with ASYNC_AFTER_HANDLER_AWAIT_AFTER_BATCH as their default, so this does not depend on the defaults version. ASYNC_AFTER_BATCH remains available as an explicit choice.