Search in sources :

Example 1 with MissingBackpressureException

use of io.reactivex.exceptions.MissingBackpressureException in project RxJava by ReactiveX.

the class QueueDrainSubscriberPad4 method fastPathOrderedEmitMax.

protected final void fastPathOrderedEmitMax(U value, boolean delayError, Disposable dispose) {
    final Subscriber<? super V> s = actual;
    final SimplePlainQueue<U> q = queue;
    if (wip.get() == 0 && wip.compareAndSet(0, 1)) {
        long r = requested.get();
        if (r != 0L) {
            if (q.isEmpty()) {
                if (accept(s, value)) {
                    if (r != Long.MAX_VALUE) {
                        produced(1);
                    }
                }
                if (leave(-1) == 0) {
                    return;
                }
            } else {
                q.offer(value);
            }
        } else {
            cancelled = true;
            dispose.dispose();
            s.onError(new MissingBackpressureException("Could not emit buffer due to lack of requests"));
            return;
        }
    } else {
        q.offer(value);
        if (!enter()) {
            return;
        }
    }
    QueueDrainHelper.drainMaxLoop(q, s, delayError, dispose, this);
}
Also used : MissingBackpressureException(io.reactivex.exceptions.MissingBackpressureException)

Example 2 with MissingBackpressureException

use of io.reactivex.exceptions.MissingBackpressureException in project RxJava by ReactiveX.

the class QueueDrainSubscriberPad4 method fastPathEmitMax.

protected final void fastPathEmitMax(U value, boolean delayError, Disposable dispose) {
    final Subscriber<? super V> s = actual;
    final SimplePlainQueue<U> q = queue;
    if (wip.get() == 0 && wip.compareAndSet(0, 1)) {
        long r = requested.get();
        if (r != 0L) {
            if (accept(s, value)) {
                if (r != Long.MAX_VALUE) {
                    produced(1);
                }
            }
            if (leave(-1) == 0) {
                return;
            }
        } else {
            dispose.dispose();
            s.onError(new MissingBackpressureException("Could not emit buffer due to lack of requests"));
            return;
        }
    } else {
        q.offer(value);
        if (!enter()) {
            return;
        }
    }
    QueueDrainHelper.drainMaxLoop(q, s, delayError, dispose, this);
}
Also used : MissingBackpressureException(io.reactivex.exceptions.MissingBackpressureException)

Aggregations

MissingBackpressureException (io.reactivex.exceptions.MissingBackpressureException)2