somandal commented on code in PR #14894: URL: https://github.com/apache/pinot/pull/14894#discussion_r1928974974
########## pinot-server/src/main/java/org/apache/pinot/server/starter/helix/DefaultClusterConfigChangeHandler.java: ########## @@ -0,0 +1,86 @@ +/** + * 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.pinot.server.starter.helix; + +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import org.apache.helix.HelixManager; +import org.apache.helix.HelixManagerFactory; +import org.apache.helix.InstanceType; +import org.apache.helix.NotificationContext; +import org.apache.helix.api.listeners.BatchMode; +import org.apache.helix.api.listeners.ClusterConfigChangeListener; +import org.apache.helix.model.ClusterConfig; +import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener; +import org.apache.pinot.spi.config.provider.PinotClusterConfigProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +@BatchMode(enabled = false) +public class DefaultClusterConfigChangeHandler implements ClusterConfigChangeListener, PinotClusterConfigProvider { + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultClusterConfigChangeHandler.class); + + private volatile Map<String, String> _properties; + private final Set<PinotClusterConfigChangeListener> _clusterConfigChangeListeners = ConcurrentHashMap.newKeySet(); Review Comment: My thinking was mostly around we only really iterate over the objects added here, so hashcode + equals may not really be required as we don't really expect to do lookups on the set (for which case having the exact object becomes necessary if we don't use overridden hashcode + equals). Only during registration, we check if it was added or not, and that time object check is probably enough. Also, since this just expects generics, it means each listener will need to implement the hashcode + equals separately But on thinking more, as long as the listeners are idempotent, it shouldn't really matter even if we add the same listener twice. So why not simplify it and make it an `ArrayList`? So let me go ahead and make this an `ArrayList` for simplicity. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
