From 8bb32602fa6a3ad5fb94e6585b00f3eed699061c Mon Sep 17 00:00:00 2001 From: Yisheng Zhou Date: Wed, 20 Nov 2024 14:25:37 -0800 Subject: [PATCH] Address comments --- .../memq/zookeeper/MemqZookeeperClient.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/orion-server/src/main/java/com/pinterest/orion/core/utils/memq/zookeeper/MemqZookeeperClient.java b/orion-server/src/main/java/com/pinterest/orion/core/utils/memq/zookeeper/MemqZookeeperClient.java index 972586e3..9a72e334 100644 --- a/orion-server/src/main/java/com/pinterest/orion/core/utils/memq/zookeeper/MemqZookeeperClient.java +++ b/orion-server/src/main/java/com/pinterest/orion/core/utils/memq/zookeeper/MemqZookeeperClient.java @@ -11,7 +11,7 @@ public class MemqZookeeperClient { public static final String BROKERS = "/brokers"; public static final String TOPICS = "/topics"; public static final String GOVERNOR = "/governor"; - private boolean refreshZkClientWhenException = true; + private boolean refreshZkClientOnException = true; private String zkUrl; private MemqCluster cluster; private CuratorFramework zkClient; @@ -26,12 +26,12 @@ public MemqZookeeperClient(MemqCluster cluster) throws Exception { } } - public void enableRefreshZkClientWhenException() { - this.refreshZkClientWhenException = true; + public void enableRefreshZkClientOnException() { + this.refreshZkClientOnException = true; } - public void disableRefreshZkClientWhenException() { - this.refreshZkClientWhenException = false; + public void disableRefreshZkClientOnException() { + this.refreshZkClientOnException = false; } /** @@ -61,7 +61,7 @@ public void refreshZkClient() throws Exception { /** * Get the children of a node in Zookeeper. - * When an exception occurs, the Zookeeper client is refreshed and the children are fetched again if the refreshZkClientWhenException flag is set. + * When an exception occurs, the Zookeeper client is refreshed and the children are fetched again if the refreshZkClientOnException flag is set. * @param path The path of the node. * @return List of children node names. * @throws Exception @@ -70,7 +70,7 @@ private List getChildNodes(String path) throws Exception { try { return zkClient.getChildren().forPath(path); } catch (Exception e) { - if (refreshZkClientWhenException) { + if (refreshZkClientOnException) { refreshZkClient(); return zkClient.getChildren().forPath(path); } else { @@ -81,7 +81,7 @@ private List getChildNodes(String path) throws Exception { /** * Get the data of a node in Zookeeper. - * When an exception occurs, the Zookeeper client is refreshed and the data is fetched again if the refreshZkClientWhenException flag is set. + * When an exception occurs, the Zookeeper client is refreshed and the data is fetched again if the refreshZkClientOnException flag is set. * @param path The path of the node. * @return The data of the node as a json string * @throws Exception @@ -90,7 +90,7 @@ private String getNodeData(String path) throws Exception { try { return new String(zkClient.getData().forPath(path)); } catch (Exception e) { - if (refreshZkClientWhenException) { + if (refreshZkClientOnException) { refreshZkClient(); return new String(zkClient.getData().forPath(path)); } else {