Class OperatorReplay.ReplaySubscriber<T>

    • Field Detail

      • done

        boolean done
        Contains either an onCompleted or an onError token from upstream.
      • terminated

        volatile boolean terminated
        Indicates no further InnerProducers are accepted.
      • producersVersion

        volatile long producersVersion
        Contains number of modifications to the producers set.
      • producersCacheVersion

        long producersCacheVersion
        Contains the number of modifications that the producersCache holds.
      • shouldConnect

        final java.util.concurrent.atomic.AtomicBoolean shouldConnect
        Atomically changed from false to true by connect to make sure the connection is only performed by one thread.
      • emitting

        boolean emitting
        Guarded by this.
      • missed

        boolean missed
        Guarded by this.
      • maxChildRequested

        long maxChildRequested
        Contains the maximum element index the child Subscribers requested so far. Accessed while emitting is true.
      • maxUpstreamRequested

        long maxUpstreamRequested
        Counts the outstanding upstream requests until the producer arrives.
      • producer

        volatile Producer producer
        The upstream producer.
      • coordinationQueue

        java.util.List<OperatorReplay.InnerProducer<T>> coordinationQueue
        The queue that holds producers with request changes that need to be coordinated.
      • coordinateAll

        boolean coordinateAll
        Indicate that all request amounts should be considered.
    • Method Detail

      • init

        void init()
        Should be called after the constructor finished to setup nulling-out the current reference.
      • add

        boolean add​(OperatorReplay.InnerProducer<T> producer)
        Atomically try adding a new InnerProducer to this Subscriber or return false if this Subscriber was terminated.
        Parameters:
        producer - the producer to add
        Returns:
        true if succeeded, false otherwise
      • remove

        void remove​(OperatorReplay.InnerProducer<T> producer)
        Atomically removes the given producer from the producers array.
        Parameters:
        producer - the producer to remove
      • setProducer

        public void setProducer​(Producer p)
        Description copied from class: Subscriber
        If other subscriber is set (by calling constructor Subscriber(Subscriber) or Subscriber(Subscriber, boolean)) then this method calls setProducer on the other subscriber. If the other subscriber is not set and no requests have been made to this subscriber then p.request(Long.MAX_VALUE) is called. If the other subscriber is not set and some requests have been made to this subscriber then p.request(n) is called where n is the accumulated requests to this subscriber.
        Overrides:
        setProducer in class Subscriber<T>
        Parameters:
        p - producer to be used by this subscriber or the other subscriber (or recursively its other subscriber) to make requests from
      • makeRequest

        void makeRequest​(long maxTotalRequests,
                         long previousTotalRequests)
      • replay

        void replay()
        Tries to replay the buffer contents to all known subscribers.