Repository: nifi Updated Branches: refs/heads/master 9a2f8c598 -> 09840027a
NIFI-2304: If node address is not set, default to localhost, as the admin guide says it should This closes #688 Signed-off-by: Koji Kawamura <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/09840027 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/09840027 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/09840027 Branch: refs/heads/master Commit: 09840027a37c076f5df6239c669fc77315b761d9 Parents: 9a2f8c5 Author: Mark Payne <[email protected]> Authored: Wed Jul 20 12:21:58 2016 -0400 Committer: Koji Kawamura <[email protected]> Committed: Tue Aug 2 12:09:34 2016 +0900 ---------------------------------------------------------------------- .../heartbeat/ClusterProtocolHeartbeatMonitor.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/09840027/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/ClusterProtocolHeartbeatMonitor.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/ClusterProtocolHeartbeatMonitor.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/ClusterProtocolHeartbeatMonitor.java index 934c81b..f206a07 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/ClusterProtocolHeartbeatMonitor.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/ClusterProtocolHeartbeatMonitor.java @@ -17,8 +17,6 @@ package org.apache.nifi.cluster.coordination.heartbeat; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; @@ -91,16 +89,12 @@ public class ClusterProtocolHeartbeatMonitor extends AbstractHeartbeatMonitor im this.clusterNodesPath = zkClientConfig.resolvePath("cluster/nodes"); String hostname = properties.getProperty(NiFiProperties.CLUSTER_NODE_ADDRESS); - if (hostname == null) { - try { - hostname = InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - throw new RuntimeException("Unable to determine local hostname and the '" + NiFiProperties.CLUSTER_NODE_ADDRESS + "' property is not set"); - } + if (hostname == null || hostname.trim().isEmpty()) { + hostname = "localhost"; } final String port = properties.getProperty(NiFiProperties.CLUSTER_NODE_PROTOCOL_PORT); - if (port == null) { + if (port == null || port.trim().isEmpty()) { throw new RuntimeException("Unable to determine which port Cluster Coordinator Protocol is listening on because the '" + NiFiProperties.CLUSTER_NODE_PROTOCOL_PORT + "' property is not set"); }
