类 SucceededFuture<V>

所有已实现的接口:
ListenableFuture<V>, Future<V>

public final class SucceededFuture<V> extends CompleteFuture<V>
The CompleteFuture which is succeeded already.
从以下版本开始:
4.0 2024/2/26 21:33
作者:
Harry Yang
  • 字段详细资料

  • 构造器详细资料

    • SucceededFuture

      public SucceededFuture(@Nullable V result)
      Creates a new instance.
    • SucceededFuture

      public SucceededFuture(@Nullable Executor executor, @Nullable V result)
      Creates a new instance.
      参数:
      executor - the Executor associated with this future
  • 方法详细资料

    • getCause

      public Throwable getCause()
      从接口复制的说明: ListenableFuture
      Returns the cause of the failed operation if the operation failed.
      返回:
      the cause of the failure. null if succeeded or this future is not completed yet.
    • isSuccess

      public boolean isSuccess()
      从接口复制的说明: ListenableFuture
      Returns true if and only if the operation was completed successfully.
    • getNow

      public V getNow()
      从接口复制的说明: ListenableFuture
      Return the result without blocking. If the future is not done yet this will return null.

      As it is possible that a null value is used to mark the future as successful you also need to check if the future is really done with Future.isDone() and not rely on the returned null value.