Operational Remediation Reports
Permit Pool Remediation Report
Admit readers against a fixed permit pool and turn the remaining permits into an admit, hold, or shed remediation action.
Permit Pool Remediation Report
PermitPoolRemediationReport.kt
fun main() {
val readers =
val capacity = 3
var admitted = readers
if (admitted > capacity) {
admitted = capacity
}
val remaining = capacity - admitted
val action = if (remaining >= 2) {
"admit"
} else if (remaining == 1) {
"hold"
} else {
"shed"
}
println("readers=$readers admitted=$admitted remaining=$remaining $action")
}
fun main() {
val readers =
val capacity = 3
var admitted = readers
if (admitted > capacity) {
admitted = capacity
}
val remaining = capacity - admitted
val action = if (remaining >= 2) {
"admit"
} else if (remaining == 1) {
"hold"
} else {
"shed"
}
println("readers=$readers admitted=$admitted remaining=$remaining $action")
}
fun main() {
val readers =
val capacity = 3
var admitted = readers
if (admitted > capacity) {
admitted = capacity
}
val remaining = capacity - admitted
val action = if (remaining >= 2) {
"admit"
} else if (remaining == 1) {
"hold"
} else {
"shed"
}
println("readers=$readers admitted=$admitted remaining=$remaining $action")
}
remaining capacity
The permit pool is modeled with a scalar counter, so the remaining permits stay deterministic and free of atomic identity while driving the remediation action.