core / pragma.utils / MetrickingPragmaSemaphore /

MetrickingPragmaSemaphore #

open class MetrickingPragmaSemaphore(initialPermits: Int, metricName: String, metricsManager: MetricsManager, loggerName: String, logger: Logger = LoggerFactory.getLogger("PragmaSemaphore-${loggerName}")) : PragmaSemaphore

A PragmaSemaphore that registers a metrics gauge for getActiveAndWaitingBlockCount.

Repeated gauge registration: The underlying metrics registry keeps the first gauge registered for a given metric name (and tags). A second registration with the same name does not replace it—the first gauge and its state object remain active; the second is effectively ignored. So if you create multiple MetrickingPragmaSemaphore instances with the same metricName, or re-create one (e.g. on config change), only the first instance’s gauge will be active. Prefer a single instance per metric name over the lifecycle.

Constructors #

MetrickingPragmaSemaphore

fun MetrickingPragmaSemaphore(initialPermits: Int, metricName: String, metricsManager: MetricsManager, loggerName: String, logger: Logger = LoggerFactory.getLogger("PragmaSemaphore-${loggerName}"))