Class BlockingReference.ReferenceWriter<T,V>

java.lang.Object
org.wildfly.clustering.server.util.BlockingReference.ReferenceWriter<T,V>
Type Parameters:
T - the referenced object type
V - the mapped type
All Implemented Interfaces:
Supplier<V>, org.wildfly.clustering.function.Supplier<V>, BlockingReference.Writer<V>
Enclosing interface:
BlockingReference<T>

public static class BlockingReference.ReferenceWriter<T,V> extends Object implements BlockingReference.Writer<V>
A writer implementation for a reference.
Author:
Paul Ferraro
  • Field Summary

    Fields inherited from interface org.wildfly.clustering.function.Supplier

    NULL
  • Method Summary

    Modifier and Type
    Method
    Description
    get()
     
    map(org.wildfly.clustering.function.Function<V,R> mapper)
    Returns a mapped writer, whose mapping function is invoked while holding a lock.
    org.wildfly.clustering.function.Supplier<V>
    when(org.wildfly.clustering.function.Predicate<V> condition)
    Returns a supplier whose Supplier.get() will update the reference only when the specified condition (invoked while holding a lock) is met.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.wildfly.clustering.function.Supplier

    handle, thenAccept, thenApply, thenApplyAsDouble, thenApplyAsInt, thenApplyAsLong, thenTest
  • Method Details

    • get

      public V get()
      Specified by:
      get in interface Supplier<T>
    • map

      public <R> BlockingReference.Writer<R> map(org.wildfly.clustering.function.Function<V,R> mapper)
      Description copied from interface: BlockingReference.Writer
      Returns a mapped writer, whose mapping function is invoked while holding a lock.
      Specified by:
      map in interface BlockingReference.Writer<T>
      Type Parameters:
      R - the type of the mapped writer
      Parameters:
      mapper - a mapping function
      Returns:
      a mapped writer
    • when

      public org.wildfly.clustering.function.Supplier<V> when(org.wildfly.clustering.function.Predicate<V> condition)
      Description copied from interface: BlockingReference.Writer
      Returns a supplier whose Supplier.get() will update the reference only when the specified condition (invoked while holding a lock) is met.
      Specified by:
      when in interface BlockingReference.Writer<T>
      Parameters:
      condition - a condition for which this reference should be updated
      Returns:
      a supplier for updating this reference.