kaisun2000 commented on a change in pull request #745: Add RealmAwareZkClient
and RealmAwareZkClientFactory interfaces
URL: https://github.com/apache/helix/pull/745#discussion_r379055450
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/api/client/HelixZkClient.java
##########
@@ -19,8 +19,178 @@
* under the License.
*/
+import org.apache.helix.zookeeper.zkclient.serialize.BasicZkSerializer;
+import org.apache.helix.zookeeper.zkclient.serialize.PathBasedZkSerializer;
+import org.apache.helix.zookeeper.zkclient.serialize.SerializableSerializer;
+import org.apache.helix.zookeeper.zkclient.serialize.ZkSerializer;
+
+
/**
+ * Deprecated - please use RealmAwareZkClient instead.
+ *
* HelixZkClient interface that follows the supported API structure of
RealmAwareZkClient.
*/
+@Deprecated
public interface HelixZkClient extends RealmAwareZkClient {
+
+ /**
+ * Deprecated - please use RealmAwareZkClient and
RealmAwareZkConnectionConfig instead.
+ *
+ * Configuration for creating a new ZkConnection.
+ */
+ @Deprecated
+ class ZkConnectionConfig {
+ // Connection configs
+ private final String _zkServers;
+ private int _sessionTimeout = HelixZkClient.DEFAULT_SESSION_TIMEOUT;
+
+ public ZkConnectionConfig(String zkServers) {
+ _zkServers = zkServers;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof HelixZkClient.ZkConnectionConfig)) {
+ return false;
+ }
+ HelixZkClient.ZkConnectionConfig configObj =
(HelixZkClient.ZkConnectionConfig) obj;
+ return (_zkServers == null && configObj._zkServers == null || _zkServers
!= null && _zkServers
+ .equals(configObj._zkServers)) && _sessionTimeout ==
configObj._sessionTimeout;
+ }
+
+ @Override
+ public int hashCode() {
+ return _sessionTimeout * 31 + _zkServers.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return (_zkServers + "_" + _sessionTimeout).replaceAll("[\\W]", "_");
+ }
+
+ public HelixZkClient.ZkConnectionConfig setSessionTimeout(Integer
sessionTimeout) {
+ this._sessionTimeout = sessionTimeout;
+ return this;
+ }
+
+ public String getZkServers() {
+ return _zkServers;
+ }
+
+ public int getSessionTimeout() {
+ return _sessionTimeout;
+ }
+ }
+
+ /**
+ * Deprecated - please use RealmAwareZkClient and RealmAwareZkClientConfig
instead.
+ *
+ * Configuration for creating a new HelixZkClient with serializer and
monitor.
+ */
+ @Deprecated
+ class ZkClientConfig {
Review comment:
Another choice is to let ZkClientConfig inherit
RealmAwareZkClient.RealmAwareZkClientConfig as the implementation of this two
class are implementation are exactly the same. This way, no duplicate code.
What is your take?
----------------------------------------------------------------
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]