src/main/java/io/reactivex/processors/UnicastProcessor.java
@CheckReturnValue
    @NonNull
    public static <T> UnicastProcessor<T> create(int capacityHint, Runnable onCancelled) {
        ObjectHelper.requireNonNull(onCancelled, "onTerminate");
        return new UnicastProcessor<T>(capacityHint, onCancelled);
    }
@CheckReturnValue
    @NonNull
    public static <T> UnicastProcessor<T> create(int capacityHint, Runnable onCancelled) {
        ObjectHelper.requireNonNull(onCancelled, "onTerminate");
        return new UnicastProcessor<T>(capacityHint, onCancelled);
    }
Creates an UnicastProcessor with the given internal buffer capacity hint and a callback for
the case when the single Subscriber cancels its subscription.

<p>The callback, if not null, is called exactly once and
non-overlapped with any active replay.

@param <T> the value type
@param capacityHint the hint to size the internal unbounded buffer
@param onCancelled the non null callback
@return an UnicastProcessor instance