Interface StreamHandle<T>

Type Parameters:
T - stream item type
All Superinterfaces:
AutoCloseable

public interface StreamHandle<T> extends AutoCloseable
Backpressure-aware stream handle.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Requests stream cancellation.
    void
    boolean
    Returns whether the stream is closed.
    poll(Duration timeout)
    Polls one item.
  • Method Details

    • poll

      Optional<T> poll(Duration timeout)
      Polls one item.
      Parameters:
      timeout - maximum wait
      Returns:
      item or empty when no item is available before the timeout
    • cancel

      void cancel()
      Requests stream cancellation.
    • closed

      boolean closed()
      Returns whether the stream is closed.
      Returns:
      whether the stream is closed
    • close

      void close()
      Specified by:
      close in interface AutoCloseable