Enum Class Priority

java.lang.Object
java.lang.Enum<Priority>
ch.tocco.nice2.persist.core.api.exec.Priority
All Implemented Interfaces:
Serializable, Comparable<Priority>, Constable

public enum Priority extends Enum<Priority>
The priority is an indicator for the level at which a ModeWrapper is applied. If many modes exist, the order for applying may be important. The HIGHEST ones are always applied last, while the LOWEST are always applied first. This leads to executing code of lower modes inside a higher mode.

This is important for transactions: If a transaction gets committed, a set of CommitListeners are executed. Thus, if a privileged mode is nested within the transaction, the commit listeners get executed after the privileged mode has been left. If the commit listener code should also be executed within the privileged mode, the transaction must be commited while in privileged mode.

For starting with this, there exist 5 priorities. The transaction mode is by default added with priority LOWER while all security modes (like privileged, runAs etc) are added with priority HIGHER. That allows for adding modes in between (using NORMAL) as well as before or after. Those default priorities can always be overriden temporarily by specifying a priority with the Mode that is used to execute a task.

  • Enum Constant Details

    • LOWEST

      public static final Priority LOWEST
    • LOWER

      public static final Priority LOWER
    • NORMAL

      public static final Priority NORMAL
    • HIGHER

      public static final Priority HIGHER
    • HIGHEST

      public static final Priority HIGHEST
    • EXECUTION_CTX

      public static final Priority EXECUTION_CTX
  • Method Details

    • values

      public static Priority[] 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 Priority 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