mirror of
https://github.com/corda/corda.git
synced 2025-02-22 02:06:45 +00:00
Merged in mnesbit-cleanup-protect-double-stop (pull request #323)
Some integration tests seem to be getting exceptions that suggest the ArtemisMQ session has been closed twice.
This commit is contained in:
commit
a2d7490902
@ -252,20 +252,25 @@ class ArtemisMessagingClient(directory: Path,
|
|||||||
// Ignore it: this can happen if the server has gone away before we do.
|
// Ignore it: this can happen if the server has gone away before we do.
|
||||||
}
|
}
|
||||||
consumer = null
|
consumer = null
|
||||||
running
|
val prevRunning = running
|
||||||
|
running = false
|
||||||
|
prevRunning
|
||||||
}
|
}
|
||||||
if (running && !executor.isOnThread) {
|
if (running && !executor.isOnThread) {
|
||||||
// Wait for the main loop to notice the consumer has gone and finish up.
|
// Wait for the main loop to notice the consumer has gone and finish up.
|
||||||
shutdownLatch.await()
|
shutdownLatch.await()
|
||||||
}
|
}
|
||||||
state.locked {
|
// Only first caller to gets running true to protect against double stop, which seems to happen in some integration tests.
|
||||||
producer?.close()
|
if (running) {
|
||||||
producer = null
|
state.locked {
|
||||||
// Ensure any trailing messages are committed to the journal
|
producer?.close()
|
||||||
session!!.commit()
|
producer = null
|
||||||
// Closing the factory closes all the sessions it produced as well.
|
// Ensure any trailing messages are committed to the journal
|
||||||
clientFactory!!.close()
|
session!!.commit()
|
||||||
clientFactory = null
|
// Closing the factory closes all the sessions it produced as well.
|
||||||
|
clientFactory!!.close()
|
||||||
|
clientFactory = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user