AbstractChannel

abstract class AbstractChannel<T : Any> : Channel<T>

Base Channel implementation, thread-safely handling listener registration/notification, close/isClosed bookkeeping, and a unique id (used to build Channel.streamTerms), so that concrete channels only have to implement the actual I/O (see AbstractInputChannel/AbstractOutputChannel).

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
override var isClosed: Boolean

Whether this channel has been closed.

Link copied to clipboard
abstract val streamTerm: Struct

The Prolog $stream(Direction, Id)-like Struct term identifying this channel, e.g. for current_output/1.

Functions

Link copied to clipboard
open override fun addListener(listener: Listener<T?>)

Registers listener to be invoked with every element subsequently transiting this channel.

Link copied to clipboard
open override fun clearListeners()

Unregisters every currently-registered Listener.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun removeListener(listener: Listener<T?>)

Unregisters listener, previously added via addListener.