class UniSerializedSubscriber implements UniSubscriber<T>, UniSubscription {

    @Override
    public void onSubscribe(UniSubscription subscription) {
        ParameterValidation.nonNull(subscription, "subscription");

        if (state.compareAndSet(SUBSCRIBED, HAS_SUBSCRIPTION)) {
            this.subscription = subscription;
            this.downstream.onSubscribe(this);
        } else if (state.get() == DONE) {
            Throwable collected = failure.getAndSet(null);
            if (collected != null) {
                this.downstream.onSubscribe(this);
                this.downstream.onFailure(collected);
            }
        } else {
            EmptyUniSubscription.propagateFailureEvent(this.downstream,
                    new IllegalStateException(
                            "Invalid transition, expected to be in the SUBSCRIBED state but was in " + state));
        }
    }

      UniSerializedSubscriber(AbstractUni<T> upstream, UniSubscriber<? super T> subscriber);

}