viviel commented on a change in pull request #97:
URL: https://github.com/apache/incubator-tubemq/pull/97#discussion_r429901304
##########
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:
If it is confirmed that the IP will be automatically and uniformly
configured later, it is actually better. But will some people specify the IP by
themselves or fill in the IP by specifying the network interface?This method is
provided here:
```
AddressUtils.getIPV4AddressByNetworkInterfaceName("eth0");
```
I am not sure if there is such a scene
----------------------------------------------------------------
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]