Class SingleSubscriberPublisher<T>

  • Type Parameters:
    T - the type of element signaled.
    All Implemented Interfaces:
    org.reactivestreams.Publisher<T>

    public abstract class SingleSubscriberPublisher<T>
    extends java.lang.Object
    implements org.reactivestreams.Publisher<T>
    A Publisher that only allows a single Subscriber.
    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.reactivestreams.Subscription EMPTY_SUBSCRIPTION  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.Optional<org.reactivestreams.Subscriber<? super T>> currentSubscriber()  
      protected abstract void doSubscribe​(org.reactivestreams.Subscriber<? super T> subscriber)
      Override to implement Publisher.subscribe(Subscriber).
      void subscribe​(org.reactivestreams.Subscriber<? super T> subscriber)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY_SUBSCRIPTION

        protected static final org.reactivestreams.Subscription EMPTY_SUBSCRIPTION
    • Constructor Detail

      • SingleSubscriberPublisher

        public SingleSubscriberPublisher()
    • Method Detail

      • subscribe

        public final void subscribe​(org.reactivestreams.Subscriber<? super T> subscriber)
        Specified by:
        subscribe in interface org.reactivestreams.Publisher<T>
      • doSubscribe

        protected abstract void doSubscribe​(org.reactivestreams.Subscriber<? super T> subscriber)
        Override to implement Publisher.subscribe(Subscriber).
        Parameters:
        subscriber - The subscriber
        See Also:
        Publisher.subscribe(Subscriber)
      • currentSubscriber

        protected java.util.Optional<org.reactivestreams.Subscriber<? super T>> currentSubscriber()
        Returns:
        Obtain the current subscriber