Java Code Examples for rx.internal.operators.BackpressureUtils#getAndAddRequest()
The following examples show how to use
rx.internal.operators.BackpressureUtils#getAndAddRequest() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OnSubscribeRepeating.java From rxjava-extras with Apache License 2.0 | 6 votes |
@Override public void request(long n) { if (n < 0) { throw new IllegalArgumentException("reuest must be >=0"); } else if (n == 0) { return; } else if (BackpressureUtils.getAndAddRequest(this, n) == 0) { long requested = n; long emitted = 0; do { emitted = requested; while (requested-- > 0 && !subscriber.isUnsubscribed()) { subscriber.onNext(v); } } while ((requested = this.addAndGet(-emitted)) > 0); } }
Example 2
Source File: ValueGenerator.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Override public void request(long n) { if (n > 0) { BackpressureUtils.getAndAddRequest(requested, n); worker.schedule(this::drain); } }
Example 3
Source File: DefaultRxEventBus.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Override public void request(long n) { if (n > 0) { BackpressureUtils.getAndAddRequest(requested, n); drain(); } }
Example 4
Source File: OnSubscribeMatch.java From rxjava-extras with Apache License 2.0 | 5 votes |
@Override public void request(long n) { if (BackpressureUtils.validate(n)) { BackpressureUtils.getAndAddRequest(requested, n); drain(); } }
Example 5
Source File: OperatorBufferToFile.java From rxjava-extras with Apache License 2.0 | 5 votes |
@Override public void request(long n) { if (n > 0) { BackpressureUtils.getAndAddRequest(this, n); drain(); } }
Example 6
Source File: ResultSetToRowsTransformer.java From hawkular-metrics with Apache License 2.0 | 5 votes |
@Override public void request(long n) { if (n < 0) { throw new IllegalArgumentException(); } if (n == 0) { return; } if (BackpressureUtils.getAndAddRequest(requested, n) != 0) { return; } execute(this::produce); }
Example 7
Source File: OrderedMerge.java From rxjava-extras with Apache License 2.0 | 4 votes |
@Override public void request(long n) { BackpressureUtils.getAndAddRequest(this, n); emit(); }
Example 8
Source File: SortedMerge.java From hawkular-metrics with Apache License 2.0 | 4 votes |
@Override public void request(long n) { BackpressureUtils.getAndAddRequest(this, n); emit(); }