@Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.validateSubscription(this.s, s)) { return; } this.s = s; Subscriber<? super U> actual = this.actual; U b; try { b = bufferSupplier.get(); } catch (Throwable e) { cancelled = true; s.cancel(); EmptySubscription.error(e, actual); return; } if (b == null) { cancelled = true; s.cancel(); EmptySubscription.error(new NullPointerException("The buffer supplied is null"), actual); return; } buffer = b; Publisher<B> boundary; try { boundary = boundarySupplier.get(); } catch (Throwable ex) { cancelled = true; s.cancel(); EmptySubscription.error(ex, actual); return; } if (boundary == null) { cancelled = true; s.cancel(); EmptySubscription.error( new NullPointerException("The boundary publisher supplied is null"), actual); return; } BufferBoundarySubscriber<T, U, B> bs = new BufferBoundarySubscriber<T, U, B>(this); other = bs; actual.onSubscribe(this); if (!cancelled) { s.request(Long.MAX_VALUE); boundary.subscribe(bs); } }
@Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.validateSubscription(this.s, s)) { return; } this.s = s; actual.onSubscribe(s); }