jiajunwang commented on a change in pull request #1295:
URL: https://github.com/apache/helix/pull/1295#discussion_r483227594
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
##########
@@ -222,22 +226,16 @@ protected ZkClient(IZkConnection zkConnection, int
connectionTimeout, long opera
_asyncCallRetryThread.start();
LOG.debug("ZkClient created with _uid {}, _asyncCallRetryThread id {}",
_uid, _asyncCallRetryThread.getId());
- connect(connectionTimeout, this);
-
- // initiate monitor
- try {
- if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null
&& !monitorType
- .isEmpty()) {
- _monitor =
- new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName,
monitorRootPathOnly,
- _eventThread);
- _monitor.register();
- } else {
- LOG.info("ZkClient monitor key or type is not provided. Skip
monitoring.");
- }
- } catch (JMException e) {
- LOG.error("Error in creating ZkClientMonitor", e);
+ if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null &&
!monitorType
+ .isEmpty()) {
+ _monitor =
+ new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName,
monitorRootPathOnly,
+ _eventThread);
Review comment:
1. This is to make the code cleaner. It is a good practice for module
the code that the private method does not refer to the class private fields
directly.
2. The thread monitor is the only one impacted, so if you do the set there,
there should be no problem. Mix everything together is chaotic. Ideally, I
would suggest splitting the ZK client monitor and ZK thread monitor.
----------------------------------------------------------------
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]