alievmirza commented on code in PR #4951: URL: https://github.com/apache/ignite-3/pull/4951#discussion_r1896779914
########## modules/table/src/integrationTest/java/org/apache/ignite/internal/table/distributed/disaster/ItHighAvailablePartitionsRecoveryTest.java: ########## @@ -82,6 +88,21 @@ void testHaRecoveryOfTwoZones() throws InterruptedException { waitAndAssertStableAssignmentsOfPartitionEqualTo(node, table22, PARTITION_IDS, Set.of(node.name())); } + @Test + void testInvaliPartitionResetTimeoutUpdate() { Review Comment: typo ########## modules/configuration-system/src/main/java/org/apache/ignite/internal/configuration/utils/SystemDistributedConfigurationPropertyHolder.java: ########## @@ -0,0 +1,110 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.configuration.utils; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.BiConsumer; +import java.util.function.Function; +import org.apache.ignite.internal.configuration.SystemDistributedConfiguration; +import org.apache.ignite.internal.configuration.SystemDistributedView; +import org.apache.ignite.internal.configuration.SystemPropertyView; + +/** Holder of system distributed configuration property with auto-update and support of external listener. */ +public class SystemDistributedConfigurationPropertyHolder<T> { + /** Configuration property name. */ + private final String propertyName; + + /** Default value. */ + private final T defaultValue; + + /** System distributed configuration. */ + private final SystemDistributedConfiguration systemDistributedConfig; + + /** Current value of target system distributed configuration property. */ + private final AtomicReference<T> currentValue = new AtomicReference<>(); + + /** Listener, which receives (newValue, revision) on every configuration update. */ + private final BiConsumer<T, Long> valueListener; + + /** Converter to translate {@link String} representation of property value to target type. */ + private final Function<String, T> propertyConverter; + + /** + * Constructor. + * + * @param systemDistributedConfig System distributed configuration. + * @param valueListener Listener, which receives (newValue, revision) on every configuration update. + * @param propertyName Configuration property name. + * @param defaultValue Default value. + * @param propertyConverter Converter to translate {@link String} representation of property value to target type. + */ + public SystemDistributedConfigurationPropertyHolder( + SystemDistributedConfiguration systemDistributedConfig, + BiConsumer<T, Long> valueListener, + String propertyName, + T defaultValue, + Function<String, T> propertyConverter + ) { + this.systemDistributedConfig = systemDistributedConfig; + this.valueListener = valueListener; + this.propertyName = propertyName; + this.defaultValue = defaultValue; + this.propertyConverter = propertyConverter; + + systemDistributedConfig.listen(ctx -> { + updateSystemProperties(ctx.newValue(), ctx.storageRevision()); + + return CompletableFuture.completedFuture(null); + }); + } + + /** + * Init property value, but doesn't call the listener. + */ + public void init() { Review Comment: please add a bit more details why we need this init and when it must be called -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org