Class ExecuteWhenDoneYielder<T>

java.lang.Object
org.apache.druid.java.util.common.guava.ExecuteWhenDoneYielder<T>
All Implemented Interfaces:
Closeable, AutoCloseable, Yielder<T>

public class ExecuteWhenDoneYielder<T> extends Object implements Yielder<T>
  • Constructor Details

    • ExecuteWhenDoneYielder

      public ExecuteWhenDoneYielder(Yielder<T> baseYielder, Runnable runnable, Executor executor)
  • Method Details

    • get

      public T get()
      Description copied from interface: Yielder
      Gets the object currently held by this Yielder. Can be called multiple times as long as next() is not called. Once next() is called on this Yielder object, all further operations on this object are undefined.
      Specified by:
      get in interface Yielder<T>
      Returns:
      the currently yielded object, null if done
    • next

      public Yielder<T> next(T initValue)
      Description copied from interface: Yielder
      Gets the next Yielder in the chain. The argument is used as the accumulator value to pass along to start the accumulation until the next yield() call or iteration completes. Once next() is called on this Yielder object, all further operations on this object are undefined.
      Specified by:
      next in interface Yielder<T>
      Parameters:
      initValue - the initial value to pass along to start the accumulation until the next yield() call or iteration completes.
      Returns:
      the next Yielder in the chain, or undefined if done
    • isDone

      public boolean isDone()
      Description copied from interface: Yielder
      Returns true if this is the last Yielder in the chain. Review the class level javadoc for an understanding of the contract for other methods when isDone() is true. Once next() is called on this Yielder object, all further operations on this object are undefined.
      Specified by:
      isDone in interface Yielder<T>
      Returns:
      true if this is the last Yielder in the chain, false otherwise
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException