Package com.illumon.iris.db.v2.locations
Class TableLocationSubscriptionBuffer
java.lang.Object
com.illumon.iris.db.v2.locations.TableLocationSubscriptionBuffer
- All Implemented Interfaces:
BasicTableDataListener
,TableLocationProvider.Listener
public class TableLocationSubscriptionBuffer
extends Object
implements TableLocationProvider.Listener
Intermediates between push-based subscription to a TableLocationProvider and polling on LiveTable refresh.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.locations.TableLocationProvider.Listener
TableLocationProvider.Listener.NullListener
-
Constructor Summary
ConstructorsConstructorDescriptionTableLocationSubscriptionBuffer
(TableLocationProvider tableLocationProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoid
handleException
(TableDataException exception) Notify the listener that an exception was encountered while initiating or maintaining the subscription.void
handleTableLocation
(TableLocation tableLocation) Notify the listener of a table location encountered while initiating or maintaining the location subscription.void
handleTableLocationRemoved
(TableLocation tableLocation) Notify the listener of a table location that has been removed encountered while initiating or maintaining the location subscription.Subscribe if needed, and return any pending locations (or throw a pending exception) from the table location provider.void
reset()
Unsubscribe and clear any state pending processing.
-
Constructor Details
-
TableLocationSubscriptionBuffer
-
-
Method Details
-
processPending
Subscribe if needed, and return any pending locations (or throw a pending exception) from the table location provider. A given location will only be returned by a single call to processPending() (unless state is reset). No order is maintained internally. If a pending exception is thrown, this signals that the subscription is no longer valid and no subsequent locations will be returned.- Returns:
- A
TableLocationSubscriptionBuffer.LocationUpdate
containing lists of added and removedTableLocation
s
-
reset
public void reset()Unsubscribe and clear any state pending processing. -
handleTableLocation
Description copied from interface:TableLocationProvider.Listener
Notify the listener of a table location encountered while initiating or maintaining the location subscription. This should occur at most once per location, but the order of delivery is not guaranteed.- Specified by:
handleTableLocation
in interfaceTableLocationProvider.Listener
- Parameters:
tableLocation
- The table location
-
handleTableLocationRemoved
Description copied from interface:TableLocationProvider.Listener
Notify the listener of a table location that has been removed encountered while initiating or maintaining the location subscription. This should occur at most once per location, but the order of delivery is not guaranteed.- Specified by:
handleTableLocationRemoved
in interfaceTableLocationProvider.Listener
- Parameters:
tableLocation
- The table location
-
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
-