ENT-4955: Hide usage of FlowHospital inside StateMachineManager (#5997)

This commit is contained in:
Viktor Kolomeyko 2020-02-25 14:10:59 +00:00 committed by GitHub
parent d2568b9077
commit 275e801094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -167,7 +167,7 @@ internal class CordaRPCOpsImpl(
return snapshot
}
override fun killFlow(id: StateMachineRunId): Boolean = if (smm.killFlow(id)) true else smm.flowHospital.dropSessionInit(id)
override fun killFlow(id: StateMachineRunId): Boolean = smm.killFlow(id)
override fun stateMachinesFeed(): DataFeed<List<StateMachineInfo>, StateMachineUpdate> {

View File

@ -229,7 +229,7 @@ class SingleThreadedStateMachineManager(
}
override fun killFlow(id: StateMachineRunId): Boolean {
return mutex.locked {
val killFlowResult = mutex.locked {
cancelTimeoutIfScheduled(id)
val flow = flows.remove(id)
if (flow != null) {
@ -257,6 +257,11 @@ class SingleThreadedStateMachineManager(
}
}
}
return if(killFlowResult) {
true
} else {
flowHospital.dropSessionInit(id)
}
}
override fun addSessionBinding(flowId: StateMachineRunId, sessionId: SessionId) {