CircuitBreaker

constructor(name: String, failureThreshold: Int = DEFAULT_FAILURE_THRESHOLD, windowMs: Long = DEFAULT_WINDOW_MS, cooldownMs: Long = DEFAULT_COOLDOWN_MS, clock: () -> Long = System::currentTimeMillis)(source)

Parameters

name

Human-readable label used in log messages

failureThreshold

Number of failures within windowMs that trip the breaker

windowMs

Sliding time window for counting failures (milliseconds)

cooldownMs

How long the breaker stays OPEN before transitioning to HALF_OPEN