Stop messaging services before node dies, to prevent port hogging when using in process node (#1620)

(cherry picked from commit 15c11d964f)
This commit is contained in:
Patrick Kuo 2018-11-29 22:25:36 +00:00 committed by Patrick
parent 11e7bf5bbc
commit 4f41dff6cd

View File

@ -352,7 +352,13 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
netParams,
keyManagementService,
configuration.networkParameterAcceptanceSettings)
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].