This is an automated email from the ASF dual-hosted git repository. hulee pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/helix.git
commit 28dc1cfbee22797567a056050e9b9f9b5d680e88 Author: Hunter Lee <[email protected]> AuthorDate: Thu Aug 13 16:51:10 2020 -0700 Change UPDATE_ROUTING_DATA_ON_CACHE_MISS and remove unused imports This commit updates the string constant values for UPDATE_ROUTING_DATA_ON_CACHE_MISS so that it's in line with other constants and removes unused imports and unnecessary IOExceptions thrown. --- .../tools/ClusterVerifiers/ZkHelixClusterVerifier.java | 5 ++--- .../helix/zookeeper/constant/RoutingSystemPropertyKeys.java | 2 +- .../helix/zookeeper/impl/client/DedicatedZkClient.java | 2 -- .../apache/helix/zookeeper/impl/client/SharedZkClient.java | 2 -- .../zookeeper/impl/factory/DedicatedZkClientFactory.java | 4 +--- .../helix/zookeeper/impl/factory/SharedZkClientFactory.java | 3 +-- .../apache/helix/zookeeper/routing/RoutingDataManager.java | 13 ++++++++++--- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/ZkHelixClusterVerifier.java b/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/ZkHelixClusterVerifier.java index 98bb835..fe24b3b 100644 --- a/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/ZkHelixClusterVerifier.java +++ b/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/ZkHelixClusterVerifier.java @@ -19,7 +19,6 @@ package org.apache.helix.tools.ClusterVerifiers; * under the License. */ -import java.io.IOException; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; @@ -120,7 +119,7 @@ public abstract class ZkHelixClusterVerifier new RealmAwareZkClient.RealmAwareZkClientConfig(); _zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(connectionConfigBuilder.build(), clientConfig); - } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { + } catch (InvalidRoutingDataException | IllegalStateException e) { // Note: IllegalStateException is for HttpRoutingDataReader if MSDS endpoint cannot be // found throw new HelixException("ZkHelixClusterVerifier: failed to create ZkClient!", e); @@ -375,7 +374,7 @@ public abstract class ZkHelixClusterVerifier // First, try to create a RealmAwareZkClient that's a DedicatedZkClient return DedicatedZkClientFactory.getInstance() .buildZkClient(connectionConfig, clientConfig); - } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { + } catch (InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("ZkHelixClusterVerifier: failed to create ZkClient!", e); } } else { diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/constant/RoutingSystemPropertyKeys.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/constant/RoutingSystemPropertyKeys.java index e22ad08..12fd023 100644 --- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/constant/RoutingSystemPropertyKeys.java +++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/constant/RoutingSystemPropertyKeys.java @@ -29,7 +29,7 @@ public class RoutingSystemPropertyKeys { * re-read the routing data from the routing data source upon ZK path sharding key cache miss. */ public static final String UPDATE_ROUTING_DATA_ON_CACHE_MISS = - "update.routing.data.on.cache.miss.enabled"; + "routing.data.update.on.cache.miss.enabled"; /** * The interval to use between routing data updates from the routing data source. diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/DedicatedZkClient.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/DedicatedZkClient.java index cc37853..74ff0ad 100644 --- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/DedicatedZkClient.java +++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/DedicatedZkClient.java @@ -27,8 +27,6 @@ import org.apache.helix.msdcommon.datamodel.MetadataStoreRoutingData; import org.apache.helix.msdcommon.exception.InvalidRoutingDataException; import org.apache.helix.zookeeper.api.client.ChildrenSubscribeResult; import org.apache.helix.zookeeper.api.client.RealmAwareZkClient; -import org.apache.helix.zookeeper.constant.RoutingDataReaderType; -import org.apache.helix.zookeeper.routing.RoutingDataManager; import org.apache.helix.zookeeper.zkclient.DataUpdater; import org.apache.helix.zookeeper.zkclient.IZkChildListener; import org.apache.helix.zookeeper.zkclient.IZkConnection; diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/SharedZkClient.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/SharedZkClient.java index bcc4b12..7f529d2 100644 --- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/SharedZkClient.java +++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/SharedZkClient.java @@ -28,9 +28,7 @@ import org.apache.helix.msdcommon.exception.InvalidRoutingDataException; import org.apache.helix.zookeeper.api.client.ChildrenSubscribeResult; import org.apache.helix.zookeeper.api.client.HelixZkClient; import org.apache.helix.zookeeper.api.client.RealmAwareZkClient; -import org.apache.helix.zookeeper.constant.RoutingDataReaderType; import org.apache.helix.zookeeper.impl.factory.SharedZkClientFactory; -import org.apache.helix.zookeeper.routing.RoutingDataManager; import org.apache.helix.zookeeper.zkclient.DataUpdater; import org.apache.helix.zookeeper.zkclient.IZkChildListener; import org.apache.helix.zookeeper.zkclient.IZkDataListener; diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/factory/DedicatedZkClientFactory.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/factory/DedicatedZkClientFactory.java index 2417584..bbccd22 100644 --- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/factory/DedicatedZkClientFactory.java +++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/factory/DedicatedZkClientFactory.java @@ -19,8 +19,6 @@ package org.apache.helix.zookeeper.impl.factory; * under the License. */ -import java.io.IOException; - import org.apache.helix.msdcommon.exception.InvalidRoutingDataException; import org.apache.helix.zookeeper.api.client.HelixZkClient; import org.apache.helix.zookeeper.api.client.RealmAwareZkClient; @@ -40,7 +38,7 @@ public class DedicatedZkClientFactory extends HelixZkClientFactory { public RealmAwareZkClient buildZkClient( RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig, RealmAwareZkClient.RealmAwareZkClientConfig clientConfig) - throws IOException, InvalidRoutingDataException { + throws InvalidRoutingDataException { return new DedicatedZkClient(connectionConfig, clientConfig); } diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/factory/SharedZkClientFactory.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/factory/SharedZkClientFactory.java index 8cb8f33..e3cbf5d 100644 --- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/factory/SharedZkClientFactory.java +++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/factory/SharedZkClientFactory.java @@ -19,7 +19,6 @@ package org.apache.helix.zookeeper.impl.factory; * under the License. */ -import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -60,7 +59,7 @@ public class SharedZkClientFactory extends HelixZkClientFactory { public RealmAwareZkClient buildZkClient( RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig, RealmAwareZkClient.RealmAwareZkClientConfig clientConfig) - throws IOException, InvalidRoutingDataException { + throws InvalidRoutingDataException { // Note, the logic sharing connectionManager logic is inside SharedZkClient, similar to innerSharedZkClient. return new SharedZkClient(connectionConfig, clientConfig); } diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/routing/RoutingDataManager.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/routing/RoutingDataManager.java index 853bd5c..2afd62c 100644 --- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/routing/RoutingDataManager.java +++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/routing/RoutingDataManager.java @@ -30,6 +30,9 @@ import org.apache.helix.msdcommon.datamodel.TrieRoutingData; import org.apache.helix.msdcommon.exception.InvalidRoutingDataException; import org.apache.helix.zookeeper.constant.RoutingDataReaderType; import org.apache.helix.zookeeper.exception.MultiZkException; +import org.apache.helix.zookeeper.impl.client.SharedZkClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -39,6 +42,8 @@ import org.apache.helix.zookeeper.exception.MultiZkException; * 3. provides public methods for reading routing data from various sources (configurable) */ public class RoutingDataManager { + private static Logger LOG = LoggerFactory.getLogger(RoutingDataManager.class); + /** HTTP call to MSDS is used to fetch routing data by default */ private String _defaultMsdsEndpoint = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_ENDPOINT_KEY); @@ -188,9 +193,11 @@ public class RoutingDataManager { try { return (RoutingDataReader) Class.forName(routingDataReaderType.getClassName()).newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { - throw new MultiZkException( - "RoutingDataManager: failed to instantiate RoutingDataReader! RoutingDataReaderType: " - + routingDataReaderType, e); + String errMsg = + "RoutingDataManager::resolveRoutingDataReader: failed to instantiate RoutingDataReader! " + + "RoutingDataReaderType: " + routingDataReaderType; + LOG.error(errMsg, e); + throw new MultiZkException(errMsg, e); } }
