narendly commented on a change in pull request #846: Make ZKHelixAdmin and 
ZKHelixManager Realm-aware
URL: https://github.com/apache/helix/pull/846#discussion_r389321437
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
 ##########
 @@ -1799,4 +1851,69 @@ private boolean 
validateWeightForResourceConfig(ClusterConfig clusterConfig,
             clusterConfig));
     return true;
   }
+
+  public static class Builder {
+    private String zkAddress;
+    private RealmAwareZkClient.RealmMode realmMode;
+    private RealmAwareZkClient.RealmAwareZkConnectionConfig 
realmAwareZkConnectionConfig;
+    private RealmAwareZkClient.RealmAwareZkClientConfig 
realmAwareZkClientConfig;
+
+    public Builder() {
+    }
+
+    public ZKHelixAdmin.Builder setZkAddress(String zkAddress) {
+      this.zkAddress = zkAddress;
+      return this;
+    }
+
+    public ZKHelixAdmin.Builder setRealmMode(RealmAwareZkClient.RealmMode 
realmMode) {
+      this.realmMode = realmMode;
+      return this;
+    }
+
+    public ZKHelixAdmin.Builder setRealmAwareZkConnectionConfig(
+        RealmAwareZkClient.RealmAwareZkConnectionConfig 
realmAwareZkConnectionConfig) {
+      realmAwareZkConnectionConfig = realmAwareZkConnectionConfig;
+      return this;
+    }
+
+    public ZKHelixAdmin.Builder setRealmAwareZkClientConfig(
+        RealmAwareZkClient.RealmAwareZkClientConfig realmAwareZkClientConfig) {
+      realmAwareZkClientConfig = realmAwareZkClientConfig;
+      return this;
+    }
+
+    public ZKHelixAdmin build() throws Exception {
+      validate();
+      return new ZKHelixAdmin(this);
+    }
+
+    /*
+     * Validates the given parameters before creating an instance of 
ZKHelixAdmin.
+     */
+    private void validate() {
+      // Resolve RealmMode based on other parameters
+      boolean isZkAddressSet = zkAddress != null && !zkAddress.isEmpty();
+      if (realmMode == RealmAwareZkClient.RealmMode.SINGLE_REALM && 
!isZkAddressSet) {
+        throw new HelixException(
+            "ConfigAccessor: RealmMode cannot be single-realm without a valid 
ZkAddress set!");
 
 Review comment:
   This is not configAccessor... lets fix the log?

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to