desaikomal commented on code in PR #2333:
URL: https://github.com/apache/helix/pull/2333#discussion_r1063827101
##########
.github/workflows/Helix-PR-CI.yml:
##########
@@ -1,7 +1,7 @@
name: Helix PR CI
on:
pull_request:
- branches: [ master ]
+ branches: [ master, metaclient ] # TODO: remove side branch
Review Comment:
new to code base, so we have a new branch created for just metaclient?
##########
meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClient.java:
##########
@@ -247,4 +249,56 @@ public boolean[] set(List keys, List values, List version)
{
public List<OpResult> transactionOP(Iterable iterable) {
return null;
}
+
+ /**
+ * A converter class to transform {@link DataChangeListener} to {@link
IZkDataListener}
+ */
+ static class DataListenerConverter implements IZkDataListener {
+ private final DataChangeListener _listener;
+
+ DataListenerConverter(DataChangeListener listener) {
+ _listener = listener;
+ }
+
+ private DataChangeListener.ChangeType convertType(Watcher.Event.EventType
eventType) {
+ switch (eventType) {
+ case NodeCreated: return DataChangeListener.ChangeType.ENTRY_CREATED;
+ case NodeDataChanged: return
DataChangeListener.ChangeType.ENTRY_UPDATE;
+ case NodeDeleted: return DataChangeListener.ChangeType.ENTRY_DELETED;
+ default: throw new IllegalArgumentException("EventType " + eventType +
" is not supported.");
+ }
+ }
+
+ @Override
+ public void handleDataChange(String dataPath, Object data) throws
Exception {
+ throw new UnsupportedOperationException("handleDataChange(String
dataPath, Object data) is not supported.");
+ }
+
+ @Override
+ public void handleDataDeleted(String dataPath) throws Exception {
+ handleDataChange(dataPath, null, Watcher.Event.EventType.NodeDeleted);
+ }
+
+ @Override
+ public void handleDataChange(String dataPath, Object data,
Watcher.Event.EventType eventType) throws Exception {
+ _listener.handleDataChange(dataPath, data, convertType(eventType));
+ }
+
+ @Override
+ public boolean equals(Object o) {
Review Comment:
why do we need this?
##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/ZkClient.java:
##########
@@ -187,6 +197,16 @@ public static class Builder {
String _monitorKey;
String _monitorInstanceName = null;
boolean _monitorRootPathOnly = true;
+ boolean _connectOnInit = true;
+
+ /**
+ * If set true, the client will connect to ZK during initialization.
+ * Otherwise, user has to call connect() method explicitly before talking
to ZK.
+ */
+ public Builder setConnectOnInit(boolean connectOnInit) {
Review Comment:
since this is during init, will this method be of any use?
##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -240,17 +240,18 @@ protected ZkClient(IZkConnection zkConnection, int
connectionTimeout, long opera
LOG.info("ZkClient monitor key or type is not provided. Skip
monitoring.");
}
- connect(connectionTimeout, this);
-
- try {
Review Comment:
why monitoring related code removed?
--
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]