[CORDA-2276]: FlowMonitor repeatedly / indefinitely logs flows in the flow hospital. (fix) (#4327)

This commit is contained in:
Michele Sollecito 2018-11-30 09:31:46 +00:00 committed by GitHub
parent 628aa0b799
commit 4906358aa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -380,7 +380,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
// Shut down the SMM so no Fibers are scheduled. // Shut down the SMM so no Fibers are scheduled.
runOnStop += { smm.stop(acceptableLiveFiberCountOnStop()) } runOnStop += { smm.stop(acceptableLiveFiberCountOnStop()) }
(smm as? StateMachineManagerInternal)?.let { (smm as? StateMachineManagerInternal)?.let {
val flowMonitor = FlowMonitor(smm::snapshot, configuration.flowMonitorPeriodMillis, configuration.flowMonitorSuspensionLoggingThresholdMillis) val flowMonitor = FlowMonitor({ smm.snapshot().filter { flow -> flow !in smm.flowHospital }.toSet() }, configuration.flowMonitorPeriodMillis, configuration.flowMonitorSuspensionLoggingThresholdMillis)
runOnStop += flowMonitor::stop runOnStop += flowMonitor::stop
flowMonitor.start() flowMonitor.start()
} }
@ -391,6 +391,8 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
} }
} }
private operator fun StaffedFlowHospital.contains(flow: FlowStateMachine<*>) = contains(flow.id)
/** Subclasses must override this to create a "started" node of the desired type, using the provided machinery. */ /** Subclasses must override this to create a "started" node of the desired type, using the provided machinery. */
abstract fun createStartedNode(nodeInfo: NodeInfo, rpcOps: CordaRPCOps, notaryService: NotaryService?): S abstract fun createStartedNode(nodeInfo: NodeInfo, rpcOps: CordaRPCOps, notaryService: NotaryService?): S

View File

@ -159,6 +159,8 @@ class StaffedFlowHospital(private val flowMessaging: FlowMessaging, private val
} }
} }
operator fun contains(flowId: StateMachineRunId) = mutex.locked { flowId in flowPatients }
class FlowMedicalHistory { class FlowMedicalHistory {
internal val records: MutableList<MedicalRecord.Flow> = mutableListOf() internal val records: MutableList<MedicalRecord.Flow> = mutableListOf()