Module methanol

Class AbstractPollableSubscription<T>

  • All Implemented Interfaces:
    java.util.concurrent.Flow.Subscription
    Direct Known Subclasses:
    AbstractQueueSubscription

    public abstract class AbstractPollableSubscription<T>
    extends AbstractSubscription<T>
    A subscription that emits items from a pollable source. This class's abstract methods are called serially, and implementations may assume they're being called from a single thread.
    • Constructor Detail

      • AbstractPollableSubscription

        protected AbstractPollableSubscription​(java.util.concurrent.Flow.Subscriber<? super T> downstream,
                                               java.util.concurrent.Executor executor)
    • Method Detail

      • poll

        protected abstract @Nullable T poll()
        Returns the next item, or null if no items are available.
      • isComplete

        protected abstract boolean isComplete()
        Returns true if downstream is to be completed. Implementation must ensure true isn't returned unless the subscription knows it won't produce any more items AND there aren't any present items expected to be polled.