Interface DFuture<V>

All Superinterfaces:
Future<V>
All Known Subinterfaces:
DPromise<V>
All Known Implementing Classes:
DCompletePromise

public interface DFuture<V> extends Future<V>
自定义的Future
Author:
qiunet 2020/3/8 11:15
  • Method Summary

    Modifier and Type
    Method
    Description
    Waits for this future to be completed.
    boolean
    await(long timeoutMillis)
    Waits for this future to be completed within the specified time limit.
    boolean
    await(long timeout, TimeUnit unit)
    Waits for this future to be completed within the specified time limit.
    Waits for this future to be completed without interruption.
    boolean
    awaitUninterruptibly(long timeoutMillis)
    Waits for this future to be completed within the specified time limit without interruption.
    boolean
    awaitUninterruptibly(long timeout, TimeUnit unit)
    Waits for this future to be completed within the specified time limit without interruption.
    boolean
    是否成功.
    whenComplete(BiConsumer<? super V,? super Throwable> action)
    实在executor线程调用.

    Methods inherited from interface java.util.concurrent.Future

    cancel, get, get, isCancelled, isDone
  • Method Details

    • whenComplete

      CompletionStage<V> whenComplete(BiConsumer<? super V,? super Throwable> action)
      实在executor线程调用. 这里是可以引起线程安全, 需要业务自己处理
      Parameters:
      action -
    • isSuccess

      boolean isSuccess()
      是否成功.
      Returns:
    • await

      DFuture<V> await() throws InterruptedException
      Waits for this future to be completed.
      Throws:
      InterruptedException - if the current thread was interrupted
    • awaitUninterruptibly

      DFuture<V> awaitUninterruptibly()
      Waits for this future to be completed without interruption. This method catches an InterruptedException and discards it silently.
    • await

      boolean await(long timeout, TimeUnit unit) throws InterruptedException
      Waits for this future to be completed within the specified time limit.
      Returns:
      true if and only if the future was completed within the specified time limit
      Throws:
      InterruptedException - if the current thread was interrupted
    • await

      boolean await(long timeoutMillis) throws InterruptedException
      Waits for this future to be completed within the specified time limit.
      Returns:
      true if and only if the future was completed within the specified time limit
      Throws:
      InterruptedException - if the current thread was interrupted
    • awaitUninterruptibly

      boolean awaitUninterruptibly(long timeout, TimeUnit unit)
      Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException and discards it silently.
      Returns:
      true if and only if the future was completed within the specified time limit
    • awaitUninterruptibly

      boolean awaitUninterruptibly(long timeoutMillis)
      Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException and discards it silently.
      Returns:
      true if and only if the future was completed within the specified time limit