You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "khanimteyaz (GitHub)" <gi...@apache.org> on 2019/01/03 06:57:32 UTC
[GitHub] [incubator-dubbo] khanimteyaz commented on pull request
#3118: code optimization
@CrazyHZM
I think once the **name** is not null the rest of two evaulation
```
!Constants.ANYHOST_VALUE.equals(name)
&& !Constants.LOCALHOST_VALUE.equals(name)
```
most likely be evaluates to **true** for non localhost so the chances of this whole condition to become true depends on **IP_PATTERN.matcher(name).matches()**. So from better understanding and performance point of view I think it would be better if we change it to
```
(name != null
&& IP_PATTERN.matcher(name).matches()
&& !Constants.ANYHOST_VALUE.equals(name)
&& !Constants.LOCALHOST_VALUE.equals(name));
```
What do yu say?
[ Full content available at: https://github.com/apache/incubator-dubbo/pull/3118 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org