Interface Future<V>

All Superinterfaces:
Awaitable, io.netty.util.concurrent.Future<V>, Future<V>, com.google.common.util.concurrent.ListenableFuture<V>
All Known Subinterfaces:
Promise<V>, RunnableFuture<V>
All Known Implementing Classes:
AbstractFuture, AsymmetricRemoteSyncTask, AsyncChannelPromise, AsyncFuture, AsyncOneResponse, AsyncPromise, AsyncPromise.WithExecutor, BlockingPartitionRepair, FutureCombiner, FutureTask, FutureTaskWithResources, ImmediateFuture, LocalSyncTask, PaxosCleanup, PaxosCleanupComplete, PaxosCleanupLocalCoordinator, PaxosCleanupSession, PaxosFinishPrepareCleanup, PaxosStartPrepareCleanup, RepairJob, RepairSession, Scheduler.Task, SnapshotTask, StreamResultFuture, SymmetricRemoteSyncTask, SyncFuture, SyncFutureTask, SyncPromise, SyncPromise.WithExecutor, SyncTask, ValidationTask

public interface Future<V> extends io.netty.util.concurrent.Future<V>, com.google.common.util.concurrent.ListenableFuture<V>, Awaitable
A Future that integrates several different (but equivalent) APIs used within Cassandra into a single concept, integrating also with our Awaitable abstraction, to overall improve coherency and clarity in the codebase.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Awaitable

    Awaitable.AbstractAwaitable, Awaitable.AsyncAwaitable, Awaitable.Defaults, Awaitable.SyncAwaitable
  • Method Summary

    Modifier and Type
    Method
    Description
    addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback)
    Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback, Executor executor)
    Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    addCallback(BiConsumer<? super V,Throwable> callback)
    Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    addCallback(BiConsumer<? super V,Throwable> callback, Executor executor)
    Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    addCallback(Consumer<? super V> onSuccess, Consumer<? super Throwable> onFailure)
    Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    addCallback(Consumer<? super V> onSuccess, Consumer<? super Throwable> onFailure, Executor executor)
    Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> genericFutureListener)
     
    void
    Invoke runnable on completion.
    void
    addListener(Runnable runnable, Executor executor)
    Invoke runnable on completion, using executor.
    addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... genericFutureListeners)
     
    Wait indefinitely for this future to complete, throwing any interrupt
    default boolean
    await(long l)
    Deprecated.
    See CASSANDRA-16924
    Wait indefinitely for this promise to complete, throwing any interrupt as an UncheckedInterruptedException
    Wait indefinitely for this future to complete
    default boolean
    Deprecated.
    See CASSANDRA-16924
    default <T> Future<T>
    flatMap(Function<? super V,? extends Future<T>> flatMapper)
    Support Futures.transformAsync(ListenableFuture, AsyncFunction, Executor) natively
    <T> Future<T>
    flatMap(Function<? super V,? extends Future<T>> flatMapper, Executor executor)
    Support Futures.transformAsync(ListenableFuture, AsyncFunction, Executor) natively
    default <T> Future<T>
    map(Function<? super V,? extends T> mapper)
    Support Futures.transform(ListenableFuture, com.google.common.base.Function, Executor) natively
    <T> Future<T>
    map(Function<? super V,? extends T> mapper, Executor executor)
    Support Futures.transform(ListenableFuture, com.google.common.base.Function, Executor) natively
     
    removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> genericFutureListener)
     
    removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... genericFutureListeners)
     
    default void
     
    default Future<V>
    waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces
    default Future<V>
    waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces
    default Future<V>
    waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces

    Methods inherited from interface io.netty.util.concurrent.Future

    await, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccess

    Methods inherited from interface java.util.concurrent.Future

    get, get, isCancelled, isDone
  • Method Details

    • await

      Future<V> await() throws InterruptedException
      Wait indefinitely for this future to complete, throwing any interrupt
      Specified by:
      await in interface Awaitable
      Specified by:
      await in interface io.netty.util.concurrent.Future<V>
      Throws:
      InterruptedException - if interrupted
    • awaitUninterruptibly

      Future<V> awaitUninterruptibly()
      Wait indefinitely for this future to complete
      Specified by:
      awaitUninterruptibly in interface Awaitable
      Specified by:
      awaitUninterruptibly in interface io.netty.util.concurrent.Future<V>
    • awaitThrowUncheckedOnInterrupt

      Future<V> awaitThrowUncheckedOnInterrupt()
      Wait indefinitely for this promise to complete, throwing any interrupt as an UncheckedInterruptedException
      Specified by:
      awaitThrowUncheckedOnInterrupt in interface Awaitable
      Throws:
      UncheckedInterruptedException - if interrupted
    • rethrowIfFailed

      default void rethrowIfFailed()
    • sync

      default Future<V> sync() throws InterruptedException
      waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces
      Specified by:
      sync in interface io.netty.util.concurrent.Future<V>
      Throws:
      InterruptedException
    • syncUninterruptibly

      default Future<V> syncUninterruptibly()
      waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces
      Specified by:
      syncUninterruptibly in interface io.netty.util.concurrent.Future<V>
    • syncThrowUncheckedOnInterrupt

      default Future<V> syncThrowUncheckedOnInterrupt()
      waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces
    • await

      @Deprecated(since="4.1") default boolean await(long l) throws InterruptedException
      Deprecated.
      See CASSANDRA-16924
      Specified by:
      await in interface io.netty.util.concurrent.Future<V>
      Throws:
      InterruptedException
    • awaitUninterruptibly

      @Deprecated(since="4.1") default boolean awaitUninterruptibly(long l)
      Deprecated.
      See CASSANDRA-16924
      Specified by:
      awaitUninterruptibly in interface io.netty.util.concurrent.Future<V>
    • addCallback

      Future<V> addCallback(BiConsumer<? super V,Throwable> callback)
      Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    • addCallback

      Future<V> addCallback(BiConsumer<? super V,Throwable> callback, Executor executor)
      Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    • addCallback

      Future<V> addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback)
      Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    • addCallback

      Future<V> addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback, Executor executor)
      Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    • addCallback

      Future<V> addCallback(Consumer<? super V> onSuccess, Consumer<? super Throwable> onFailure)
      Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    • addCallback

      Future<V> addCallback(Consumer<? super V> onSuccess, Consumer<? super Throwable> onFailure, Executor executor)
      Support Futures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor) natively
    • map

      default <T> Future<T> map(Function<? super V,? extends T> mapper)
      Support Futures.transform(ListenableFuture, com.google.common.base.Function, Executor) natively
    • map

      <T> Future<T> map(Function<? super V,? extends T> mapper, Executor executor)
      Support Futures.transform(ListenableFuture, com.google.common.base.Function, Executor) natively
    • flatMap

      default <T> Future<T> flatMap(Function<? super V,? extends Future<T>> flatMapper)
      Support Futures.transformAsync(ListenableFuture, AsyncFunction, Executor) natively
    • flatMap

      <T> Future<T> flatMap(Function<? super V,? extends Future<T>> flatMapper, Executor executor)
      Support Futures.transformAsync(ListenableFuture, AsyncFunction, Executor) natively
    • addListener

      void addListener(Runnable runnable, Executor executor)
      Invoke runnable on completion, using executor. Tasks are submitted to their executors in the order they were added to this Future.
      Specified by:
      addListener in interface com.google.common.util.concurrent.ListenableFuture<V>
    • addListener

      void addListener(Runnable runnable)
      Invoke runnable on completion. Depending on the implementation and its configuration, this may be executed immediately by the notifying/completing thread, or asynchronously by an executor. Tasks are executed, or submitted to the executor, in the order they were added to this Future.
    • notifyExecutor

      Executor notifyExecutor()
    • addListener

      Future<V> addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> genericFutureListener)
      Specified by:
      addListener in interface io.netty.util.concurrent.Future<V>
    • addListeners

      Future<V> addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... genericFutureListeners)
      Specified by:
      addListeners in interface io.netty.util.concurrent.Future<V>
    • removeListener

      Future<V> removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> genericFutureListener)
      Specified by:
      removeListener in interface io.netty.util.concurrent.Future<V>
    • removeListeners

      Future<V> removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... genericFutureListeners)
      Specified by:
      removeListeners in interface io.netty.util.concurrent.Future<V>