From 4ff8f5c16c56c9d352bf6426648ff6615d35b3ba Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 8 Apr 2016 19:29:55 -0400 Subject: [PATCH] Revert "Exploit DiscoveryNode immutability..." This reverts commit e76038e076bb66fd4deac62cd8f2ffd9d423cea6. --- .../cluster/node/DiscoveryNode.java | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java b/core/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java index 3fbe05c1c7a..ea1973c4057 100644 --- a/core/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java +++ b/core/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java @@ -312,30 +312,25 @@ public class DiscoveryNode implements Writeable, ToXContent { return nodeId.hashCode(); } - private String toString; - @Override public String toString() { - if (toString == null) { - StringBuilder sb = new StringBuilder(); - if (nodeName.length() > 0) { - 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(); + StringBuilder sb = new StringBuilder(); + if (nodeName.length() > 0) { + sb.append('{').append(nodeName).append('}'); } - 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