void requestUpstream(final long n, final Subscription s) { if (!requestOnSeparateThread || Thread.currentThread() == THREAD.get(this)) { s.request(n); } else { try { worker.schedule(() -> s.request(n)); } catch (RejectedExecutionException ree) { if(!worker.isDisposed()) { //FIXME should not throw but if we implement strict // serialization like in StrictSubscriber, onNext will carry an // extra cost throw Operators.onRejectedExecution(ree, this, null, null, actual.currentContext()); } } } }
void trySchedule(long n, Subscription s) { if (Thread.currentThread() == THREAD.get(this)) { s.request(n); } else { try { worker.schedule(() -> s.request(n)); } catch (RejectedExecutionException ree) { if (!worker.isDisposed()) { actual.onError(Operators.onRejectedExecution(ree, this, null, null, actual.currentContext())); } } } }
assertThat(w.isDisposed()).isFalse(); assertThat(w.isDisposed()).isTrue();
void trySchedule(long n, Subscription s) { if (Thread.currentThread() == THREAD.get(this)) { s.request(n); } else { try { worker.schedule(() -> s.request(n)); } catch (RejectedExecutionException ree) { if (!worker.isDisposed()) { actual.onError(Operators.onRejectedExecution(ree, this, null, null, actual.currentContext())); } } } }
void requestUpstream(final long n, final Subscription s) { if (!requestOnSeparateThread || Thread.currentThread() == THREAD.get(this)) { s.request(n); } else { try { worker.schedule(() -> s.request(n)); } catch (RejectedExecutionException ree) { if(!worker.isDisposed()) { //FIXME should not throw but if we implement strict // serialization like in StrictSubscriber, onNext will carry an // extra cost throw Operators.onRejectedExecution(ree, this, null, null, actual.currentContext()); } } } }
@Override public boolean isDisposed() { return delegateWorker.isDisposed(); }
@Override public boolean isDisposed() { return actual.isDisposed(); }
@Override public boolean isDisposed() { return main.isDisposed(); }
@Override public boolean isDisposed() { return actual.isDisposed(); }
@Override public Object scanUnsafe(Attr key) { if (key == Attr.PARENT) return s; if (key == Attr.RUN_ON) return w; if (key == Attr.TERMINATED) return done; if (key == Attr.CANCELLED) return w.isDisposed() && !done; return InnerOperator.super.scanUnsafe(key); }
Scheduler.Worker w = s.createWorker(); assertThat(w.isDisposed()).isFalse(); CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch2 = shouldCheckDisposeTask() ? new CountDownLatch(1) assertThat(w.isDisposed()).isTrue();
assertThat(w.isDisposed()).isFalse(); assertThat(w.isDisposed()).isTrue();
@Override public boolean isDisposed() { return main.isDisposed(); }
@Override public Object scanUnsafe(Attr key) { if (key == Attr.PARENT) return s; if (key == Attr.RUN_ON) return w; if (key == Attr.TERMINATED) return done; if (key == Attr.CANCELLED) return w.isDisposed() && !done; return InnerOperator.super.scanUnsafe(key); }