node-driver: Only stop() artemis if it started fine

This commit is contained in:
Andras Slemmer
2016-08-08 18:24:35 +01:00
parent 20fc200771
commit c9527a2cdd

View File

@ -227,6 +227,7 @@ class DriverDSL(
serverHostPort = networkMapAddress, serverHostPort = networkMapAddress,
myHostPort = portAllocation.nextHostAndPort() myHostPort = portAllocation.nextHostAndPort()
) )
var messagingServiceStarted = false
fun registerProcess(process: Process) = registeredProcesses.push(process) fun registerProcess(process: Process) = registeredProcesses.push(process)
@ -252,7 +253,9 @@ class DriverDSL(
it.destroyForcibly() it.destroyForcibly()
} }
} }
messagingService.stop() if (messagingServiceStarted){
messagingService.stop()
}
// Check that we shut down properly // Check that we shut down properly
addressMustNotBeBound(messagingService.myHostPort) addressMustNotBeBound(messagingService.myHostPort)
@ -303,6 +306,7 @@ class DriverDSL(
startNetworkMapService() startNetworkMapService()
messagingService.configureWithDevSSLCertificate() messagingService.configureWithDevSSLCertificate()
messagingService.start() messagingService.start()
messagingServiceStarted = true
// We fake the network map's NodeInfo with a random public key in order to retrieve the correct NodeInfo from // We fake the network map's NodeInfo with a random public key in order to retrieve the correct NodeInfo from
// the network map service itself // the network map service itself
val nodeInfo = NodeInfo( val nodeInfo = NodeInfo(