Merged in mnesbit-cleanup-correct-shutdown-exceptions (pull request #333)

Fix noisy exceptions in some tests during node stop.
This commit is contained in:
Matthew Nesbit 2016-09-06 17:02:13 +01:00
commit 7503ffc10a
2 changed files with 2 additions and 2 deletions

View File

@ -168,7 +168,6 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
checkpointStorage = storageServices.second
netMapCache = InMemoryNetworkMapCache()
net = makeMessagingService()
runOnStop += Runnable { net.stop() }
wallet = makeWalletService()
identity = makeIdentityService()
@ -211,6 +210,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
ScheduledActivityObserver(services)
startMessagingService()
runOnStop += Runnable { net.stop() }
_networkMapRegistrationFuture.setFuture(registerWithNetworkMap())
isPreviousCheckpointsPresent = checkpointStorage.checkpoints.any()
smm.start()

View File

@ -281,7 +281,7 @@ class Node(dir: Path, val p2pAddr: HostAndPort, val webServerAddr: HostAndPort,
shutdown = true
// Unregister shutdown hook to prevent any unnecessary second calls to stop
if(shutdownThread != null) {
if((shutdownThread != null) && (Thread.currentThread() != shutdownThread)){
Runtime.getRuntime().removeShutdownHook(shutdownThread)
shutdownThread = null
}