Class BarrageMessageProducer

All Implemented Interfaces:
LogOutputAppendable, LivenessManager, LivenessNode, LivenessReferent, NotificationStepReceiver, DynamicNode, Serializable

public class BarrageMessageProducer extends LivenessArtifact implements DynamicNode, NotificationStepReceiver
The server-side implementation of a Barrage replication source.

When a client subscribes initially, a snapshot of the table is sent. The snapshot is obtained using either get() or getPrev() based on the state of the LogicalClock. On each subsequent update, the client is given the deltas between the last update propagation and the next.

When a client changes its subscription it will be sent a snapshot of only the data that the server believes it needs assuming that the client has been respecting the existing subscription. Practically, this means that the server may omit some data if the client's viewport change overlaps the currently recognized viewport.

It is possible to use this replication source to create subscriptions that propagate changes from one UGP to another inside the same JVM.

The client-side counterpart of this is the StreamReader.

See Also:
  • Field Details

    • SUBSCRIPTION_GROWTH_ENABLED

      public static final boolean SUBSCRIPTION_GROWTH_ENABLED
  • Constructor Details

  • Method Details

    • getRowSet

      public RowSet getRowSet()
    • getTableDefinition

      public TableDefinition getTableDefinition()
    • setOnGetSnapshot

      public void setOnGetSnapshot(Runnable onGetSnapshot, boolean isPreSnap)
    • addSubscription

      public void addSubscription(io.grpc.stub.StreamObserver<BarrageStreamGenerator.MessageView> listener, BarrageSubscriptionOptions options, @Nullable @Nullable BitSet columnsToSubscribe, @Nullable @Nullable RowSet initialViewport, boolean reverseViewport)
      Add a subscription to this BarrageMessageProducer.
      Parameters:
      listener - The listener for this subscription
      options - The subscription options
      columnsToSubscribe - The initial columns to subscribe to
      initialViewport - Initial viewport, to be owned by the subscription
    • updateSubscription

      public boolean updateSubscription(io.grpc.stub.StreamObserver<BarrageStreamGenerator.MessageView> listener, @Nullable @Nullable RowSet newViewport, @Nullable @Nullable BitSet columnsToSubscribe)
    • updateSubscription

      public boolean updateSubscription(io.grpc.stub.StreamObserver<BarrageStreamGenerator.MessageView> listener, @Nullable @Nullable RowSet newViewport, @Nullable @Nullable BitSet columnsToSubscribe, boolean newReverseViewport)
    • removeSubscription

      public void removeSubscription(io.grpc.stub.StreamObserver<BarrageStreamGenerator.MessageView> listener)
    • constructListener

      public InstrumentedTableUpdateListener constructListener()
    • destroy

      protected void destroy()
      Description copied from class: ReferenceCountedLivenessReferent
      Attempt to release (destructively when necessary) resources held by this object. This may render the object unusable for subsequent operations. Implementations should be sure to call super.destroy().

      This is intended to only ever be used as a side effect of decreasing the reference count to 0.

      Overrides:
      destroy in class ReferenceCountedLivenessReferent
    • isRefreshing

      public boolean isRefreshing()
      Description copied from interface: DynamicNode
      Is the node updating?
      Specified by:
      isRefreshing in interface DynamicNode
      Returns:
      true if the node is updating; false otherwise.
    • setRefreshing

      public boolean setRefreshing(boolean refreshing)
      Description copied from interface: DynamicNode
      Change the node's run mode.
      Specified by:
      setRefreshing in interface DynamicNode
      Parameters:
      refreshing - true to cause the node to update; false otherwise.
      Returns:
      new refreshing state
    • addParentReference

      public void addParentReference(Object parent)
      Description copied from interface: DynamicNode
      Called on a dependent node to ensure that a strong reference is maintained to any parent object that is required for the proper maintenance and functioning of the dependent. In the most common case, the parent object is a child listener to a parent node. The parent node only keeps a weak reference to its child listener, but the listener maintains a strong reference to the parent node. In this scenario, the only strong reference to the listener (and thus indirectly to the parent node itself) is the reference kept by the dependent node.
      Specified by:
      addParentReference in interface DynamicNode
      Parameters:
      parent - A parent of this node
    • setLastNotificationStep

      public void setLastNotificationStep(long lastNotificationStep)
      Description copied from interface: NotificationStepReceiver
      Deliver a last notification step to this receiver.
      Specified by:
      setLastNotificationStep in interface NotificationStepReceiver
      Parameters:
      lastNotificationStep - The last notification step to be delivered