GenericIdleService

abstract class GenericIdleService : AbstractIdleService

Abstract base class that wraps Guava's AbstractIdleService with Kotlin Duration-based synchronous start and stop methods.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun addListener(listener: Service.Listener, executor: Executor)
Link copied to clipboard
fun awaitRunning(timeout: Duration)
fun awaitRunning(timeout: Long, unit: TimeUnit)
Link copied to clipboard
fun awaitTerminated(timeout: Long, unit: TimeUnit)
Link copied to clipboard
Link copied to clipboard
fun Service.genericServiceListener(logger: KLogger): Service.Listener

Creates a Service.Listener for this Service that logs all lifecycle transitions using the provided logger: running and terminated at INFO, the starting and stopping that lead to them at DEBUG, and failed at ERROR with its cause.

Link copied to clipboard
fun startAsync(): Service
Link copied to clipboard
fun startSync(timeout: Duration)

Starts the service and blocks until it is running, for Java callers: the overload taking a Kotlin Duration is compiled under a mangled name that Java cannot call.

fun startSync(timeout: Duration = 30.seconds)

Starts the service asynchronously and blocks until it is running.

Link copied to clipboard
fun state(): Service.State
Link copied to clipboard
fun stopAsync(): Service
Link copied to clipboard
fun stopSync(timeout: Duration)

Stops the service and blocks until it has terminated, for Java callers; see the java.time.Duration startSync.

fun stopSync(timeout: Duration = 30.seconds)

Stops the service asynchronously and blocks until it has terminated.

Link copied to clipboard
open fun toString(): String