Operational Remediation Reports
Countdown Latch Remediation Report
Compare arrivals at a latch against the needed count and turn the remaining count into a release, wait, or escalate remediation action.
Countdown Latch Remediation Report
CountdownLatchRemediationReport.scala
object Main {
def main(args: Array[String]): Unit = {
val arrivals =
val needed = 3
var counted = arrivals
if (counted > needed) {
counted = needed
}
val remaining = needed - counted
var action = "release"
if (remaining == 1) {
action = "wait"
}
if (remaining >= 2) {
action = "escalate"
}
println("needed=" + needed + " counted=" + counted + " remaining=" + remaining + " " + action)
}
}
object Main {
def main(args: Array[String]): Unit = {
val arrivals =
val needed = 3
var counted = arrivals
if (counted > needed) {
counted = needed
}
val remaining = needed - counted
var action = "release"
if (remaining == 1) {
action = "wait"
}
if (remaining >= 2) {
action = "escalate"
}
println("needed=" + needed + " counted=" + counted + " remaining=" + remaining + " " + action)
}
}
object Main {
def main(args: Array[String]): Unit = {
val arrivals =
val needed = 3
var counted = arrivals
if (counted > needed) {
counted = needed
}
val remaining = needed - counted
var action = "release"
if (remaining == 1) {
action = "wait"
}
if (remaining >= 2) {
action = "escalate"
}
println("needed=" + needed + " counted=" + counted + " remaining=" + remaining + " " + action)
}
}
latch remaining
The needed count and arrivals are scalars, so the remaining work that drives the remediation action stays deterministic without awaiting a live latch.