Skip to content

Commit

Permalink
[CORDA-2276]: FlowMonitor repeatedly / indefinitely logs flows in the…
Browse files Browse the repository at this point in the history
… flow hospital. (fix) (corda#4327)
  • Loading branch information
sollecitom authored Nov 30, 2018
1 parent 628aa0b commit 4906358
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
// Shut down the SMM so no Fibers are scheduled.
runOnStop += { smm.stop(acceptableLiveFiberCountOnStop()) }
(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
flowMonitor.start()
}
Expand All @@ -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. */
abstract fun createStartedNode(nodeInfo: NodeInfo, rpcOps: CordaRPCOps, notaryService: NotaryService?): S

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ class StaffedFlowHospital(private val flowMessaging: FlowMessaging, private val
}
}

operator fun contains(flowId: StateMachineRunId) = mutex.locked { flowId in flowPatients }

class FlowMedicalHistory {
internal val records: MutableList<MedicalRecord.Flow> = mutableListOf()

Expand Down

0 comments on commit 4906358

Please sign in to comment.