rx

Class Subscriber<T>

    • Method Summary

      Modifier and Type Method and Description
      void add(Subscription s)
      Adds a Subscription to this Subscriber's list of subscriptions if this list is not marked as unsubscribed.
      boolean isUnsubscribed()
      Indicates whether this Subscriber has unsubscribed from its list of subscriptions.
      void onStart()
      This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber.
      protected void request(long n)
      Request a certain maximum number of emitted items from the Observable this Subscriber is subscribed to.
      void setProducer(Producer producer)
       
      void unsubscribe()
      Stops the receipt of notifications on the Subscriber that was registered when this Subscription was received.
    • Constructor Detail

      • Subscriber

        protected Subscriber()
      • Subscriber

        protected Subscriber(Subscriber<?> op)
    • Method Detail

      • add

        public final void add(Subscription s)
        Adds a Subscription to this Subscriber's list of subscriptions if this list is not marked as unsubscribed. If the list is marked as unsubscribed, add will indicate this by explicitly unsubscribing the new Subscription as well.
        Parameters:
        s - the Subscription to add
      • unsubscribe

        public final void unsubscribe()
        Description copied from interface: Subscription
        Stops the receipt of notifications on the Subscriber that was registered when this Subscription was received.

        This allows unregistering an Subscriber before it has finished receiving all events (i.e. before onCompleted is called).

      • isUnsubscribed

        public final boolean isUnsubscribed()
        Indicates whether this Subscriber has unsubscribed from its list of subscriptions.
        Specified by:
        isUnsubscribed in interface  Subscription
        Returns:
        true if this Subscriber has unsubscribed from its subscriptions, false otherwise
      • onStart

        public void onStart()
        This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber. Override this method to add any useful initialization to your subscription, for instance to initiate backpressure.
      • request

        protected final void request(long n)
        Request a certain maximum number of emitted items from the Observable this Subscriber is subscribed to. This is a way of requesting backpressure. To disable backpressure, pass Long.MAX_VALUE to this method.
        Parameters:
        n - the maximum number of items you want the Observable to emit to the Subscriber at this time, or Long.MAX_VALUE if you want the Observable to emit items at its own pace
      • setProducer

        public void setProducer(Producer producer)
        Parameters:
        producer -