jiajunwang commented on a change in pull request #1295:
URL: https://github.com/apache/helix/pull/1295#discussion_r492425479
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/metric/ZkClientMonitor.java
##########
@@ -38,9 +38,13 @@
import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric;
import org.apache.helix.monitoring.mbeans.exception.MetricException;
import org.apache.helix.zookeeper.zkclient.ZkEventThread;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ZkClientMonitor extends DynamicMBeanProvider {
+ private static final Logger LOG =
LoggerFactory.getLogger(ZkClientMonitor.class);
Review comment:
_logger exists in the super class. There is no need to add a new one
here.
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/metric/ZkClientPathMonitor.java
##########
@@ -32,6 +32,9 @@
import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric;
import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric;
import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric;
+import org.apache.helix.zookeeper.zkclient.ZkClient;
Review comment:
Unnecessary?
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/metric/ZkClientMonitor.java
##########
@@ -109,12 +135,8 @@ public DynamicMBeanProvider register() throws JMException {
doRegister(attributeList, MBEAN_DESCRIPTION,
getObjectName(_monitorType, _monitorKey, _monitorInstanceName));
for (ZkClientPathMonitor.PredefinedPath path :
ZkClientPathMonitor.PredefinedPath.values()) {
- // If monitor root path only, check if the current path is Root.
- // Otherwise, add monitors for every path.
- if (!_monitorRootOnly ||
path.equals(ZkClientPathMonitor.PredefinedPath.Root)) {
- _zkClientPathMonitorMap.put(path,
- new ZkClientPathMonitor(path, _monitorType, _monitorKey,
_monitorInstanceName)
- .register());
+ if (_zkClientPathMonitorMap.get(path) != null) {
+ _zkClientPathMonitorMap.get(path).register();
Review comment:
nit, it could be simpler to be:
_zkClientPathMonitorMap.values().stream().foreach(...);
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/metric/ZkClientPathMonitor.java
##########
@@ -34,6 +34,7 @@
import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric;
+
Review comment:
Unnecessary.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]