Revert "Exploit DiscoveryNode immutability..."

This reverts commit e76038e076.
This commit is contained in:
Jason Tedor 2016-04-08 19:29:55 -04:00
parent 29278f8482
commit 4ff8f5c16c
1 changed files with 16 additions and 21 deletions

View File

@ -312,30 +312,25 @@ public class DiscoveryNode implements Writeable<DiscoveryNode>, ToXContent {
return nodeId.hashCode(); return nodeId.hashCode();
} }
private String toString;
@Override @Override
public String toString() { public String toString() {
if (toString == null) { StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(); if (nodeName.length() > 0) {
if (nodeName.length() > 0) { sb.append('{').append(nodeName).append('}');
sb.append('{').append(nodeName).append('}');
}
if (nodeId != null) {
sb.append('{').append(nodeId).append('}');
}
if (Strings.hasLength(hostName)) {
sb.append('{').append(hostName).append('}');
}
if (address != null) {
sb.append('{').append(address).append('}');
}
if (!attributes.isEmpty()) {
sb.append(attributes);
}
toString = sb.toString();
} }
return toString; if (nodeId != null) {
sb.append('{').append(nodeId).append('}');
}
if (Strings.hasLength(hostName)) {
sb.append('{').append(hostName).append('}');
}
if (address != null) {
sb.append('{').append(address).append('}');
}
if (!attributes.isEmpty()) {
sb.append(attributes);
}
return sb.toString();
} }
@Override @Override