src/main/java/io/reactivex/internal/util/EndConsumerHelper.java
public static boolean validate(Disposable upstream, Disposable next, Class<?> observer) {
        ObjectHelper.requireNonNull(next, "next is null");
        if (upstream != null) {
            next.dispose();
            if (upstream != DisposableHelper.DISPOSED) {
                reportDoubleSubscription(observer);
            }
            return false;
        }
        return true;
    }
public static boolean validate(Disposable upstream, Disposable next, Class<?> observer) {
        ObjectHelper.requireNonNull(next, "next is null");
        if (upstream != null) {
            next.dispose();
            if (upstream != DisposableHelper.DISPOSED) {
                reportDoubleSubscription(observer);
            }
            return false;
        }
        return true;
    }
Ensures that the upstream Disposable is null and returns true, otherwise
disposes the next Disposable and if the upstream is not the shared
disposed instance, reports a ProtocolViolationException due to
multiple subscribe attempts.
@param upstream the upstream current value
@param next the Disposable to check for nullness and dispose if necessary
@param observer the class of the consumer to have a personalized
error message if the upstream already contains a non-cancelled Disposable.
@return true if successful, false if the upstream was non null