Class AsyncIterablePublisher.SubscriptionImpl

    • Field Detail

      • cancelled

        private boolean cancelled
      • demand

        private long demand
      • iterator

        private java.util.Iterator<T> iterator
      • on

        private final java.util.concurrent.atomic.AtomicBoolean on
    • Constructor Detail

      • SubscriptionImpl

        SubscriptionImpl​(Subscriber<? super T> subscriber)
    • Method Detail

      • doRequest

        private void doRequest​(long n)
      • doCancel

        private void doCancel()
      • doSubscribe

        private void doSubscribe()
      • doSend

        private void doSend()
      • terminateDueTo

        private void terminateDueTo​(java.lang.Throwable t)
      • run

        public final void run()
        Specified by:
        run in interface java.lang.Runnable
      • tryScheduleToExecute

        private final void tryScheduleToExecute()
      • request

        public void request​(long n)
        Description copied from interface: Subscription
        No events will be sent by a Publisher until demand is signaled via this method.

        It can be called however often and whenever needed—but if the outstanding cumulative demand ever becomes Long.MAX_VALUE or more, it may be treated by the Publisher as "effectively unbounded".

        Whatever has been requested can be sent by the Publisher so only signal demand for what can be safely handled.

        A Publisher can send less than is requested if the stream ends but then must emit either Subscriber.onError(Throwable) or Subscriber.onComplete().

        Specified by:
        request in interface Subscription
        Parameters:
        n - the strictly positive number of elements to requests to the upstream Publisher
      • cancel

        public void cancel()
        Description copied from interface: Subscription
        Request the Publisher to stop sending data and clean up resources.

        Data may still be sent to meet previously signalled demand after calling cancel.

        Specified by:
        cancel in interface Subscription
      • init

        void init()