@SuppressWarnings("unchecked")
    @Override
    public final void onSubscribe(Disposable d) {
        if (DisposableHelper.validate(this.upstream, d)) {

            this.upstream = d;
            if (d instanceof QueueDisposable) {
                this.qd = (QueueDisposable<T>)d;
            }

            if (beforeDownstream()) {

                downstream.onSubscribe(this);

                afterDownstream();
            }

        }
    }
@SuppressWarnings("unchecked")
    @Override
    public final void onSubscribe(Disposable d) {
        if (DisposableHelper.validate(this.upstream, d)) {

            this.upstream = d;
            if (d instanceof QueueDisposable) {
                this.qd = (QueueDisposable<T>)d;
            }

            if (beforeDownstream()) {

                downstream.onSubscribe(this);

                afterDownstream();
            }

        }
    }
@ SuppressWarnings ( "unchecked" ) @ Override public final void onSubscribe ( Disposable d ) { if ( DisposableHelper . validate ( this . upstream , d ) ) { this . upstream = d ; if ( d instanceof QueueDisposable ) { this . qd = ( QueueDisposable < T > ) d ; } if ( beforeDownstream ( ) ) { downstream . onSubscribe ( this ) ; afterDownstream ( ) ; } } }
final: fixed protocol steps to support fuseable and non-fuseable upstream
final : fixed protocol steps to support fuseable and non - fuseable upstream