Class BlockingBoolean

    • Constructor Detail

      • BlockingBoolean

        public BlockingBoolean​(boolean value)
        Creates a new blocking boolean with the specified value.
        Parameters:
        value - the starting value
    • Method Detail

      • await

        public void await​(boolean value)
                   throws InterruptedException
        Causes the current thread to wait until the boolean equals the specified value unless the thread is interrupted.
        Parameters:
        value - specified value
        Throws:
        InterruptedException - if interrupted while waiting
      • await

        public boolean await​(boolean value,
                             long timeout,
                             TimeUnit unit)
                      throws InterruptedException
        Causes the current thread to wait until the boolean equals the specified value unless the thread is interrupted, or the specified waiting time elapses.
        Parameters:
        value - specified value
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        Returns:
        true if the count reached zero and false if the waiting time elapsed before the count reached zero
        Throws:
        InterruptedException - if interrupted while waiting
      • set

        public void set​(boolean value)
        Sets the value of the blocking boolean.
        Parameters:
        value - new value
      • get

        public boolean get()
        Gets the value of the blocking boolean.
        Returns:
        current value