Address review comments from Richard

This commit is contained in:
Mike Hearn 2017-05-08 18:00:31 +02:00
parent 546d96934a
commit 670f1256e9
2 changed files with 4 additions and 5 deletions

View File

@ -128,7 +128,7 @@ Other common issues
Slow localhost resolution Slow localhost resolution
************************* *************************
Out of the box, Apple Mac's have machine names that end in ".local", by default something like "MacBook-Pro.local". Out of the box, Apple Macs have machine names that end in ".local", by default something like "MacBook-Pro.local".
This can cause long delays with starting Corda nodes as every attempt to look up the name of the local computer triggers This can cause long delays with starting Corda nodes as every attempt to look up the name of the local computer triggers
a five second pause. This is not a bug in Corda but rather `a problem with the macOS networking stack <http://stackoverflow.com/questions/39636792/jvm-takes-a-long-time-to-resolve-ip-address-for-localhost>`_. a five second pause. This is not a bug in Corda but rather `a problem with the macOS networking stack <http://stackoverflow.com/questions/39636792/jvm-takes-a-long-time-to-resolve-ip-address-for-localhost>`_.

View File

@ -3,7 +3,6 @@
package net.corda.node package net.corda.node
import com.jcabi.manifests.Manifests import com.jcabi.manifests.Manifests
import com.sun.org.apache.xml.internal.serializer.utils.Utils.messages
import com.typesafe.config.ConfigException import com.typesafe.config.ConfigException
import joptsimple.OptionException import joptsimple.OptionException
import net.corda.core.* import net.corda.core.*
@ -25,7 +24,6 @@ import java.net.InetAddress
import java.nio.file.Paths import java.nio.file.Paths
import java.util.* import java.util.*
import kotlin.system.exitProcess import kotlin.system.exitProcess
import kotlin.system.measureTimeMillis
private var renderBasicInfoToConsole = true private var renderBasicInfoToConsole = true
@ -125,7 +123,7 @@ fun main(args: Array<String>) {
log.info("bootclasspath: ${info.bootClassPath}") log.info("bootclasspath: ${info.bootClassPath}")
log.info("classpath: ${info.classPath}") log.info("classpath: ${info.classPath}")
log.info("VM ${info.vmName} ${info.vmVendor} ${info.vmVersion}") log.info("VM ${info.vmName} ${info.vmVendor} ${info.vmVersion}")
checkForSlowLocalhostResolution() log.info("Machine: ${lookupMachineNameAndMaybeWarn()}")
log.info("Working Directory: ${cmdlineOptions.baseDirectory}") log.info("Working Directory: ${cmdlineOptions.baseDirectory}")
val agentProperties = sun.misc.VMSupport.getAgentProperties() val agentProperties = sun.misc.VMSupport.getAgentProperties()
if (agentProperties.containsKey("sun.jdwp.listenerAddress")) { if (agentProperties.containsKey("sun.jdwp.listenerAddress")) {
@ -166,7 +164,7 @@ fun main(args: Array<String>) {
exitProcess(0) exitProcess(0)
} }
private fun checkForSlowLocalhostResolution() { private fun lookupMachineNameAndMaybeWarn(): String {
val start = System.currentTimeMillis() val start = System.currentTimeMillis()
val hostName: String = InetAddress.getLocalHost().hostName val hostName: String = InetAddress.getLocalHost().hostName
val elapsed = System.currentTimeMillis() - start val elapsed = System.currentTimeMillis() - start
@ -188,6 +186,7 @@ private fun checkForSlowLocalhostResolution() {
print(Ansi.ansi().reset()) print(Ansi.ansi().reset())
} }
} }
return hostName
} }
private fun assertCanNormalizeEmptyPath() { private fun assertCanNormalizeEmptyPath() {