diff --git a/node/src/main/kotlin/net/corda/node/services/messaging/CordaRPCClientImpl.kt b/node/src/main/kotlin/net/corda/node/services/messaging/CordaRPCClientImpl.kt index b46dad17ac..9afacf8ebd 100644 --- a/node/src/main/kotlin/net/corda/node/services/messaging/CordaRPCClientImpl.kt +++ b/node/src/main/kotlin/net/corda/node/services/messaging/CordaRPCClientImpl.kt @@ -284,11 +284,8 @@ class CordaRPCClientImpl(private val session: ClientSession, private val rootShared = root.doOnUnsubscribe { close() }.share() // This could be made more efficient by using a specialised IntMap - /** - * When handling this map we synchronise on it explicitly instead of on [this], otherwise there is a race - * condition between close() and deliver() - */ - private val observables = HashMap>() + // When handling this map we don't synchronise on [this], otherwise there is a race condition between close() and deliver() + private val observables = Collections.synchronizedMap(HashMap>()) private var consumer: ClientConsumer? = null