Class ConnectionAwareRemoteTable
java.lang.Object
com.illumon.util.referencecounting.ReferenceCounted
com.illumon.iris.db.util.liveness.LivenessArtifact
com.illumon.iris.db.v2.BaseTable
com.illumon.iris.db.v2.QueryTable
com.illumon.iris.controller.utils.ConnectionAwareRemoteTable
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,LiveTable,NotificationQueue.Dependency,Deflatable<Table>,Table,LivenessManager,LivenessNode,LivenessReferent,LongSizedDataStructure,DynamicNode,DynamicTable,NotificationStepReceiver,NotificationStepSource,SystemicObject,Serializable
public class ConnectionAwareRemoteTable extends QueryTable implements LiveTable
Given the name of a persistent query, plus a prototype or definition of the table to be returned,
connect to it and fetch a preemptive table by name.
In the event that the underlying persistent query cannot be uniquely identified, fail hard.
In the event that the underlying persistent query is not running, return the prototype table (no rows).
If the underlying persistent query fails while this table is connected, then this will either:
1. Immediately inform clients that all rows have been removed. If the underlying persistent query then reconnects,
this will inform clients that new rows have been added at that time.
2. Simply stop sending out updates, but leave the existing data in place. If the underlying persistent query then
reconnects, at THAT time inform clients that all rows have been removed, then add all the rows from the restarted
query.
In either case, if at any time the PQ definition does not match the pre-existing definition, then explode.
Specifically, the PQ must have all of the columns called for by the ConnectionAwareRemoteTable, all of which
must match the type specified in the pre-existing definition. If the persistent query has additional columns not
specified in the pre-existing definition, these will be ignored.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.db.v2.QueryTable
QueryTable.FilteredTable, QueryTable.MemoizableOperation, QueryTable.OperationNested classes/interfaces inherited from class com.illumon.iris.db.v2.BaseTable
BaseTable.CopyAttributeOperation, BaseTable.ListenerImpl, BaseTable.ShiftAwareListenerImpl, BaseTable.SwapListenerFactory<T extends SwapListenerBase>Nested classes/interfaces inherited from interface com.illumon.iris.db.tables.Table
Table.AsOfMatchRule, Table.GroupStrategy, Table.RenameFunction -
Field Summary
Fields Modifier and Type Field Description static StringRECONNECT_CHECK_TIMEOUT_PROPERTYA property that can be set to make the CART automatically check after X length of time to make sure that if the underlying query never went down, then the CART will reconnect.Fields inherited from class com.illumon.iris.db.v2.QueryTable
modifiedColumnSet, USE_CHUNKED_CROSS_JOIN, USE_UNTRACKED_LASTBY_FOR_AUTOMATED_FILTERSFields inherited from class com.illumon.iris.db.v2.BaseTable
attributes, definition, description, PRINT_SERIALIZED_UPDATE_OVERLAPSFields inherited from interface com.illumon.iris.db.v2.NotificationStepReceiver
NULL_NOTIFICATION_STEPFields inherited from interface com.illumon.iris.db.tables.Table
ACL_ATTRIBUTE, ADD_ONLY_TABLE_ATTRIBUTE, COLUMN_DESCRIPTIONS_ATTRIBUTE, COLUMN_RENDERERS_ATTRIBUTE, CUSTOM_ACTIONS_ATTRIBUTE, DO_NOT_MAKE_REMOTE_ATTRIBUTE, EMPTY_SOURCE_TABLE_ATTRIBUTE, FILTERABLE_COLUMNS_ATTRIBUTE, HIERARCHICAL_CHILDREN_TABLE_MAP_ATTRIBUTE, HIERARCHICAL_SOURCE_INFO_ATTRIBUTE, HIERARCHICAL_SOURCE_TABLE_ATTRIBUTE, INPUT_TABLE_ATTRIBUTE, KEY_COLUMNS_ATTRIBUTE, LAYOUT_HINTS_ATTRIBUTE, MERGED_TABLE_ATTRIBUTE, NON_DISPLAY_TABLE, PLUGIN_NAME, PREDEFINED_ROLLUP_ATTRIBUTE, PREEMPTIVE_VIEWPORT_TYPE, PREPARED_RLL_ATTRIBUTE, PREVIEW_PARENT_TABLE, REVERSE_LOOKUP_ATTRIBUTE, ROLLUP_LEAF_ATTRIBUTE, SNAPSHOT_VIEWPORT_TYPE, SORTABLE_COLUMNS_ATTRIBUTE, SORTED_COLUMNS_ATTRIBUTE, SYSTEMIC_TABLE_ATTRIBUTE, TABLE_DESCRIPTION_ATTRIBUTE, TOTALS_TABLE_ATTRIBUTE, TREE_TABLE_FILTER_REVERSE_LOOKUP_ATTRIBUTE, UNIQUE_KEYS_ATTRIBUTE, UNTRACKED_LASTBY_TABLE_ATTRIBUTE, VIEWPORT_TYPE_ATTRIBUTE, ZERO_LENGTH_TABLE_ARRAY -
Constructor Summary
Constructors Constructor Description ConnectionAwareRemoteTable(com.fishlib.io.logger.Logger log, String owner, String queryName, String tableName, boolean clearOnDisconnect, Table prototype)Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.ConnectionAwareRemoteTable(com.fishlib.io.logger.Logger log, String owner, String queryName, String tableName, boolean clearOnDisconnect, TableDefinition definition)Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.ConnectionAwareRemoteTable(com.fishlib.io.logger.Logger log, String owner, String queryName, String tableName, boolean clearOnDisconnect, TableDefinition definition, int retryAttemptsInWindow, long retryWindowMillis)Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.ConnectionAwareRemoteTable(com.fishlib.io.logger.Logger log, String owner, String queryName, String tableName, boolean clearOnDisconnect, Table prototype, int retryAttemptsInWindow, long retryWindowMillis)Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors. -
Method Summary
Modifier and Type Method Description voiddropReference()Drop a previously-retained reference to this referent.WeakReference<? extends LivenessReferent>getWeakReference()Get aWeakReferenceto this referent.voidinitializeTransientFieldsForLiveness()Package-private forSerializablesub-classes to use inreadObjectonly.protected voidonReferenceCountAtZero()Callback method that will be invoked when the reference count returns to zero.voidrefresh()Refresh this LiveTable.StringtoString()booleantryManage(LivenessReferent referent)Attempt to add the specified referent to this manager.booleantryRetainReference()If this referent is "live", behave asLivenessReferent.retainReference()and return true.Methods inherited from class com.illumon.iris.db.v2.QueryTable
absSumBy, addColumnGrouping, aj, apply, applyToAllBy, avgBy, by, byExternal, copy, copy, countBy, disableParallelWhereForThread, disableWriteReplace, dropColumns, enableWriteReplace, exactJoin, firstBy, flatten, getColumn, getColumnSource, getColumnSourceMap, getColumnSources, getDataIndex, getIndex, getModifiedColumnSetForUpdates, getRecord, getSubTable, getSubTable, head, headBy, headPct, isFlat, join, lastBy, lazyUpdate, leftJoin, maxBy, medianBy, memoizeResult, minBy, naturalJoin, newModifiedColumnSet, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetTransformer, preemptiveSnapshotTable, preemptiveUpdatesTable, preemptiveUpdatesTable, raj, releaseCachedResources, renameColumns, reverse, rollup, select, selectDistinct, setDataIndexProvider, setFlat, setMemoizeResults, silent, size, slice, snapshot, snapshotHistory, snapshotIncremental, sort, stdBy, sumBy, tail, tailBy, tailPct, treeTable, ungroup, update, updateBy, updateView, validateSelect, varBy, view, wavgBy, where, whereIn, wouldMatch, wsumByMethods inherited from class com.illumon.iris.db.v2.BaseTable
addParentReference, append, awaitUpdate, awaitUpdate, clearSortingRestrictions, copyAttributes, copyAttributes, createSwapListenerIfRefreshing, destroy, getAttribute, getAttributeNames, getAttributes, getDefinition, getDescription, getLastNotificationStep, getNotificationQueue, hasAttribute, initializeWithSnapshot, isAddOnly, isAddOnly, isFailed, isRefreshing, isSystemicObject, layoutHints, listenForDirectUpdates, listenForUpdates, listenForUpdates, markSystemic, notifyListeners, notifyListenersOnError, removeDirectUpdateListener, removeUpdateListener, removeUpdateListener, restrictSortTo, satisfied, setAttribute, setColumnRenderers, setLastNotificationStep, setRefreshing, setTotalsTable, shouldCopyAttribute, withColumnDescription, withKeys, withTableDescription, withUniqueKeysMethods inherited from class com.illumon.iris.db.util.liveness.LivenessArtifact
manageWithCurrentScope, unmanage, unmanageMethods inherited from class com.illumon.util.referencecounting.ReferenceCounted
decrementReferenceCount, incrementReferenceCount, resetReferenceCount, tryDecrementReferenceCount, tryIncrementReferenceCountMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.DynamicTable
listenForUpdates, newModifiedColumnSetTransformer, newModifiedColumnSetTransformer, notifyListenersMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessManager
manage, tryManageMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReferenceMethods inherited from interface com.illumon.iris.db.tables.Table
absSumBy, absSumBy, absSumBy, aj, aj, aj, aj, aj, applyToAllBy, applyToAllBy, applyToAllBy, avgBy, avgBy, avgBy, by, by, by, by, by, by, byExternal, byteColumnIterator, characterColumnIterator, close, coalesce, columnIterator, countBy, countBy, countBy, dateTimeColumnAsNanos, dateTimeColumnAsNanos, deflate, deflate, doubleColumnIterator, dropColumnFormats, dropColumns, exactJoin, exactJoin, exactJoin, exactJoin, firstBy, firstBy, firstBy, floatColumnIterator, formatColumns, formatColumnWhere, formatRowWhere, getAttributes, getColumn, getColumns, getColumnSource, getMeta, getViewPort, hasColumns, hasColumns, headBy, headBy, integerColumnIterator, isEmpty, isLive, join, join, join, join, join, join, join, join, join, lastBy, lastBy, lastBy, layoutHints, lazyUpdate, lazyUpdate, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, longColumnIterator, maxBy, maxBy, maxBy, medianBy, medianBy, medianBy, minBy, minBy, minBy, moveColumns, moveColumns, moveDownColumns, moveUpColumns, naturalJoin, naturalJoin, naturalJoin, naturalJoin, preemptiveSnapshotTable, raj, raj, raj, raj, raj, renameAllColumns, renameColumns, renameColumns, rollup, rollup, rollup, rollup, rollup, rollup, rollup, select, select, select, selectDistinct, selectDistinct, selectDistinct, shortColumnIterator, sizeForInstrumentation, snapshot, snapshotIncremental, sort, sort, sortDescending, sortDescending, stdBy, stdBy, stdBy, subscribeToPreemptiveUpdates, sumBy, sumBy, sumBy, supportsPreemptiveSubscription, tailBy, tailBy, ungroup, ungroup, ungroup, ungroupAllBut, update, update, updateBy, updateBy, updateBy, updateBy, updateBy, updateView, updateView, validateSelect, varBy, varBy, varBy, view, view, wavgBy, wavgBy, wavgBy, where, where, where, whereDynamic, whereDynamicIn, whereDynamicIn, whereDynamicNotIn, whereDynamicNotIn, whereIn, whereIn, whereIn, whereIn, whereIn, whereIn, whereIn, whereNotIn, whereNotIn, whereNotIn, whereNotIn, whereOneOf, whereOneOf, whereOneOf, withColumnDescription, wouldMatch, wsumBy, wsumBy, wsumBy
-
Field Details
-
RECONNECT_CHECK_TIMEOUT_PROPERTY
A property that can be set to make the CART automatically check after X length of time to make sure that if the underlying query never went down, then the CART will reconnect.- See Also:
- Constant Field Values
-
-
Constructor Details
-
ConnectionAwareRemoteTable
@ScriptApi public ConnectionAwareRemoteTable(@NotNull com.fishlib.io.logger.Logger log, @NotNull String owner, @NotNull String queryName, @NotNull String tableName, boolean clearOnDisconnect, @NotNull Table prototype)Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.- Parameters:
log- The Logger objectowner- The username of the owner of the persistent queryqueryName- The name of the persistent querytableName- The name of the preemptive table within the persistent query to retrieveclearOnDisconnect- If true, this table should appear empty if the underlying persistent query provides data and then later disconnects. If false, this table will hang on to any data it has already received when the underlying persistent query disconnects, and will then update itself if the underlying persistent query later reconnects.prototype- A prototype of the table expected to be returned by the persistent query table. The definition of this prototype must exactly match that of the returned table.
-
ConnectionAwareRemoteTable
@ScriptApi public ConnectionAwareRemoteTable(@NotNull com.fishlib.io.logger.Logger log, @NotNull String owner, @NotNull String queryName, @NotNull String tableName, boolean clearOnDisconnect, @NotNull Table prototype, int retryAttemptsInWindow, long retryWindowMillis)Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.- Parameters:
log- The Logger objectowner- The username of the owner of the persistent queryqueryName- The name of the persistent querytableName- The name of the preemptive table within the persistent query to retrieveclearOnDisconnect- If true, this table should appear empty if the underlying persistent query provides data and then later disconnects. If false, this table will hang on to any data it has already received when the underlying persistent query disconnects, and will then update itself if the underlying persistent query later reconnects.prototype- A prototype of the table expected to be returned by the persistent query table. The definition of this prototype must exactly match that of the returned table.retryAttemptsInWindow- Number of retry attempts before giving up and erroring. Default 0 (no limit).retryWindowMillis- How long the retry window is, in milliseconds, before resetting. Default 5 minutes.
-
ConnectionAwareRemoteTable
@ScriptApi public ConnectionAwareRemoteTable(@NotNull com.fishlib.io.logger.Logger log, @NotNull String owner, @NotNull String queryName, @NotNull String tableName, boolean clearOnDisconnect, @NotNull TableDefinition definition)Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.- Parameters:
log- The Logger objectowner- The username of the owner of the persistent queryqueryName- The name of the persistent querytableName- The name of the preemptive table within the persistent query to retrieveclearOnDisconnect- If true, this table should appear empty if the underlying persistent query provides data and then later disconnects. If false, this table will hang on to any data it has already received when the underlying persistent query disconnects, and will then update itself if the underlying persistent query later reconnects.definition- A TableDefinition matching that of the table to be retrieved from the persistent query.
-
ConnectionAwareRemoteTable
@ScriptApi public ConnectionAwareRemoteTable(@NotNull com.fishlib.io.logger.Logger log, @NotNull String owner, @NotNull String queryName, @NotNull String tableName, boolean clearOnDisconnect, @NotNull TableDefinition definition, int retryAttemptsInWindow, long retryWindowMillis)Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.- Parameters:
log- The Logger objectowner- The username of the owner of the persistent queryqueryName- The name of the persistent querytableName- The name of the preemptive table within the persistent query to retrieveclearOnDisconnect- If true, this table should appear empty if the underlying persistent query provides data and then later disconnects. If false, this table will hang on to any data it has already received when the underlying persistent query disconnects, and will then update itself if the underlying persistent query later reconnects.definition- A TableDefinition matching that of the table to be retrieved from the persistent query.retryAttemptsInWindow- Number of retry attempts before giving up and erroring. Default 0 (no limit).retryWindowMillis- How long the retry window is, in milliseconds, before resetting. Default 5 minutes.
-
-
Method Details
-
refresh
public void refresh()Refresh this LiveTable. -
toString
-
initializeTransientFieldsForLiveness
Package-private forSerializablesub-classes to use inreadObjectonly. Public to allow unit tests in another package to work around mock issues where the constructor is never invoked. -
tryRetainReference
public final boolean tryRetainReference()Description copied from interface:LivenessReferentIf this referent is "live", behave asLivenessReferent.retainReference()and return true. Otherwise, returns false rather than throwing an exception.- Specified by:
tryRetainReferencein interfaceLivenessReferent- Returns:
- True if this referent was retained, false otherwise
-
dropReference
public final void dropReference()Description copied from interface:LivenessReferentDrop a previously-retained reference to this referent.- Specified by:
dropReferencein interfaceLivenessReferent
-
getWeakReference
Description copied from interface:LivenessReferentGet aWeakReferenceto this referent. This may be cached, or newly created.- Specified by:
getWeakReferencein interfaceLivenessReferent- Returns:
- A new or cached reference to this referent
-
tryManage
Description copied from interface:LivenessManagerAttempt to add the specified referent to this manager.- Specified by:
tryManagein interfaceLivenessManager- Parameters:
referent- The referent to add- Returns:
- Whether the referent was in fact added
-
onReferenceCountAtZero
protected final void onReferenceCountAtZero()Description copied from class:ReferenceCountedCallback method that will be invoked when the reference count returns to zero.- Specified by:
onReferenceCountAtZeroin classReferenceCounted
-