Package com.illumon.iris.db.v2.locations
Class TableLocationUpdateSubscriptionBuffer
java.lang.Object
com.illumon.iris.db.v2.locations.TableLocationUpdateSubscriptionBuffer
- All Implemented Interfaces:
BasicTableDataListener
,TableLocation.Listener
public class TableLocationUpdateSubscriptionBuffer extends Object implements TableLocation.Listener
Intermediates between push-based subscription to a TableLocation and polling on LiveTable refresh.
-
Constructor Summary
Constructors Constructor Description TableLocationUpdateSubscriptionBuffer(TableLocation tableLocation)
-
Method Summary
Modifier and Type Method Description void
handleException(TableDataException exception)
Notify the listener that an exception was encountered while initiating or maintaining the subscription.void
handleUpdate()
Notify the listener that the table location has been updated.boolean
processPending()
Subscribe if needed, and return whether there was a pending update to the table location, or throw a pending exception.void
reset()
Unsubscribe and clear any state pending processing.
-
Constructor Details
-
Method Details
-
processPending
public boolean processPending()Subscribe if needed, and return whether there was a pending update to the table location, or throw a pending exception. If a pending exception is thrown, this signals that the subscription is no longer valid and no subsequent pending updates will be returned.- Returns:
- Whether there was a pending update
-
reset
public void reset()Unsubscribe and clear any state pending processing. -
handleUpdate
public void handleUpdate()Description copied from interface:TableLocation.Listener
Notify the listener that the table location has been updated. This may be called "spuriously," i.e. in cases where there has been no substantive update since the last handleUpdate() invocation. Implementations should use appropriate measures to avoid reacting to spurious updates.- Specified by:
handleUpdate
in interfaceTableLocation.Listener
-
handleException
Description copied from interface:BasicTableDataListener
Notify the listener that an exception was encountered while initiating or maintaining the subscription. Delivery of an exception implies that the subscription is no longer valid. This might happen during subscription establishment, and consequently should be checked for after subscribe completes.- Specified by:
handleException
in interfaceBasicTableDataListener
- Parameters:
exception
- The exception
-