From aeb5a59605c8210112281d1209526141b609fbfc Mon Sep 17 00:00:00 2001 From: Patrick Kuo Date: Fri, 20 Jan 2017 11:34:32 +0000 Subject: [PATCH] Add logging to node startup when it attempt to connect to the map server (#167) * Add logging to avoid node startup "hang" when it attempt to connects to the network map, also can use as a hint telling user Network map might be down or unreachable. --- node/src/main/kotlin/net/corda/node/Corda.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node/src/main/kotlin/net/corda/node/Corda.kt b/node/src/main/kotlin/net/corda/node/Corda.kt index 3427fb2879..ca7c9e969a 100644 --- a/node/src/main/kotlin/net/corda/node/Corda.kt +++ b/node/src/main/kotlin/net/corda/node/Corda.kt @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory import java.lang.management.ManagementFactory import java.net.InetAddress import java.nio.file.Paths +import kotlin.concurrent.thread import kotlin.system.exitProcess private var renderBasicInfoToConsole = true @@ -85,6 +86,14 @@ fun main(args: Array) { node.start() printPluginsAndServices(node) + thread { + Thread.sleep(30.seconds.toMillis()) + while (!node.networkMapRegistrationFuture.isDone) { + printBasicNodeInfo("Waiting for response from network map ...") + Thread.sleep(30.seconds.toMillis()) + } + } + node.networkMapRegistrationFuture.success { val elapsed = (System.currentTimeMillis() - startTime) / 10 / 100.0 printBasicNodeInfo("Node started up and registered in $elapsed sec")