Package arez.spy

Enum Class Priority

All Implemented Interfaces:
Serializable, Comparable<Priority>, Constable

public enum Priority extends Enum<Priority>
Enum to control scheduling priority of observers/reactions. Observers with higher priorities will react first. If observers have equal priorities then observers scheduled first will react first. Observers must not depend upon ComputableValue instances with a lower priority otherwise priority is ignored.

A user should be very careful when specifying a HIGH priority as it is possible that the the reaction will be scheduled part way through the process of disposing and/or unlinking one-or-more components. Dispose reactions will often be scheduled with a higher priority but reactions unlinking disposed arez components from remaining arez components. In many cases this may mean invoking Disposable.isDisposed(Object) before accessing arez components.

See Also:
  • Enum Constant Details

    • HIGHEST

      public static final Priority HIGHEST
      Highest priority. This priority should be used when the reaction will dispose other reactive elements (and thus they need not be scheduled).
    • HIGH

      public static final Priority HIGH
      High priority. This priority should be used when the reaction will trigger many downstream reactions.
    • NORMAL

      public static final Priority NORMAL
      Normal priority if not otherwise specified.
    • LOW

      public static final Priority LOW
      Low priority. Usually used to schedule observers that reflect state onto non-reactive application components. i.e. Observers that are used to build html views, perform network operations etc. These reactions are often at low priority to avoid recalculation of dependencies (i.e. ComputableValues) triggering this reaction multiple times within a single reaction round.
    • LOWEST

      public static final Priority LOWEST
      Lowest priority. This is low-priority reactions that reflect onto non-reactive applications. It is also used for (i.e. ComputableValues) that may be unobserved when a LOW priority reaction runs.
  • 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