T - Type of enum.public class DistributedEnumProperty<T extends Enum> extends Object implements DistributedChangeableProperty<T>
| Constructor and Description |
|---|
DistributedEnumProperty(String name,
IgniteClosure<Integer,T> fromOrdinalFunc,
IgniteClosure<T,Integer> toOrdinalFunc,
Class<T> enumCls)
Property constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(DistributePropertyListener<? super T> listener) |
T |
get() |
String |
getName() |
T |
getOrDefault(T dfltVal) |
void |
localUpdate(Serializable newVal)
Update only local value without updating remote cluster.
|
void |
onAttached()
This property have been attached to processor.
|
void |
onReadyForUpdate(@NotNull PropertyUpdateClosure updater)
On this property ready to be update on cluster wide.
|
T |
parse(String str) |
boolean |
propagate(T newVal)
Change value across whole cluster.
|
GridFutureAdapter<?> |
propagateAsync(T newVal)
Change value across whole cluster.
|
GridFutureAdapter<?> |
propagateAsync(T expectedVal,
T newVal)
Change value across whole cluster.
|
String |
toString() |
public DistributedEnumProperty(String name, IgniteClosure<Integer,T> fromOrdinalFunc, IgniteClosure<T,Integer> toOrdinalFunc, Class<T> enumCls)
name - Name of property.fromOrdinalFunc - Function reflects an integer to an enumiration value.toOrdinalFunc - Function converts an enumeration value to an integer.public void onAttached()
onAttached in interface DistributedChangeableProperty<T extends Enum>public void onReadyForUpdate(@NotNull
@NotNull PropertyUpdateClosure updater)
onReadyForUpdate in interface DistributedChangeableProperty<T extends Enum>updater - Consumer for update value across cluster.public void localUpdate(Serializable newVal)
localUpdate in interface DistributedChangeableProperty<T extends Enum>newVal - New value.public boolean propagate(T newVal) throws IgniteCheckedException
propagate in interface DistributedProperty<T extends Enum>newVal - Value which this property should be changed on.true if value was successfully updated and false if cluster wide update was failed,
perhaps some concurrent operation was changed this value in same moment.DetachedPropertyException - If this property have not been attached to processor yet, please call DistributedConfigurationProcessor.registerProperty(DistributedChangeableProperty) before this method.NotWritablePropertyException - If this property don't ready to cluster wide update yet, perhaps cluster is
not active yet.IgniteCheckedException - If failed during cluster wide update.public GridFutureAdapter<?> propagateAsync(T newVal) throws IgniteCheckedException
propagateAsync in interface DistributedProperty<T extends Enum>newVal - Value which this property should be changed on.DetachedPropertyException - If this property have not been attached to processor yet, please call DistributedConfigurationProcessor.registerProperty(DistributedChangeableProperty) before this method.NotWritablePropertyException - If this property don't ready to cluster wide update yet, perhaps cluster is
not active yet.IgniteCheckedException - If failed during cluster wide update.public GridFutureAdapter<?> propagateAsync(T expectedVal, T newVal) throws IgniteCheckedException
propagateAsync in interface DistributedProperty<T extends Enum>expectedVal - Value from which this property should be changed.newVal - Value which this property should be changed on.DetachedPropertyException - If this property have not been attached to processor yet, please call DistributedConfigurationProcessor.registerProperty(DistributedChangeableProperty) before this method.NotWritablePropertyException - If this property don't ready to cluster wide update yet, perhaps cluster is
not active yet.IgniteCheckedException - If failed during cluster wide update.public T get()
get in interface DistributedProperty<T extends Enum>public T getOrDefault(T dfltVal)
getOrDefault in interface DistributedProperty<T extends Enum>dfltVal - Default value when current value is null.public String getName()
getName in interface DistributedProperty<T extends Enum>public void addListener(DistributePropertyListener<? super T> listener)
addListener in interface DistributedProperty<T extends Enum>listener - Update listener.public T parse(String str)
parse in interface DistributedChangeableProperty<T extends Enum>str - String representation of the property value.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023