Class OperatorReplay.BoundedReplayBuffer<T>

java.lang.Object
java.util.concurrent.atomic.AtomicReference<OperatorReplay.Node>
rx.internal.operators.OperatorReplay.BoundedReplayBuffer<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
Serializable, OperatorReplay.ReplayBuffer<T>
Direct Known Subclasses:
OperatorReplay.SizeAndTimeBoundReplayBuffer, OperatorReplay.SizeBoundReplayBuffer
Enclosing class:
OperatorReplay<T>

static class OperatorReplay.BoundedReplayBuffer<T> extends AtomicReference<OperatorReplay.Node> implements OperatorReplay.ReplayBuffer<T>
Base class for bounded buffering with options to specify an enter and leave transforms and custom truncation behavior.
  • Field Details

  • Constructor Details

    • BoundedReplayBuffer

      public BoundedReplayBuffer()
  • Method Details

    • addLast

      final void addLast(OperatorReplay.Node n)
      Add a new node to the linked list.
      Parameters:
      n -
    • removeFirst

      final void removeFirst()
      Remove the first node from the linked list.
    • removeSome

      final void removeSome(int n)
    • setFirst

      final void setFirst(OperatorReplay.Node n)
      Arranges the given node is the new head from now on.
      Parameters:
      n -
    • getInitialHead

      OperatorReplay.Node getInitialHead()
      Returns the current head for initializing the replay location for a new subscriber. Override it to consider linked but outdated elements.
      Returns:
      the current head
    • next

      public final void next(T value)
      Description copied from interface: OperatorReplay.ReplayBuffer
      Adds a regular value to the buffer.
      Specified by:
      next in interface OperatorReplay.ReplayBuffer<T>
      Parameters:
      value -
    • error

      public final void error(Throwable e)
      Description copied from interface: OperatorReplay.ReplayBuffer
      Adds a terminal exception to the buffer
      Specified by:
      error in interface OperatorReplay.ReplayBuffer<T>
      Parameters:
      e -
    • complete

      public final void complete()
      Description copied from interface: OperatorReplay.ReplayBuffer
      Adds a completion event to the buffer
      Specified by:
      complete in interface OperatorReplay.ReplayBuffer<T>
    • replay

      public final void replay(OperatorReplay.InnerProducer<T> output)
      Description copied from interface: OperatorReplay.ReplayBuffer
      Tries to replay the buffered values to the subscriber inside the output if there is new value and requests available at the same time.
      Specified by:
      replay in interface OperatorReplay.ReplayBuffer<T>
      Parameters:
      output -
    • enterTransform

      Object enterTransform(Object value)
      Override this to wrap the NotificationLite object into a container to be used later by truncate.
      Parameters:
      value -
      Returns:
    • leaveTransform

      Object leaveTransform(Object value)
      Override this to unwrap the transformed value into a NotificationLite object.
      Parameters:
      value -
      Returns:
    • truncate

      void truncate()
      Override this method to truncate a non-terminated buffer based on its current properties.
    • truncateFinal

      void truncateFinal()
      Override this method to truncate a terminated buffer based on its properties (i.e., truncate but the very last node).
    • collect

      final void collect(Collection<? super T> output)
    • hasError

      boolean hasError()
    • hasCompleted

      boolean hasCompleted()