public static <F> boolean setOnce(AtomicReferenceFieldUpdater<F, Subscription> field, F instance, Subscription s) {
    """
	Sets the given subscription once and returns true if successful, false
	if the field has a subscription already or has been cancelled.
	<p>
	If the field already has a subscription, it is cancelled and the duplicate
	subscription is reported (see {@link #reportSubscriptionSet()}).
	
	@param <F> the instance type containing the field
	@param field the field accessor
	@param instance the parent instance
	@param s the subscription to set once
	@return true if successful, false if the target was not empty or has been cancelled
    """
		Objects.requireNonNull(s, "subscription");
		Subscription a = field.get(instance);
		if (a == CancelledSubscription.INSTANCE) {
			s.cancel();
			return false;
		}
		if (a != null) {
			s.cancel();
			reportSubscriptionSet();
			return false;
		}

		if (field.compareAndSet(instance, null, s)) {
			return true;
		}

		a = field.get(instance);

		if (a == CancelledSubscription.INSTANCE) {
			s.cancel();
			return false;
		}

		s.cancel();
		reportSubscriptionSet();
		return false;
	}
public static <F> boolean setOnce(AtomicReferenceFieldUpdater<F, Subscription> field, F instance, Subscription s) {
		Objects.requireNonNull(s, "subscription");
		Subscription a = field.get(instance);
		if (a == CancelledSubscription.INSTANCE) {
			s.cancel();
			return false;
		}
		if (a != null) {
			s.cancel();
			reportSubscriptionSet();
			return false;
		}

		if (field.compareAndSet(instance, null, s)) {
			return true;
		}

		a = field.get(instance);

		if (a == CancelledSubscription.INSTANCE) {
			s.cancel();
			return false;
		}

		s.cancel();
		reportSubscriptionSet();
		return false;
	}
public static < F > boolean setOnce ( AtomicReferenceFieldUpdater < F , Subscription > field , F instance , Subscription s ) { Objects . requireNonNull ( s , "subscription" ) ; Subscription a = field . get ( instance ) ; if ( a == CancelledSubscription . INSTANCE ) { s . cancel ( ) ; return false ; } if ( a != null ) { s . cancel ( ) ; reportSubscriptionSet ( ) ; return false ; } if ( field . compareAndSet ( instance , null , s ) ) { return true ; } a = field . get ( instance ) ; if ( a == CancelledSubscription . INSTANCE ) { s . cancel ( ) ; return false ; } s . cancel ( ) ; reportSubscriptionSet ( ) ; return false ; }
Sets the given subscription once and returns true if successful, false
if the field has a subscription already or has been cancelled.
<p>
If the field already has a subscription, it is cancelled and the duplicate
subscription is reported (see {@link #reportSubscriptionSet()}).

@param <F> the instance type containing the field
@param field the field accessor
@param instance the parent instance
@param s the subscription to set once
@return true if successful, false if the target was not empty or has been cancelled
Sets the given subscription once and returns true if successful false if the field has a subscription already or has been cancelled . <p > If the field already has a subscription it is cancelled and the duplicate subscription is reported ( see { @link #reportSubscriptionSet () } ) .