Merge pull request #4329 from corda/pat/ent-1620-cherry-pick

Stop messaging services before node dies, to prevent port hogging when using in process node (#1620)
This commit is contained in:
Patrick Kuo 2018-11-30 12:32:19 +00:00 committed by GitHub
commit 3444d6c075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -352,7 +352,13 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
netParams,
keyManagementService,
configuration.networkParameterAcceptanceSettings)
startMessagingService(rpcOps, nodeInfo, myNotaryIdentity, netParams)
try {
startMessagingService(rpcOps, nodeInfo, myNotaryIdentity, netParams)
} catch (e: Exception) {
// Try to stop any started messaging services.
stop()
throw e
}
// Do all of this in a database transaction so anything that might need a connection has one.
return database.transaction {
@ -838,6 +844,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
nodeInfo: NodeInfo,
myNotaryIdentity: PartyAndCertificate?,
networkParameters: NetworkParameters)
/**
* Loads or generates the node's legal identity and key-pair.
* Note that obtainIdentity returns a KeyPair with an [AliasPrivateKey].