code: public static boolean setOnce(AtomicReference<Subscription> upstream, Subscription next, Class<?> subscriber) {
      AutoDisposeUtil.checkNotNull(next, "next is null");
      if (!upstream.compareAndSet(null, next)) {
        next.cancel();
        if (upstream.get() != AutoSubscriptionHelper.CANCELLED) {
          reportDoubleSubscription(subscriber);
        }
        return false;
      }
      return true;
    }
docs: Atomically updates the target upstream AtomicReference from null to the non-null
  next Subscription, otherwise cancels next and reports a ProtocolViolationException
  if the AtomicReference doesn't contain the shared cancelled indicator.
  
  @param upstream the target AtomicReference to update
  @param next the Subscription to set on it atomically
  @param subscriber the class of the consumer to have a personalized
  error message if the upstream already contains a non-cancelled Subscription.
  @return true if successful, false if the content of the AtomicReference was non null