SweetWuXiaoMei commented on code in PR #4709:
URL:
https://github.com/apache/servicecomb-java-chassis/pull/4709#discussion_r1945874312
##########
foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java:
##########
@@ -32,14 +32,23 @@ public class InstanceStatusDiscoveryFilter extends
AbstractGroupDiscoveryFilter
public static final String GROUP_SIZE = "status_group_size";
+ private String filterEnabledPropertyKey;
+
@Override
public int getOrder() {
return -10000;
}
@Override
public boolean enabled() {
- return
environment.getProperty("servicecomb.loadbalance.filter.status.enabled",
Boolean.class, true);
+
+ if (enabled == null) {
+ filterEnabledPropertyKey =
"servicecomb.loadbalance.filter.status.enabled";
+ enabled = dynamicProperties.getBooleanProperty(filterEnabledPropertyKey,
+ value -> enabled = value,
+ true);
+ }
+ return enabled;
Review Comment:
public boolean enabled() {
return enabled == null
? (enabled = dynamicProperties.getBooleanProperty(
SERVICECOMB_LOADBALANCE_FILTER_STATUS_ENABLED,
value -> enabled = value,
true))
: enabled;
}
改写为三元表达式可能会存在逻辑不清晰的情况,因为if里面含有赋值操作。
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]