ktor-network / io.ktor.network.selector / ActorSelectorManager

ActorSelectorManager

class ActorSelectorManager : SelectorManagerSupport, Closeable, CoroutineScope

Default CIO selector manager implementation

Constructors

<init>

ActorSelectorManager(context: <ERROR CLASS>)

Default CIO selector manager implementation

Properties

coroutineContext

val coroutineContext: <ERROR CLASS>

Inherited Properties

cancelled

var cancelled: Int

Number of cancelled keys

pending

var pending: Int

Number of pending selectables

provider

val provider: SelectorProvider

NIO selector provider

Functions

close

fun close(): Unit

Close selector manager and release all resources

notifyClosed

fun notifyClosed(s: Selectable): Unit

Notifies the selector that selectable has been closed.

publishInterest

fun publishInterest(selectable: Selectable): Unit

Publish current selectable interest

Inherited Functions

applyInterest

fun applyInterest(selector: Selector, s: Selectable): Unit

Applies selectable's current interest (should be invoked in selection thread)

cancelAllSuspensions

fun cancelAllSuspensions(attachment: Selectable, t: Throwable): Unit

Cancel all selectable's suspensions with the specified exception

fun cancelAllSuspensions(selector: Selector, t: Throwable?): Unit

Cancel all suspensions with the specified exception, reset all interests

handleSelectedKey

fun handleSelectedKey(key: SelectionKey): Unit

Handles particular selected key

handleSelectedKeys

fun handleSelectedKeys(selectedKeys: MutableSet<SelectionKey>, keys: Set<SelectionKey>): Unit

Handle selected keys clearing selectedKeys set

notifyClosedImpl

fun notifyClosedImpl(selector: Selector, key: SelectionKey, attachment: Selectable): Unit

Notify selectable's closure

select

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, 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.