reactor-core/src/main/java/reactor/core/publisher/Operators.java
public static <F> boolean terminate(AtomicReferenceFieldUpdater<F, Subscription> field,
			F instance) {
		Subscription a = field.get(instance);
		if (a != CancelledSubscription.INSTANCE) {
			a = field.getAndSet(instance, CancelledSubscription.INSTANCE);
			if (a != null && a != CancelledSubscription.INSTANCE) {
				a.cancel();
				return true;
			}
		}
		return false;
	}
public static <F> boolean terminate(AtomicReferenceFieldUpdater<F, Subscription> field,
			F instance) {
		Subscription a = field.get(instance);
		if (a != CancelledSubscription.INSTANCE) {
			a = field.getAndSet(instance, CancelledSubscription.INSTANCE);
			if (a != null && a != CancelledSubscription.INSTANCE) {
				a.cancel();
				return true;
			}
		}
		return false;
	}
Atomically terminates the subscription if it is not already a
{@link #cancelledSubscription()}, cancelling the subscription and setting the field
to the singleton {@link #cancelledSubscription()}.

@param <F> the instance type containing the field
@param field the field accessor
@param instance the parent instance
@return true if terminated, false if the subscription was already terminated