Class FutureBox

java.lang.Object
org.apache.druid.common.guava.FutureBox
All Implemented Interfaces:
Closeable, AutoCloseable

public class FutureBox extends Object implements Closeable
Box for tracking pending futures. Allows cancellation of all pending futures.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the box, canceling all currently-pending futures.
    int
    Returns the number of currently-pending futures.
    <R> com.google.common.util.concurrent.ListenableFuture<R>
    register(com.google.common.util.concurrent.ListenableFuture<R> future)
    Adds a future to the box.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FutureBox

      public FutureBox()
  • Method Details

    • pendingCount

      public int pendingCount()
      Returns the number of currently-pending futures.
    • register

      public <R> com.google.common.util.concurrent.ListenableFuture<R> register(com.google.common.util.concurrent.ListenableFuture<R> future)
      Adds a future to the box. If close() had previously been called, the future is immediately canceled.
    • close

      public void close()
      Closes the box, canceling all currently-pending futures.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable