[GitHub] [helix] dasahcc commented on a change in pull request #745: Add RealmAwareZkClient and RealmAwareZkClientFactory interfaces
dasahcc commented on a change in pull request #745: Add RealmAwareZkClient and RealmAwareZkClientFactory interfaces URL: https://github.com/apache/helix/pull/745#discussion_r379135620 ## File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/api/client/RealmAwareZkClient.java ## @@ -306,48 +326,63 @@ public int hashCode() { } /** - * Configuration for creating a new ZkConnection. + * ZkConnection-related configs for creating an instance of RealmAwareZkClient. */ - class ZkConnectionConfig { -// Connection configs -private final String _zkServers; -private int _sessionTimeout = HelixZkClient.DEFAULT_SESSION_TIMEOUT; + class RealmAwareZkConnectionConfig { +/** + * mode: Which mode the RealmAwareZkClientConfig should be created in + */ +private final MODE _mode; +/** + * zkRealmShardingKey: used to deduce which ZK realm this RealmAwareZkClientConfig should connect to. + * NOTE: this field will be ignored if MODE is MULTI_REALM! + */ +private final String _zkRealmShardingKey; +private int _sessionTimeout = DEFAULT_SESSION_TIMEOUT; -public ZkConnectionConfig(String zkServers) { - _zkServers = zkServers; +public RealmAwareZkConnectionConfig(MODE mode, String zkRealmShardingKey) { + if (mode == null) { +throw new ZkClientException("Mode cannot be null!"); + } + _mode = mode; + _zkRealmShardingKey = zkRealmShardingKey; Review comment: Seemed to me the connection is per zk realm. Then the routing logic should be at Factory layer, right? 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: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org For additional commands, e-mail: reviews-h...@helix.apache.org
[GitHub] [helix] dasahcc commented on a change in pull request #745: Add RealmAwareZkClient and RealmAwareZkClientFactory interfaces
dasahcc commented on a change in pull request #745: Add RealmAwareZkClient and RealmAwareZkClientFactory interfaces URL: https://github.com/apache/helix/pull/745#discussion_r379134999 ## File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/api/client/RealmAwareZkClient.java ## @@ -250,21 +268,22 @@ default long waitForEstablishedSession(long timeout, TimeUnit timeUnit) { * This is for backward compatibility and to avoid breaking the original implementation of * {@link org.apache.helix.zookeeper.zkclient.deprecated.IZkStateListener}. */ - class I0ItecIZkStateListenerHelixImpl - implements org.apache.helix.zookeeper.zkclient.deprecated.IZkStateListener { + class I0ItecIZkStateListenerHelixImpl implements org.apache.helix.zookeeper.zkclient.deprecated.IZkStateListener { Review comment: Shall we remove Helix word? 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: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org For additional commands, e-mail: reviews-h...@helix.apache.org
[GitHub] [helix] dasahcc commented on a change in pull request #745: Add RealmAwareZkClient and RealmAwareZkClientFactory interfaces
dasahcc commented on a change in pull request #745: Add RealmAwareZkClient and RealmAwareZkClientFactory interfaces URL: https://github.com/apache/helix/pull/745#discussion_r379069586 ## File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/api/client/RealmAwareZkClient.java ## @@ -40,7 +41,24 @@ import org.apache.zookeeper.data.Stat; +/** + * The Realm-aware ZkClient interface. + * NOTE: "Realm-aware" does not necessarily mean that the RealmAwareZkClient instance will be connecting to multiple ZK realms. + * On single-realm mode, RealmAwareZkClient will reject requests going out to other ZK realms than the one set at initialization. + * On multi-realm mode, RealmAwareZkClient will connect to multiple ZK realms but will reject EPHEMERAL AccessMode operations. + */ public interface RealmAwareZkClient { + + /** + * Specifies which mode to run this RealmAwareZkClient on. + * + * SINGLE_REALM: CRUD, change subscription, and EPHEMERAL CreateMode are supported. + * MULTI_REALM: CRUD and change subscription are supported. Operations involving EPHEMERAL CreateMode will throw an UnsupportedOperationException. + */ + enum MODE { +SINGLE_REALM, MULTI_REALM Review comment: Make the second one separate line. 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: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org For additional commands, e-mail: reviews-h...@helix.apache.org