Interface Notifier

All Known Implementing Classes:
ConcurrentNotifier, SingleWaiterCooperativeNotifier, SingleWaiterMultiNotifier

public interface Notifier
A Condition-like object, used to block thread(s) for a notification.

Unlike Condition no external locking or synchronization is needed with Notifiers; i.e. clients need not synchronize on this class prior to calling await() or signal(), nor should they use any of the primitive wait() or notify() methods. Note: the Notifiers are expected to be Timeout compatible.*

Author:
cp/mf 2010-06-15
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Wait for a notification.
    void
    await(long cMillis)
    Wait for a notification.
    void
    Notifies the waiting thread(s), waking them up if awaiting.
  • Method Details

    • await

      default void await() throws InterruptedException
      Wait for a notification. Note that spurious wake-ups are possible.
      Throws:
      InterruptedException - if the calling thread is interrupted while it is waiting
    • await

      void await(long cMillis) throws InterruptedException
      Wait for a notification. Note that spurious wake-ups are possible.
      Parameters:
      cMillis - the maximum wait time in milliseconds, or zero for indefinite
      Throws:
      InterruptedException - if the calling thread is interrupted while it is waiting
    • signal

      void signal()
      Notifies the waiting thread(s), waking them up if awaiting.