Class SimpleDistributedProperty<T extends Serializable>
- java.lang.Object
-
- org.apache.ignite.internal.processors.configuration.distributed.SimpleDistributedProperty<T>
-
- All Implemented Interfaces:
DistributedChangeableProperty<T>,DistributedProperty<T>
- Direct Known Subclasses:
DistributedBooleanProperty,DistributedComparableProperty,DistributedTracingConfiguration
public class SimpleDistributedProperty<T extends Serializable> extends Object implements DistributedChangeableProperty<T>
Wrapper of some serializable property providing ability of change this value across whole cluster.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(DistributePropertyListener<? super T> listener)Stringdescription()Tget()StringgetName()TgetOrDefault(T dfltVal)voidlocalUpdate(Serializable newVal)Update only local value without updating remote cluster.voidonAttached()This property have been attached to processor.voidonReadyForUpdate(@NotNull PropertyUpdateClosure updater)On this property ready to be update on cluster wide.Tparse(String str)static IntegerparseNonNegativeInteger(String val)static LongparseNonNegativeLong(String val)static HashSet<String>parseStringSet(String val)booleanpropagate(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.StringtoString()
-
-
-
Field Detail
-
val
protected volatile T extends Serializable val
Property value.
-
-
Method Detail
-
propagate
public boolean propagate(T newVal) throws IgniteCheckedException
Change value across whole cluster.- Specified by:
propagatein interfaceDistributedProperty<T extends Serializable>- Parameters:
newVal- Value which this property should be changed on.- Returns:
trueif value was successfully updated andfalseif cluster wide update was failed, perhaps some concurrent operation was changed this value in same moment.- Throws:
DetachedPropertyException- If this property have not been attached to processor yet, please callDistributedConfigurationProcessor.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.
-
propagateAsync
public GridFutureAdapter<?> propagateAsync(T newVal) throws IgniteCheckedException
Change value across whole cluster.- Specified by:
propagateAsyncin interfaceDistributedProperty<T extends Serializable>- Parameters:
newVal- Value which this property should be changed on.- Returns:
- Future for update operation.
- Throws:
DetachedPropertyException- If this property have not been attached to processor yet, please callDistributedConfigurationProcessor.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.
-
propagateAsync
public GridFutureAdapter<?> propagateAsync(T expectedVal, T newVal) throws IgniteCheckedException
Change value across whole cluster.- Specified by:
propagateAsyncin interfaceDistributedProperty<T extends Serializable>- Parameters:
expectedVal- Value from which this property should be changed.newVal- Value which this property should be changed on.- Returns:
- Future for update operation.
- Throws:
DetachedPropertyException- If this property have not been attached to processor yet, please callDistributedConfigurationProcessor.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.
-
get
public T get()
- Specified by:
getin interfaceDistributedProperty<T extends Serializable>- Returns:
- Current property value.
-
getOrDefault
public T getOrDefault(T dfltVal)
- Specified by:
getOrDefaultin interfaceDistributedProperty<T extends Serializable>- Parameters:
dfltVal- Default value when current value is null.- Returns:
- Current property value.
-
getName
public String getName()
- Specified by:
getNamein interfaceDistributedProperty<T extends Serializable>- Returns:
- Name of property.
-
description
public String description()
- Specified by:
descriptionin interfaceDistributedProperty<T extends Serializable>- Returns:
- Property description.
-
addListener
public void addListener(DistributePropertyListener<? super T> listener)
- Specified by:
addListenerin interfaceDistributedProperty<T extends Serializable>- Parameters:
listener- Update listener.
-
onAttached
public void onAttached()
This property have been attached to processor.- Specified by:
onAttachedin interfaceDistributedChangeableProperty<T extends Serializable>
-
onReadyForUpdate
public void onReadyForUpdate(@NotNull @NotNull PropertyUpdateClosure updater)On this property ready to be update on cluster wide.- Specified by:
onReadyForUpdatein interfaceDistributedChangeableProperty<T extends Serializable>- Parameters:
updater- Consumer for update value across cluster.
-
localUpdate
public void localUpdate(Serializable newVal)
Update only local value without updating remote cluster.- Specified by:
localUpdatein interfaceDistributedChangeableProperty<T extends Serializable>- Parameters:
newVal- New value.
-
parse
public T parse(String str)
- Specified by:
parsein interfaceDistributedChangeableProperty<T extends Serializable>- Parameters:
str- String representation of the property value.- Returns:
- Property value.
-
parseNonNegativeInteger
public static Integer parseNonNegativeInteger(String val)
- Parameters:
val- String to parse.- Returns:
- Integer value.
-
parseNonNegativeLong
public static Long parseNonNegativeLong(String val)
- Parameters:
val- String to parse.- Returns:
- Long value.
-
-