Class MultipleAssignmentSubscription

  • All Implemented Interfaces:
    Subscription

    public final class MultipleAssignmentSubscription
    extends java.lang.Object
    implements Subscription
    Subscription that can be checked for status such as in a loop inside an Observable to exit the loop if unsubscribed.
    • Constructor Detail

      • MultipleAssignmentSubscription

        public MultipleAssignmentSubscription()
    • Method Detail

      • isUnsubscribed

        public boolean isUnsubscribed()
        Description copied from interface: Subscription
        Indicates whether this Subscription is currently unsubscribed.
        Specified by:
        isUnsubscribed in interface Subscription
        Returns:
        true if this Subscription is currently unsubscribed, false otherwise
      • unsubscribe

        public 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).

        Specified by:
        unsubscribe in interface Subscription
      • set

        public void set​(Subscription s)
        Sets the underlying subscription. If the MultipleAssignmentSubscription is already unsubscribed, setting a new subscription causes the new subscription to also be immediately unsubscribed.
        Parameters:
        s - the Subscription to set
        Throws:
        java.lang.IllegalArgumentException - if s is null
      • get

        public Subscription get()
        Gets the underlying subscription.
        Returns:
        the Subscription that underlies the MultipleAssignmentSubscription