T - the target type.public interface SentinelProperty<T>
This class holds current value of the config, and is responsible for informing all PropertyListeners
added on this when the config is updated.
Note that not every updateValue(Object newValue) invocation should inform the listeners, only when
newValue is not Equals to the old value, informing is needed.
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(PropertyListener<T> listener)
Add a
PropertyListener to this SentinelProperty. |
void |
removeListener(PropertyListener<T> listener)
Remove the
PropertyListener on this. |
boolean |
updateValue(T newValue)
Update the
newValue as the current value of this property and inform all PropertyListeners
added on this only when new newValue is not Equals to the old value. |
void addListener(PropertyListener<T> listener)
Add a PropertyListener to this SentinelProperty. After the listener is added,
updateValue(Object) will inform the listener if needed.
This method can invoke multi times to add more than one listeners.
listener - listener to add.void removeListener(PropertyListener<T> listener)
PropertyListener on this. After removing, updateValue(Object)
will not inform the listener.listener - the listener to remove.boolean updateValue(T newValue)
newValue as the current value of this property and inform all PropertyListeners
added on this only when new newValue is not Equals to the old value.newValue - the new value.Copyright © 2019 Alibaba Group. All rights reserved.