Interface ValueDelegate<V>


@Beta
public interface ValueDelegate<V>
Gossip-based value service.
  • Method Summary

    Modifier and Type Method Description
    void addListener​(ValueDelegateEventListener<V> listener)
    Registers the specified listener to be notified whenever the atomic value is updated.
    void close()
    Closes the counter.
    V get()
    Gets the current value.
    V getAndSet​(V value)
    Atomically sets to the given value and returns the old value.
    void removeListener​(ValueDelegateEventListener<V> listener)
    Unregisters the specified listener such that it will no longer receive atomic value update notifications.
    void set​(V value)
    Sets to the given value.
  • Method Details

    • get

      V get()
      Gets the current value.
      Returns:
      current value
    • getAndSet

      V getAndSet​(V value)
      Atomically sets to the given value and returns the old value.
      Parameters:
      value - the new value
      Returns:
      previous value
    • set

      void set​(V value)
      Sets to the given value.
      Parameters:
      value - new value
    • addListener

      void addListener​(ValueDelegateEventListener<V> listener)
      Registers the specified listener to be notified whenever the atomic value is updated.
      Parameters:
      listener - listener to notify about events
    • removeListener

      void removeListener​(ValueDelegateEventListener<V> listener)
      Unregisters the specified listener such that it will no longer receive atomic value update notifications.
      Parameters:
      listener - listener to unregister
    • close

      void close()
      Closes the counter.