OriginalSource
An original source has a standard definition of onComplete in terms of poll and addListener.
Implementations should be the resource owner to handle listener queue and completion using an object monitor on the instance.
Attributes
- Graph
-
- Supertypes
- Known subtypes
Members list
Value members
Abstract methods
Add k to the listener set of this source.
Add k to the listener set of this source.
Attributes
Concrete methods
Once data is available, pass it to the listener k. onComplete is always non-blocking.
Once data is available, pass it to the listener k. onComplete is always non-blocking.
Note that k's methods will be executed on the same thread as the Source, usually in sequence. It is hence important that the listener itself does not perform expensive operations.
Attributes
Inherited methods
Waits for an item to arrive from the source. Suspends until an item returns.
Waits for an item to arrive from the source. Suspends until an item returns.
This is an utility method for direct waiting with Async, instead of going through listeners.
Attributes
- Inherited from:
- Source
Inherited and Abstract methods
Signal that listener k is dead (i.e. will always fail to acquire locks from now on), and should be removed from onComplete queues.
Signal that listener k is dead (i.e. will always fail to acquire locks from now on), and should be removed from onComplete queues.
This permits original, (i.e. non-derived) sources like futures or channels to drop the listener from their waiting sets.
Attributes
- Inherited from:
- Source
Checks whether data is available at present and pass it to k if so. Calls to poll are always synchronous and non-blocking.
Checks whether data is available at present and pass it to k if so. Calls to poll are always synchronous and non-blocking.
The process is as follows:
- If no data is immediately available, return
falseimmediately. - If there is data available, attempt to lock
k.- If
kis no longer available,trueis returned to signal this source's general availability. - If locking
ksucceeds:- If data is still available, complete
kand return true. - Otherwise, unlock
kand return false.
- If data is still available, complete
- If
Note that in all cases, a return value of false indicates that k should be put into onComplete to receive data in a later point in time.
Attributes
- Returns
-
Whether poll was able to pass data to
k. Note that this is regardless ofkbeing available to receive the data. In most cases, one should passkinto Source!.onComplete ifpollreturnsfalse. - Inherited from:
- Source