EsFutureImpl
Description
An <EsFutureImpl> is the default implementation class for the abstract <EsFuture>
Instance State
  • state: <Integer> Future is complete or not
    • EsStateIncomplete - Initial state, waiting for a result. In this state, the field holds a single-linked list of
<EsFutureListener>s listeners
  • EsStatePendingComplete - Pending completion. Set when completed using #asyncComplete: or #asyncCompleteError:
It is an error to try to complete it again. resultOrListeners holds listeners.
  • EsStateChained - The future has been chained to another future. The result of that other future becomes the result
of this future as well. resultOrListeners contains the source future.
  • EsStateValue - The future has been completed with a value result.
  • EsStateError - The future has been completed with a error result.
  • resultOrListeners: <Object> The result, list of listeners or another future. The result of the future is either a
value or error.
  • A result is only stored when the future has completed
  • The listeners is a linked list of <EsFutureListener>s. Listeners are only remembered while the future is not yet
complete, and it is not chained to another future
  • The future is another future that the future is chained to. This future is waiting for the other future to complete,
and when it does, this future will complete with the same result. All listeners are forwarded to the other future
Class Methods
None
Instance Methods
<details> catch:if:
<pre><code> Handles errors emitted by this future.
@see EsFuture>>catch:if: for a complete description
of the specification this method implements

Arguments:
onError - <Block> 2-arg culled block providing the error and stackTrace
shouldCatchError - <Block> test block to determine if catch is applicable
<UndefinedObject> implicit test block [true]
Answers:
<EsFuture>
</code></pre> </details>
<details> ensure:
<pre><code> Registers an @onCompletion action to be called when this future completes.
@see EsFuture>>ensure: for a complete description
of the specification this method implements

Arguments:
onCompletion - <Block> 0-arg
Answers:
<EsFuture>
</code></pre> </details>
<details> then:catch:
<pre><code> Register handlers to be evaluated when this future completes.
@see EsFuture>>then:catch: for a complete description
of the specification this method implements

Arguments:
onValue - <Block> 0 or 1-arg injected with completed value (if any)
onError - <Block> 0, 1 to 2-arg injected with completed error and stack trace
Answers:
<EsFuture>
</code></pre> </details>
<details> timeout:then:
<pre><code> Timeout the future computation after @aDurationOrMs has passed.
@see EsFuture>>timeout:then: for a complete description
of the specification this method implements

Arguments:
aDurationOrMs - <Duration> duration object
<Integer> duration in milliseconds
onTimeout - <Block> 0-arg block
Answers:
<EsFuture>
</code></pre> </details>
Last modified date: 04/21/2022