Interface BlockingReference<T>

Type Parameters:
T - the referenced type
All Superinterfaces:
Reference<T>

public interface BlockingReference<T> extends Reference<T>
Encapsulates thread-safe reading/writing on an object reference. Analogous to AtomicReference, but uses read/write locks instead of CAS operations.
Author:
Paul Ferraro
  • Method Details

    • writer

      default BlockingReference.Writer<T> writer(T value)
      Returns a thread-safe writer of this reference.
      Parameters:
      value - the target value of this reference
      Returns:
      a thread-safe reader of this reference.
    • writer

      default BlockingReference.Writer<T> writer(Supplier<T> supplier)
      Returns a thread-safe writer of this reference.
      Parameters:
      supplier - supplier of the target value of this reference
      Returns:
      a thread-safe reader of this reference.
    • writer

      BlockingReference.Writer<T> writer(org.wildfly.clustering.function.UnaryOperator<T> updater)
      Returns a thread-safe writer of this reference.
      Parameters:
      updater - operator returning the target value of this reference based on the current value
      Returns:
      a thread-safe reader of this reference.
    • of

      static <T> BlockingReference<T> of(T initialValue)
      Returns a blocking reference with the specified initial value.
      Type Parameters:
      T - the referenced object type
      Parameters:
      initialValue - the initial value of the returned reference
      Returns:
      a blocking reference with the specified initial value.