Merge pull request #7155 from corda/adel/ENT-6743

ENT-6743: SuspensionMeta in FlowInfo is null when a runnable flow has previously been hospitalized
This commit is contained in:
Adel El-Beik 2022-04-26 17:21:30 +01:00 committed by GitHub
commit bc6a6ee2ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,17 +104,6 @@ class StaffedFlowHospital(private val flowMessaging: FlowMessaging,
* Flows should be removed from [flowsInHospital] when they have completed a successful transition.
*/
private val flowsInHospital = ConcurrentHashMap<StateMachineRunId, FlowFiber>()
/**
* Returns true if the flow is currently being treated in the hospital.
* The differs to flows with a medical history (which can accessed via [StaffedFlowHospital.contains]).
*/
@VisibleForTesting
internal fun flowInHospital(runId: StateMachineRunId): Boolean {
// The .keys avoids https://youtrack.jetbrains.com/issue/KT-18053
return runId in flowsInHospital.keys
}
private val mutex = ThreadBox(object {
/**
* Contains medical history of every flow (a patient) that has entered the hospital. A flow can leave the hospital,
@ -348,7 +337,7 @@ class StaffedFlowHospital(private val flowMessaging: FlowMessaging,
}
}
operator fun contains(flowId: StateMachineRunId) = mutex.locked { flowId in flowPatients }
operator fun contains(flowId: StateMachineRunId) = flowId in flowsInHospital.keys
override fun close() {
hospitalJobTimer.cancel()