kaisun2000 commented on a change in pull request #745: [WIP] Create RealmAwareZkClientFactory interface URL: https://github.com/apache/helix/pull/745#discussion_r378599687
########## File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/api/api/client/RealmAwareZkClient.java ########## @@ -305,159 +314,12 @@ public int hashCode() { } } - /** - * Configuration for creating a new ZkConnection. - */ - 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; - } - } - - /** - * Configuration for creating a new RealmAwareZkClient with serializer and monitor. - */ - class ZkClientConfig { - // For client to init the connection - private long _connectInitTimeout = HelixZkClient.DEFAULT_CONNECTION_TIMEOUT; - - // Data access configs - private long _operationRetryTimeout = HelixZkClient.DEFAULT_OPERATION_TIMEOUT; - - // Others - private PathBasedZkSerializer _zkSerializer; - - // Monitoring - private String _monitorType; - private String _monitorKey; - private String _monitorInstanceName = null; - private boolean _monitorRootPathOnly = true; - - public HelixZkClient.ZkClientConfig setZkSerializer(PathBasedZkSerializer zkSerializer) { - this._zkSerializer = zkSerializer; - return this; - } - - public HelixZkClient.ZkClientConfig setZkSerializer(ZkSerializer zkSerializer) { - this._zkSerializer = new BasicZkSerializer(zkSerializer); - return this; - } - - /** - * Used as part of the MBean ObjectName. This item is required for enabling monitoring. - * - * @param monitorType - */ - public HelixZkClient.ZkClientConfig setMonitorType(String monitorType) { - this._monitorType = monitorType; - return this; - } - - /** - * Used as part of the MBean ObjectName. This item is required for enabling monitoring. - * - * @param monitorKey - */ - public HelixZkClient.ZkClientConfig setMonitorKey(String monitorKey) { - this._monitorKey = monitorKey; - return this; - } - - /** - * Used as part of the MBean ObjectName. This item is optional. - * - * @param instanceName - */ - public HelixZkClient.ZkClientConfig setMonitorInstanceName(String instanceName) { - this._monitorInstanceName = instanceName; - return this; - } - - public HelixZkClient.ZkClientConfig setMonitorRootPathOnly(Boolean monitorRootPathOnly) { - this._monitorRootPathOnly = monitorRootPathOnly; - return this; - } - - public HelixZkClient.ZkClientConfig setOperationRetryTimeout(Long operationRetryTimeout) { - this._operationRetryTimeout = operationRetryTimeout; - return this; - } - - public HelixZkClient.ZkClientConfig setConnectInitTimeout(long _connectInitTimeout) { - this._connectInitTimeout = _connectInitTimeout; - return this; - } - - public PathBasedZkSerializer getZkSerializer() { - if (_zkSerializer == null) { - _zkSerializer = new BasicZkSerializer(new SerializableSerializer()); - } - return _zkSerializer; - } - - public long getOperationRetryTimeout() { - return _operationRetryTimeout; - } - - public String getMonitorType() { - return _monitorType; - } - - public String getMonitorKey() { - return _monitorKey; - } - - public String getMonitorInstanceName() { - return _monitorInstanceName; - } - - public boolean isMonitorRootPathOnly() { - return _monitorRootPathOnly; - } - - public long getConnectInitTimeout() { - return _connectInitTimeout; + class RealmAwareZkClientConfig { Review comment: Shall we change it ConnectionConfig? Conceptually this is the same as HelixZkClient.ZkConnectionConfig. In HelixZkClient the ClientConfig is about the monitor key, serializer etc. Let us keep the naming to concept consistent, otherwise, it can be confusing. ---------------------------------------------------------------- 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