narendly commented on a change in pull request #745: Add RealmAwareZkClient and
RealmAwareZkClientFactory interfaces
URL: https://github.com/apache/helix/pull/745#discussion_r379065061
##########
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:
@kaisun2000
I tried that but that is going to break backward-compatibility because of
different return types in the setter methods.
To illustrate:
`public ZkClientConfig setZkSerializer(PathBasedZkSerializer zkSerializer)`
is what we have in HelixZkClient. But if this class extended
RealmAwareZkClientConfig, then it will be returning an instance of
RealmAwareZkClientConfig, which would break the existing methods in Shared and
DedicatedZkClientFactories.
----------------------------------------------------------------
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]