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

CoroutineSelector

sealed class CoroutineSelector (source)

A selector for co-routine based channel IO.

Author
Chris Leishman - https://cleishm.github.io/

Functions

cancelSelections

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

Cancel any suspended calls to select for the specified channel.

close

abstract fun close(): Unit

Close the co-routine selector.

closeNow

abstract suspend fun closeNow(): Unit

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

isOpen

abstract fun isOpen(): Boolean

Indicates whether the selector is open or not.

select

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

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

wakeup

abstract fun wakeup(): Unit

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

Companion Object Functions

open

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

Open a co-routine selector.