use of org.apache.ignite.configuration.ConfigurationReadOnlyException in project ignite-3 by apache.
the class DynamicProperty method update.
/**
* {@inheritDoc}
*/
@Override
public CompletableFuture<Void> update(T newValue) {
Objects.requireNonNull(newValue, "Configuration value cannot be null.");
if (listenOnly) {
throw listenOnlyException();
}
if (readOnly) {
throw new ConfigurationReadOnlyException("Read only mode: " + keys);
}
assert keys instanceof RandomAccess;
assert !keys.isEmpty();
ConfigurationSource src = new ConfigurationSource() {
/**
* Current index in the {@code keys}.
*/
private int level = 0;
/**
* {@inheritDoc}
*/
@Override
public void descend(ConstructableTreeNode node) {
assert level < keys.size();
node.construct(keys.get(level++), this, true);
}
/**
* {@inheritDoc}
*/
@Override
public <T> T unwrap(Class<T> clazz) {
assert level == keys.size();
assert clazz.isInstance(newValue);
return clazz.cast(newValue);
}
/**
* {@inheritDoc}
*/
@Override
public void reset() {
level = 0;
}
};
// Use resulting tree as update request for the storage.
return changer.change(src);
}
Aggregations