sashapolo commented on a change in pull request #76: URL: https://github.com/apache/ignite-3/pull/76#discussion_r605464182
########## File path: modules/configuration/src/main/java/org/apache/ignite/configuration/internal/util/ConfigurationNotificationsUtil.java ########## @@ -0,0 +1,184 @@ +/* + * 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.configuration.internal.util; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; +import org.apache.ignite.configuration.ConfigurationProperty; +import org.apache.ignite.configuration.internal.DynamicConfiguration; +import org.apache.ignite.configuration.internal.DynamicProperty; +import org.apache.ignite.configuration.internal.NamedListConfiguration; +import org.apache.ignite.configuration.internal.notifications.ConfigurationNotificationEventImpl; +import org.apache.ignite.configuration.notifications.ConfigurationListener; +import org.apache.ignite.configuration.notifications.ConfigurationNotificationEvent; +import org.apache.ignite.configuration.tree.ConfigurationVisitor; +import org.apache.ignite.configuration.tree.InnerNode; +import org.apache.ignite.configuration.tree.NamedListNode; +import org.apache.ignite.configuration.tree.NamedListView; + +import static org.apache.ignite.configuration.internal.util.ConfigurationUtil.innerNodeVisitor; +import static org.apache.ignite.configuration.internal.util.ConfigurationUtil.leafNodeVisitor; +import static org.apache.ignite.configuration.internal.util.ConfigurationUtil.namedListNodeVisitor; + +/** */ +public class ConfigurationNotificationsUtil { + /** + * Recursively notifies all public configuration listeners, accumulating resulting futures in {@code futures} list. + * @param oldInnerNode Old configuration values root. + * @param newInnerNode New configuration values root. + * @param cfgNode Public configuration tree node corresponding to the current inner nodes. + * @param storageRevision Storage revision. + * @param futures Write-only list of futures to accumulate results. + */ + public static void notifyListeners( + InnerNode oldInnerNode, + InnerNode newInnerNode, + DynamicConfiguration<InnerNode, ?, ?> cfgNode, + long storageRevision, + List<CompletableFuture<?>> futures Review comment: You can create a `public` method that will return a `List`, while inside you can call some recursive private methods that will populate this list. This is effectively the same approach, but I think it will make the API cleaner -- 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. For queries about this service, please contact Infrastructure at: [email protected]
