@Override public StreamSubscription subscribe(Consumer<? super IN> onNext, Consumer<? super Throwable> onError, Runnable onComplete) { BankersQueue<StreamSubscription> subs = BankersQueue.empty(); int index[] = {0}; boolean[] finished = {false}; Concat[] ref = {null}; StreamSubscription sub = new StreamSubscription() { @Override public void request(long n) { if (n <= 0) { onError.accept(new IllegalArgumentException("3.9 While the Subscription is not cancelled, Subscription.request(long n) MUST throw a java.lang.IllegalArgumentException if the argument is <= 0.")); return; } super.request(n); ref[0].request(n); } @Override public void cancel() { ref[0].cancel(); super.cancel(); } }; Concat c = new Concat(sub,operators,onNext,onError,onComplete); ref[0]=c; return sub; }
public void emitted(long n) { if (processAll) { return; } if (wip.compareAndSet(0, 1)) { requested.accumulateAndGet(n,(a,b)->a-b); if (decrementAndCheckActive()) { addMissingRequests(); } }else { produced.accumulateAndGet(n, (a, b) -> a + b); if (incrementAndCheckInactive()) { addMissingRequests(); } } }
@Override public void cancel() { ref[0].cancel(); super.cancel(); } };
public Concat(StreamSubscription sub, Seq<Operator<IN>> operators, Consumer<? super IN> onNext, Consumer<? super Throwable> onError, Runnable onComplete) { this.sub = sub; this.operators = operators; this.onNext = onNext; this.onError = onError; this.onComplete = onComplete; this.subscribeNext(); }
public void onError(Throwable t){ emitted(1); onError.accept(t); }
@Override public void request(long n) { if (n <= 0) { onError.accept(new IllegalArgumentException("3.9 While the Subscription is not cancelled, Subscription.request(long n) MUST throw a java.lang.IllegalArgumentException if the argument is <= 0.")); return; } super.request(n); ref[0].request(n); }
public void onComplete(){ //check complete if(index==operators.size()){ if(!finished) { finished = true; onComplete.run(); } } index++; //next index int localIndex = index; subscribeNext(); //next subscription }
public void onNext(IN e){ emitted(1); if(!sub.isOpen){ return; } try { onNext.accept(e); } catch (Throwable t) { onError.accept(t); } }
@Override public void request(long n) { if (n <= 0) { onError.accept(new IllegalArgumentException("3.9 While the Subscription is not cancelled, Subscription.request(long n) MUST throw a java.lang.IllegalArgumentException if the argument is <= 0.")); return; } super.request(n); ref[0].request(n); }
if (decrementAndCheckActive()) { addMissingRequests(); if(incrementAndCheckInactive()){ addMissingRequests();
public Concat(StreamSubscription sub, Seq<Operator<IN>> operators, Consumer<? super IN> onNext, Consumer<? super Throwable> onError, Runnable onComplete) { this.sub = sub; this.operators = operators; this.onNext = onNext; this.onError = onError; this.onComplete = onComplete; this.subscribeNext(); }
public void onError(Throwable t){ emitted(1); onError.accept(t); }
@Override public void cancel() { ref[0].cancel(); super.cancel(); } };
@Override public StreamSubscription subscribe(Consumer<? super IN> onNext, Consumer<? super Throwable> onError, Runnable onComplete) { BankersQueue<StreamSubscription> subs = BankersQueue.empty(); int index[] = {0}; boolean[] finished = {false}; Concat[] ref = {null}; StreamSubscription sub = new StreamSubscription() { @Override public void request(long n) { if (n <= 0) { onError.accept(new IllegalArgumentException("3.9 While the Subscription is not cancelled, Subscription.request(long n) MUST throw a java.lang.IllegalArgumentException if the argument is <= 0.")); return; } super.request(n); ref[0].request(n); } @Override public void cancel() { ref[0].cancel(); super.cancel(); } }; Concat c = new Concat(sub,operators,onNext,onError,onComplete); ref[0]=c; return sub; }
if (decrementAndCheckActive()) { this.addMissingRequests(); if(incrementAndCheckInactive()){ this.addMissingRequests(); return false;
public void onComplete(){ //check complete if(index==operators.size()){ if(!finished) { finished = true; onComplete.run(); } } index++; //next index int localIndex = index; subscribeNext(); //next subscription }
public void onNext(IN e){ emitted(1); if(!sub.isOpen){ return; } try { onNext.accept(e); } catch (Throwable t) { onError.accept(t); } }
public void emitted(long n) { if (processAll) { return; } if (wip.compareAndSet(0, 1)) { requested.accumulateAndGet(n,(a,b)->a-b); if (decrementAndCheckActive()) { addMissingRequests(); } }else { produced.accumulateAndGet(n, (a, b) -> a + b); if (incrementAndCheckInactive()) { addMissingRequests(); } } }
if (decrementAndCheckActive()) { addMissingRequests(); if(incrementAndCheckInactive()){ addMissingRequests();
if (decrementAndCheckActive()) { this.addMissingRequests(); if(incrementAndCheckInactive()){ this.addMissingRequests(); return false;