Interface ValueDelegate<V>
@Beta
public interface ValueDelegate<V>
Gossip-based value service.
-
Method Summary
Modifier and Type Method Description voidaddListener(ValueDelegateEventListener<V> listener)Registers the specified listener to be notified whenever the atomic value is updated.voidclose()Closes the counter.Vget()Gets the current value.VgetAndSet(V value)Atomically sets to the given value and returns the old value.voidremoveListener(ValueDelegateEventListener<V> listener)Unregisters the specified listener such that it will no longer receive atomic value update notifications.voidset(V value)Sets to the given value.
-
Method Details
-
get
V get()Gets the current value.- Returns:
- current value
-
getAndSet
Atomically sets to the given value and returns the old value.- Parameters:
value- the new value- Returns:
- previous value
-
set
Sets to the given value.- Parameters:
value- new value
-
addListener
Registers the specified listener to be notified whenever the atomic value is updated.- Parameters:
listener- listener to notify about events
-
removeListener
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.
-