mirror of
https://github.com/corda/corda.git
synced 2025-06-22 09:08:49 +00:00
Merge remote-tracking branch 'open/master' into os-merge-2018-06-18-17_42
This commit is contained in:
@ -104,6 +104,7 @@ class DriverDSLImpl(
|
||||
val networkParameters: NetworkParameters,
|
||||
val notaryCustomOverrides: Map<String, Any?>
|
||||
) : InternalDriverDSL {
|
||||
|
||||
private var _executorService: ScheduledExecutorService? = null
|
||||
val executorService get() = _executorService!!
|
||||
private var _shutdownManager: ShutdownManager? = null
|
||||
@ -660,6 +661,12 @@ class DriverDSLImpl(
|
||||
val debugPort = if (isDebug) debugPortAllocation.nextPort() else null
|
||||
val monitorPort = if (jmxPolicy.startJmxHttpServer) jmxPolicy.jmxHttpServerPortAllocation?.nextPort() else null
|
||||
val process = startOutOfProcessNode(config, quasarJarPath, debugPort, jolokiaJarPath, monitorPort, systemProperties, cordappPackages, maximumHeapSize)
|
||||
|
||||
// Destroy the child process when the parent exits.This is needed even when `waitForAllNodesToFinish` is
|
||||
// true because we don't want orphaned processes in the case that the parent process is terminated by the
|
||||
// user, for example when the `tools:explorer:runDemoNodes` gradle task is stopped with CTRL-C.
|
||||
shutdownManager.registerProcessShutdown(process)
|
||||
|
||||
if (waitForAllNodesToFinish) {
|
||||
state.locked {
|
||||
processes += object : Waitable {
|
||||
@ -668,8 +675,6 @@ class DriverDSLImpl(
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
shutdownManager.registerProcessShutdown(process)
|
||||
}
|
||||
val p2pReadyFuture = addressMustBeBoundFuture(executorService, config.corda.p2pAddress, process)
|
||||
return p2pReadyFuture.flatMap {
|
||||
|
@ -17,12 +17,18 @@ import net.corda.core.utilities.Try
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.nodeapi.internal.addShutdownHook
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeoutException
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
class ShutdownManager(private val executorService: ExecutorService) {
|
||||
|
||||
init {
|
||||
addShutdownHook { shutdown() }
|
||||
}
|
||||
|
||||
private class State {
|
||||
val registeredShutdowns = ArrayList<CordaFuture<() -> Unit>>()
|
||||
var isShuttingDown = false
|
||||
|
Reference in New Issue
Block a user