Class ListenerRecorder

All Implemented Interfaces:
LogOutputAppendable, LivenessManager, LivenessNode, LivenessReferent, TableListener, TableUpdateListener, NotificationQueue.Dependency, Serializable
Direct Known Subclasses:
JoinListenerRecorder

public class ListenerRecorder extends InstrumentedTableUpdateListener
A listener recorder stores references to added, removed, modified, and shifted indices; and then notifies a MergedListener that a change has occurred. The combination of a ListenerRecorder and MergedListener should be used when a table has multiple sources, such that each table can process all of its dependencies at once and fire a single notification to its children.
See Also:
  • Field Details

    • parent

      protected final Table parent
    • logPrefix

      protected final String logPrefix
  • Constructor Details

    • ListenerRecorder

      public ListenerRecorder(@NotNull @NotNull String description, @NotNull @NotNull Table parent, @Nullable @Nullable Object dependent)
  • Method Details

    • getParent

      public Table getParent()
    • release

      public void release()
    • onUpdate

      public void onUpdate(TableUpdate upstream)
      Description copied from interface: TableUpdateListener
      Process notification of table changes.

      The TableUpdateListener onUpdate call executes within the UpdateGraph refresh loop. Any tables used within the listener's onUpdate call must have already been refreshed. Using the typical pattern of a Listener that is listening to a single table, with Table.addUpdateListener(TableUpdateListener), this is trivially true.

      When the listener must reference more than just one parent, the tables (or other objects) it references, must be made a NotificationQueue.Dependency of the listener. For listeners that reference multiple ticking tables, a common pattern is to use a MergedListener and collection of ListenerRecorders.

      Parameters:
      upstream - The set of upstream table updates.
    • onFailureInternal

      protected void onFailureInternal(@NotNull @NotNull Throwable originalException, @Nullable @Nullable TableListener.Entry sourceEntry)
      Specified by:
      onFailureInternal in class InstrumentedTableListenerBase
    • setNotificationStep

      protected void setNotificationStep(long step)
    • canExecute

      public boolean canExecute(long step)
      Overrides:
      canExecute in class InstrumentedTableListenerBase
    • 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
    • recordedVariablesAreValid

      public boolean recordedVariablesAreValid()
    • setMergedListener

      public void setMergedListener(MergedListener mergedListener)
    • getNotificationStep

      public long getNotificationStep()
    • getAdded

      public RowSet getAdded()
    • getRemoved

      public RowSet getRemoved()
    • getModified

      public RowSet getModified()
    • getModifiedPreShift

      public RowSet getModifiedPreShift()
    • getShifted

      public RowSetShiftData getShifted()
    • getModifiedColumnSet

      public ModifiedColumnSet getModifiedColumnSet()
    • getUpdate

      public TableUpdate getUpdate()