VerboseCountDownLatch

A CountDownLatch that logs a message on each wait timeout and retries until the latch reaches zero.

Useful for long-running waits where periodic logging is desired to indicate the system is still waiting.

Parameters

count

the number of times countDown must be invoked before threads can pass through await.

Constructors

Link copied to clipboard
constructor(count: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val count: Long
Link copied to clipboard

Whether this CountDownLatch has reached zero.

Functions

Link copied to clipboard
fun await(timeout: Duration, msg: () -> Any?)

Waits repeatedly for the latch to reach zero, logging the result of msg at INFO level each time the timeout expires without the latch being satisfied.

fun await(timeout: Duration, msg: String)

Waits repeatedly for the latch to reach zero, logging msg at INFO level each time the timeout expires without the latch being satisfied.

open fun await()
open fun await(timeout: Long, unit: TimeUnit?): Boolean
Link copied to clipboard
open fun countDown()
Link copied to clipboard
fun CountDownLatch.countDown(block: () -> Unit)

Executes block and calls CountDownLatch.countDown in a finally block, ensuring the latch is decremented even if the block throws.