Class ThriftFuture<T>

All Implemented Interfaces:
CompletionStage<T>, Future<T>, org.apache.thrift.async.AsyncMethodCallback<T>

public final class ThriftFuture<T> extends EventLoopCheckingFuture<T> implements org.apache.thrift.async.AsyncMethodCallback<T>
A CompletableFuture that can be passed in as an AsyncMethodCallback when making an asynchronous client-side Thrift RPC.
  • Constructor Details

    • ThriftFuture

      public ThriftFuture()
  • Method Details

    • completedFuture

      public static <T> ThriftFuture<T> completedFuture(@Nullable T value)
      Returns a new ThriftFuture instance that has its value set immediately.
    • exceptionallyCompletedFuture

      public static <T> ThriftFuture<T> exceptionallyCompletedFuture(Throwable cause)
      Returns a new ThriftFuture instance that has an exception set immediately.
    • onComplete

      public void onComplete(@Nullable T value)
      Specified by:
      onComplete in interface org.apache.thrift.async.AsyncMethodCallback<T>
    • onError

      public void onError(Exception cause)
      Specified by:
      onError in interface org.apache.thrift.async.AsyncMethodCallback<T>