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 classNested 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 TypeMethodDescriptionvoidhandleException(TableDataException exception) Notify the listener that an exception was encountered while initiating or maintaining the subscription.voidhandleTableLocation(TableLocation tableLocation) Notify the listener of a table location encountered while initiating or maintaining the location subscription.voidhandleTableLocationRemoved(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.voidreset()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.LocationUpdatecontaining lists of added and removedTableLocations
-
reset
public void reset()Unsubscribe and clear any state pending processing. -
handleTableLocation
Description copied from interface:TableLocationProvider.ListenerNotify 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:
handleTableLocationin interfaceTableLocationProvider.Listener- Parameters:
tableLocation- The table location
-
handleTableLocationRemoved
Description copied from interface:TableLocationProvider.ListenerNotify 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:
handleTableLocationRemovedin interfaceTableLocationProvider.Listener- Parameters:
tableLocation- The table location
-
handleException
Description copied from interface:BasicTableDataListenerNotify 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:
handleExceptionin interfaceBasicTableDataListener- Parameters:
exception- The exception
-