mirror of
https://github.com/corda/corda.git
synced 2025-02-20 17:33:15 +00:00
ENT-3187 Check that we're not calling toList
on concurrent collections (#4828)
* ENT-3165 Kotlin toList() does not work on concurrent collections. OS backport. ENT-3165 Added comment. * ENT-3187 Additional use of toList() on concurrent data structure.
This commit is contained in:
parent
cd321c9da2
commit
adad7862d6
@ -62,7 +62,8 @@ class LazyPool<A>(
|
||||
*/
|
||||
fun close(): Iterable<A> {
|
||||
lifeCycle.justTransition(State.FINISHED)
|
||||
val elements = poolQueue.toList()
|
||||
// Does not use kotlin toList() as it currently is not safe to use on concurrent data structures.
|
||||
val elements = ArrayList(poolQueue)
|
||||
poolQueue.clear()
|
||||
return elements
|
||||
}
|
||||
|
@ -163,7 +163,8 @@ class CordaPersistence(
|
||||
}
|
||||
|
||||
fun onAllOpenTransactionsClosed(callback: () -> Unit) {
|
||||
val allOpen = liveTransactions.values.toList()
|
||||
// Does not use kotlin toList() as that is not safe to use on concurrent collections.
|
||||
val allOpen = ArrayList(liveTransactions.values)
|
||||
if (allOpen.isEmpty()) {
|
||||
callback()
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user