SelectorManager

interface SelectorManager

Selector manager is a service that manages NIO selectors and selection threads

Properties

provider

abstract val provider: SelectorProvider

NIO selector provider

Functions

notifyClosed

abstract fun notifyClosed(s: Selectable): Unit

Notifies the selector that selectable has been closed.

select

abstract suspend fun select(
    selectable: Selectable,
    interest: SelectInterest
): Unit

Suspends until interest is selected for selectable May cause manager to allocate and run selector instance if not yet created.

Extension Functions

buildOrClose

fun <C : Closeable, R> SelectorManager.buildOrClose(
    create: SelectorProvider.() -> C,
    setup: C.() -> R
): R

Creates a NIO entity via create and calls setup on it. If any exception happens then the entity will be closed and an exception will be propagated.

Inheritors

SelectorManagerSupport

abstract class SelectorManagerSupport : SelectorManager

Base class for NIO selector managers