net-coroutines / org.apache.tuweni.net.coroutines / CoroutineSelector

CoroutineSelector

sealed class CoroutineSelector (source)

A selector for co-routine based channel IO.

Functions

cancelSelections

Cancel any suspended calls to select for the specified channel.

abstract suspend fun cancelSelections(channel: SelectableChannel, cause: Throwable? = null): Boolean

close

Close the co-routine selector.

abstract fun close(): Unit

closeNow

Close the co-routine selector and wait for all suspensions to be cancelled.

abstract suspend fun closeNow(): Unit

isOpen

Indicates whether the selector is open or not.

abstract fun isOpen(): Boolean

select

Wait for a channel to become ready for any of the specified operations.

abstract suspend fun select(channel: SelectableChannel, ops: Int): Unit

wakeup

Force the selection loop, if running, to wake up and process any closed channels.

abstract fun wakeup(): Unit

Companion Object Functions

open

Open a co-routine selector.

fun open(executor: Executor = Executors.newSingleThreadExecutor(DEFAULT_THREAD_FACTORY), selectTimeout: Long = 1000, idleTimeout: Long = 10000): CoroutineSelector