From c734fbf8bb19440870b74bacb074fa61911f2be9 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Wed, 8 Feb 2017 12:16:35 +0000 Subject: [PATCH] Disable Node Explorer and Database Viewer buttons until the node has launched and is responding to RPC. --- .../src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt | 3 ++- .../kotlin/net/corda/demobench/views/NodeTerminalView.kt | 7 ++++++- .../net/corda/demobench/views/NodeTerminalView.fxml | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt index 2d1e015a6d..89e6ffaf2f 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt @@ -8,7 +8,7 @@ import net.corda.demobench.model.NodeConfig import net.corda.node.services.messaging.CordaRPCClient import org.slf4j.LoggerFactory -class NodeRPC(config: NodeConfig, invoke: (CordaRPCOps) -> Unit): AutoCloseable { +class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Unit): AutoCloseable { private val log = LoggerFactory.getLogger(NodeRPC::class.java) companion object Data { @@ -30,6 +30,7 @@ class NodeRPC(config: NodeConfig, invoke: (CordaRPCOps) -> Unit): AutoCloseable this.cancel() log.info("Node '{}' is now ready.", config.legalName) + start() // Schedule a new task that will refresh the display once per second. timer.schedule(object: TimerTask() { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt index 6b9257df42..3c6cc8a294 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt @@ -86,7 +86,12 @@ class NodeTerminalView : Fragment() { }) } - fun launchRPC(config: NodeConfig) = NodeRPC(config, { ops -> + fun enable() { + launchExplorerButton.isDisable = false + viewDatabaseButton.isDisable = false + } + + fun launchRPC(config: NodeConfig) = NodeRPC(config, start = { enable() }, invoke = { ops -> try { val verifiedTx = ops.verifiedTransactions() val statesInVault = ops.vaultAndUpdates() diff --git a/tools/demobench/src/main/resources/net/corda/demobench/views/NodeTerminalView.fxml b/tools/demobench/src/main/resources/net/corda/demobench/views/NodeTerminalView.fxml index d12a887ca2..9333f7c85f 100644 --- a/tools/demobench/src/main/resources/net/corda/demobench/views/NodeTerminalView.fxml +++ b/tools/demobench/src/main/resources/net/corda/demobench/views/NodeTerminalView.fxml @@ -25,8 +25,8 @@ -