gosonzhang commented on a change in pull request #97:
URL: https://github.com/apache/incubator-tubemq/pull/97#discussion_r429896902



##########
File path: 
tubemq-client/src/main/java/org/apache/tubemq/client/config/TubeClientConfig.java
##########
@@ -92,23 +92,19 @@
     // TLS configuration.
     private TLSConfig tlsConfig = new TLSConfig();
 
+    public TubeClientConfig(String masterAddrInfo) {
+        this(new MasterInfo(masterAddrInfo));
+    }
 
-    public TubeClientConfig(final String localHostIP, final String 
masterAddrInfo) throws Exception {
-        if (TStringUtils.isBlank(localHostIP)) {
-            throw new IllegalArgumentException("Illegal parameter: localHostIP 
is blank!");
-        }
-        // Not allow to set local host ip to 127.0.0.1.
-        if ("127.0.0.1".equals(localHostIP)) {
-            throw new IllegalArgumentException("Illegal parameter: localHostIP 
can't set to 127.0.0.1");
-        }
-        if (TStringUtils.isBlank(masterAddrInfo)) {
-            throw new IllegalArgumentException("Illegal parameter: 
masterAddrInfo is Blank!");
-        }
-        this.masterInfo = new MasterInfo(masterAddrInfo);
-        AddressUtils.validLocalIp(localHostIP.trim());
+    public TubeClientConfig(MasterInfo masterInfo) {
+        this(AddressUtils.getLocalIPv4Address(), masterInfo);
+    }
+
+    public TubeClientConfig(final String localHostIP, final String 
masterAddrInfo) {

Review comment:
       need to add a @Deprecated tag on this function

##########
File path: 
tubemq-client/src/main/java/org/apache/tubemq/client/config/TubeClientConfig.java
##########
@@ -92,23 +92,19 @@
     // TLS configuration.
     private TLSConfig tlsConfig = new TLSConfig();
 
+    public TubeClientConfig(String masterAddrInfo) {
+        this(new MasterInfo(masterAddrInfo));
+    }
 
-    public TubeClientConfig(final String localHostIP, final String 
masterAddrInfo) throws Exception {
-        if (TStringUtils.isBlank(localHostIP)) {
-            throw new IllegalArgumentException("Illegal parameter: localHostIP 
is blank!");
-        }
-        // Not allow to set local host ip to 127.0.0.1.
-        if ("127.0.0.1".equals(localHostIP)) {
-            throw new IllegalArgumentException("Illegal parameter: localHostIP 
can't set to 127.0.0.1");
-        }
-        if (TStringUtils.isBlank(masterAddrInfo)) {
-            throw new IllegalArgumentException("Illegal parameter: 
masterAddrInfo is Blank!");
-        }
-        this.masterInfo = new MasterInfo(masterAddrInfo);
-        AddressUtils.validLocalIp(localHostIP.trim());
+    public TubeClientConfig(MasterInfo masterInfo) {
+        this(AddressUtils.getLocalIPv4Address(), masterInfo);
+    }
+
+    public TubeClientConfig(final String localHostIP, final String 
masterAddrInfo) {
+        this(localHostIP, new MasterInfo(masterAddrInfo));
     }
 
-    public TubeClientConfig(final String localHostIP, final MasterInfo 
masterInfo) throws Exception {
+    public TubeClientConfig(final String localHostIP, final MasterInfo 
masterInfo) {

Review comment:
       need to add a @Deprecated tag on this function




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


Reply via email to