mirror of
https://github.com/corda/corda.git
synced 2025-06-17 06:38:21 +00:00
[CORDA-1408]: Fixed some Demobench bugs. (#3288)
This commit is contained in:
committed by
GitHub
parent
fc020bca4b
commit
7350cd9d1e
@ -408,7 +408,7 @@ class NodeVaultService(
|
|||||||
|
|
||||||
@Throws(VaultQueryException::class)
|
@Throws(VaultQueryException::class)
|
||||||
private fun <T : ContractState> _queryBy(criteria: QueryCriteria, paging: PageSpecification, sorting: Sort, contractStateType: Class<out T>, skipPagingChecks: Boolean): Vault.Page<T> {
|
private fun <T : ContractState> _queryBy(criteria: QueryCriteria, paging: PageSpecification, sorting: Sort, contractStateType: Class<out T>, skipPagingChecks: Boolean): Vault.Page<T> {
|
||||||
log.info("Vault Query for contract type: $contractStateType, criteria: $criteria, pagination: $paging, sorting: $sorting")
|
log.debug { "Vault Query for contract type: $contractStateType, criteria: $criteria, pagination: $paging, sorting: $sorting" }
|
||||||
return database.transaction {
|
return database.transaction {
|
||||||
// calculate total results where a page specification has been defined
|
// calculate total results where a page specification has been defined
|
||||||
var totalStates = -1L
|
var totalStates = -1L
|
||||||
|
@ -4,6 +4,7 @@ import com.typesafe.config.Config
|
|||||||
import net.corda.core.internal.deleteRecursively
|
import net.corda.core.internal.deleteRecursively
|
||||||
import net.corda.core.internal.div
|
import net.corda.core.internal.div
|
||||||
import net.corda.core.utilities.NetworkHostAndPort
|
import net.corda.core.utilities.NetworkHostAndPort
|
||||||
|
import net.corda.nodeapi.internal.config.UnknownConfigKeysPolicy
|
||||||
import net.corda.nodeapi.internal.config.parseAs
|
import net.corda.nodeapi.internal.config.parseAs
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
@ -19,7 +20,7 @@ class InstallFactory : Controller() {
|
|||||||
require(nodeController.isPortValid(port)) { "Invalid port $port" }
|
require(nodeController.isPortValid(port)) { "Invalid port $port" }
|
||||||
}
|
}
|
||||||
|
|
||||||
val nodeConfig = config.parseAs<NodeConfig>()
|
val nodeConfig = config.parseAs<NodeConfig>(UnknownConfigKeysPolicy.IGNORE::handle)
|
||||||
nodeConfig.p2pAddress.checkPort()
|
nodeConfig.p2pAddress.checkPort()
|
||||||
nodeConfig.rpcAddress.checkPort()
|
nodeConfig.rpcAddress.checkPort()
|
||||||
nodeConfig.webAddress.checkPort()
|
nodeConfig.webAddress.checkPort()
|
||||||
|
@ -33,7 +33,10 @@ data class NodeConfig(
|
|||||||
val issuableCurrencies: List<String> = emptyList(),
|
val issuableCurrencies: List<String> = emptyList(),
|
||||||
/** Pass-through for generating node.conf with external DB */
|
/** Pass-through for generating node.conf with external DB */
|
||||||
val dataSourceProperties: Properties? = null,
|
val dataSourceProperties: Properties? = null,
|
||||||
val database: Properties? = null
|
val database: Properties? = null,
|
||||||
|
private val devMode: Boolean = true,
|
||||||
|
private val detectPublicIp: Boolean = false,
|
||||||
|
private val useTestClock: Boolean = true
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
val renderOptions: ConfigRenderOptions = ConfigRenderOptions.defaults().setOriginComments(false)
|
val renderOptions: ConfigRenderOptions = ConfigRenderOptions.defaults().setOriginComments(false)
|
||||||
@ -41,14 +44,9 @@ data class NodeConfig(
|
|||||||
const val cordappDirName = "cordapps"
|
const val cordappDirName = "cordapps"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
private val detectPublicIp = false
|
|
||||||
@Suppress("unused")
|
|
||||||
private val useTestClock = true
|
|
||||||
|
|
||||||
fun nodeConf(): Config {
|
fun nodeConf(): Config {
|
||||||
|
|
||||||
val basic = NodeConfigurationData(myLegalName, p2pAddress, rpcAddress, notary, h2port, rpcUsers, useTestClock, detectPublicIp).toConfig()
|
val basic = NodeConfigurationData(myLegalName, p2pAddress, rpcAddress, notary, h2port, rpcUsers, useTestClock, detectPublicIp, devMode).toConfig()
|
||||||
val rpcSettings = empty()
|
val rpcSettings = empty()
|
||||||
.withValue("address", ConfigValueFactory.fromAnyRef(rpcAddress.toString()))
|
.withValue("address", ConfigValueFactory.fromAnyRef(rpcAddress.toString()))
|
||||||
.withValue("adminAddress", ConfigValueFactory.fromAnyRef(rpcAdminAddress.toString()))
|
.withValue("adminAddress", ConfigValueFactory.fromAnyRef(rpcAdminAddress.toString()))
|
||||||
@ -78,7 +76,8 @@ private data class NodeConfigurationData(
|
|||||||
val h2port: Int,
|
val h2port: Int,
|
||||||
val rpcUsers: List<User> = listOf(NodeConfig.defaultUser),
|
val rpcUsers: List<User> = listOf(NodeConfig.defaultUser),
|
||||||
val useTestClock: Boolean,
|
val useTestClock: Boolean,
|
||||||
val detectPublicIp: Boolean
|
val detectPublicIp: Boolean,
|
||||||
|
val devMode: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
private data class WebServerConfigurationData(
|
private data class WebServerConfigurationData(
|
||||||
|
@ -13,6 +13,7 @@ import javafx.scene.layout.HBox
|
|||||||
import javafx.scene.layout.StackPane
|
import javafx.scene.layout.StackPane
|
||||||
import javafx.scene.layout.VBox
|
import javafx.scene.layout.VBox
|
||||||
import javafx.util.Duration
|
import javafx.util.Duration
|
||||||
|
import net.corda.client.rpc.RPCException
|
||||||
import net.corda.core.concurrent.match
|
import net.corda.core.concurrent.match
|
||||||
import net.corda.core.contracts.ContractState
|
import net.corda.core.contracts.ContractState
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
@ -201,13 +202,25 @@ class NodeTerminalView : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val fxScheduler = Schedulers.from(Platform::runLater)
|
val fxScheduler = Schedulers.from(Platform::runLater)
|
||||||
subscriptions.add(txNext.observeOn(fxScheduler).subscribe {
|
subscriptions.add(txNext.observeOn(fxScheduler).subscribe({
|
||||||
transactions.value = (++txCount).toString()
|
transactions.value = (++txCount).toString()
|
||||||
})
|
}, { error ->
|
||||||
subscriptions.add(stateNext.observeOn(fxScheduler).subscribe {
|
if (error is RPCException && error.message?.contains("Connection failure detected") == true) {
|
||||||
|
// Ignore this ^^^, it only happens when we shutdown a node in Demobench.
|
||||||
|
} else {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
subscriptions.add(stateNext.observeOn(fxScheduler).subscribe({
|
||||||
stateCount += (it.produced.size - it.consumed.size)
|
stateCount += (it.produced.size - it.consumed.size)
|
||||||
states.value = stateCount.toString()
|
states.value = stateCount.toString()
|
||||||
})
|
}, { error ->
|
||||||
|
if (error is RPCException && error.message?.contains("Connection failure detected") == true) {
|
||||||
|
// Ignore this ^^^, it only happens when we shutdown a node in Demobench.
|
||||||
|
} else {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
log.log(Level.WARNING, "RPC failed: ${e.message}", e)
|
log.log(Level.WARNING, "RPC failed: ${e.message}", e)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user