This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new 4bb228a DefaultServiceInstance property enabled and healthy default
value to true (#7709)
4bb228a is described below
commit 4bb228a0840f2893e50e343f7e0932e4aea6805b
Author: 赵延 <[email protected]>
AuthorDate: Mon May 10 21:42:51 2021 +0800
DefaultServiceInstance property enabled and healthy default value to true
(#7709)
* DefaultServiceInstance property enabled and healthy default value to true.
* add null check for argument 'port'.
---
.../apache/dubbo/registry/client/DefaultServiceInstance.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java
index 10fe957..4c25762 100644
---
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java
+++
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java
@@ -48,9 +48,9 @@ public class DefaultServiceInstance implements
ServiceInstance {
private int port;
- private boolean enabled;
+ private boolean enabled = true;
- private boolean healthy;
+ private boolean healthy = true;
private Map<String, String> metadata = new UnifiedMap<>();
@@ -79,14 +79,12 @@ public class DefaultServiceInstance implements
ServiceInstance {
}
public DefaultServiceInstance(String serviceName, String host, Integer
port) {
- if (port != null && port.intValue() < 1) {
- throw new IllegalArgumentException("The port must be greater than
zero!");
+ if (port == null || port < 1) {
+ throw new IllegalArgumentException("The port value is illegal, the
value is " + port);
}
this.serviceName = serviceName;
this.host = host;
this.port = port;
- this.enabled = true;
- this.healthy = true;
}
public void setRawAddress(String rawAddress) {