Class BaseTable.ListenerImpl

All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable, NotificationQueue.Dependency, LivenessManager, LivenessNode, LivenessReferent, Listener, ListenerBase, Serializable
Enclosing class:
BaseTable

public static class BaseTable.ListenerImpl extends InstrumentedListener
Simplest appropriate legacy InstrumentedListener implementation for BaseTable and descendants. It's expected that most use-cases will require overriding onUpdate() - the default implementation simply passes index updates through to the dependent's listeners. It is preferred to use BaseTable.ShiftAwareListenerImpl over BaseTable.ListenerImpl
See Also:
  • Constructor Details

  • Method Details

    • onUpdate

      public void onUpdate(Index added, Index removed, Index modified)
      Description copied from interface: Listener
      Process notification of table changes.

      The Listener onUpdate call executes within the LiveTableMonitor 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 DynamicTable.listenForUpdates(Listener), 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:
      added - rows added
      removed - rows removed
      modified - rows modified
    • onFailureInternal

      public final void onFailureInternal(Throwable originalException, UpdatePerformanceTracker.Entry sourceEntry)
      Specified by:
      onFailureInternal in class InstrumentedListenerBase
    • canExecute

      public boolean canExecute(long step)
      Description copied from class: InstrumentedListenerBase
      Check if this listener is ready to execute.
      Overrides:
      canExecute in class InstrumentedListenerBase
      Returns:
      if this listener is ready to execute
    • destroy

      protected void destroy()
      Description copied from class: ReferenceCountedLivenessNode

      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 ReferenceCountedLivenessNode