JavaScript is disabled on your browser.
Skip navigation links
  • Summary:
  • Nested |
  • Field |
  • Constr |
  • Method
  • Detail:
  • Field |
  • Constr |
  • Method
org.codefx.libfx.concurrent.when

Class ExecuteAlwaysWhen<T>

  • Type Parameters:
    T - the type the observed ObservableValue's wraps


    public class ExecuteAlwaysWhen<T>
    extends Object 
    Executes an action when an ObservableValue's value fulfills a certain condition.

    The action will not be executed before executeWhen() is called. The action is executed every time the value passes the condition. If this can happen in parallel in several threads, the action must be thread-safe as no further synchronization is provided by this class. Further execution can be prevented by calling cancel().

    This class guarantees that regardless of the way different threads interact with the ObservableValue the action will be executed...

    • ... once during executeWhen() if either the observable's initial value or one it was changed to passes the condition
    • ... every time a new value passes the condition after executeWhen() returns
    If the observable is manipulated by several threads during executeWhen(), this class does not guarantee that the first value to pass the condition is the one handed to the action. Depending on the interaction of those threads it might be the initial value or one of several which were set by those threads.

    Use ExecuteWhen to build an instance of this class.

    • Method Detail

      • executeWhen

        public void executeWhen()
         throws IllegalStateException 
        Executes the action (every time) when the observable's value passes the condition.

        This is a one way function that must only be called once. Calling it again throws an IllegalStateException.

        Call cancel() to prevent further execution.

        Throws:
        IllegalStateException - if this method is called more than once
      • cancel

        public void cancel()
        Cancels the future execution of the action. If executeWhen() was not yet called or the action was already executed, this is a no-op.
Skip navigation links
  • Summary:
  • Nested |
  • Field |
  • Constr |
  • Method
  • Detail:
  • Field |
  • Constr |
  • Method

This documentation is licensed under CC-BY 4.0, attributed to Nicolai Parlog from CodeFX.

AltStyle によって変換されたページ (->オリジナル) /