Future

cc.otavia.core.stack.Future
trait Future[+V]

The result of an asynchronous operation.

An asynchronous operation is one that might be completed outside a given Actor of execution. The operation can either be performing computation, or I/O, or both.

All I/O operations in Otavia are asynchronous. It means any I/O calls will return immediately with no guarantee that the requested I/O operation has been completed at the end of the call. Instead, you will be returned with a Future instance which gives you the information about the result or status of the I/O operation.

A Future is either uncompleted or completed. When an I/O operation begins, a new future object is created. The new future is uncompleted initially - it is neither succeeded, failed, nor cancelled because the I/O operation is not finished yet. If the I/O operation is finished either successfully, with failure, or by cancellation, the future is marked as completed with more specific information, such as the cause of the failure. Please note that even failure and cancellation belong to the completed state.

Type parameters

V

type of result

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class AbstractPromise[V]
trait MessageFuture[R]

Members list

Value members

Abstract methods

def cause: Option[Throwable]

Returns the cause of the failed operation if the operation has failed.

Returns the cause of the failed operation if the operation has failed.

Attributes

Returns

The cause of the failure, if any. Otherwise None if succeeded.

Throws
IllegalStateException

if this Promise has not completed yet.

def causeUnsafe: Throwable

Returns the cause of the failed operation if the operation has failed.

Returns the cause of the failed operation if the operation has failed.

Attributes

Returns

The cause of the failure, if any.

Throws
IllegalStateException

if this Promise has not completed yet, or if it has been succeeded.

def getNow: V

Return the successful result of this asynchronous operation, if any. If the operation has not yet been completed, then this will throw IllegalStateException . If the operation has been failed with an exception, then this throw cause .

Return the successful result of this asynchronous operation, if any. If the operation has not yet been completed, then this will throw IllegalStateException . If the operation has been failed with an exception, then this throw cause .

Attributes

Returns

the result of this operation, if completed successfully.

Throws
IllegalStateException

if this Future or Promise has not completed yet.

Throwable

if the operation has been failed with an exception.

def isFailed: Boolean

Returns true if and only if the operation was completed and failed.

Returns true if and only if the operation was completed and failed.

Attributes

def isSuccess: Boolean

Returns true if and only if the operation was completed successfully.

Returns true if and only if the operation was completed successfully.

Attributes

Concrete methods

def isDone: Boolean

Return true if this operation has been completed either Promise.setSuccess successfully, Promise.setFailure unsuccessfully.

Return true if this operation has been completed either Promise.setSuccess successfully, Promise.setFailure unsuccessfully.

Attributes

Returns

true if this operation has completed, otherwise false.

final def isTimeout: Boolean

Returns true if and only if the operation was completed and failed with TimeoutException.

Returns true if and only if the operation was completed and failed with TimeoutException.

Attributes