Class BaseTable
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
,NotificationQueue.Dependency
,Deflatable<Table>
,Table
,LivenessManager
,LivenessNode
,LivenessReferent
,LongSizedDataStructure
,DynamicNode
,DynamicTable
,NotificationStepReceiver
,NotificationStepSource
,SystemicObject
,Serializable
- Direct Known Subclasses:
QueryTable
,SubscriptionSnapshotTable
,UncoalescedTable
,WrappedDelegatingTable
public abstract class BaseTable extends LivenessArtifact implements DynamicTable, Serializable, NotificationStepReceiver, NotificationStepSource
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseTable.CopyAttributeOperation
static class
BaseTable.ListenerImpl
Simplest appropriate legacy InstrumentedListener implementation for BaseTable and descendants.static class
BaseTable.ShiftAwareListenerImpl
Simplest appropriate InstrumentedShiftAwareListener implementation for BaseTable and descendants.static interface
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 protected Map<String,Object>
attributes
protected TableDefinition
definition
This table's definition.protected String
description
This table's description.static boolean
PRINT_SERIALIZED_UPDATE_OVERLAPS
protected boolean
sharedAttributes
Fields inherited from interface com.illumon.iris.db.v2.NotificationStepReceiver
NULL_NOTIFICATION_STEP
Fields 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 BaseTable(TableDefinition definition, String description)
BaseTable(TableDefinition definition, String description, Map<String,Object> attributes)
-
Method Summary
Modifier and Type Method Description void
addParentReference(Object parent)
Called on a dependent node to ensure that a strong reference is maintained to any parent object that is required for the proper maintenance and functioning of the dependent.com.fishlib.base.log.LogOutput
append(com.fishlib.base.log.LogOutput logOutput)
void
awaitUpdate()
Wait for updates to this DynamicTable.boolean
awaitUpdate(long timeout)
Wait for updates to this DynamicTable.Table
clearSortingRestrictions()
Clear all sorting restrictions that was applied to the current table.Table
copy()
Copies this table, but with a new set of attributes.void
copyAttributes(Table dest, BaseTable.CopyAttributeOperation copyType)
Copy this table's attributes to the specified table.void
copyAttributes(Table dest, Predicate<String> shouldCopy)
Copy this table's attributes to the specified table.<T extends SwapListenerBase>
TcreateSwapListenerIfRefreshing(BaseTable.SwapListenerFactory<T> factory)
If we are a refreshing table, then we should create a swap listener and listen for updates.protected void
destroy()
Attempt to release (destructively when necessary) resources held by this object.void
dropReference()
Drop a previously-retained reference to this referent.Object
getAttribute(String key)
Get the value of the specified attribute.Set<String>
getAttributeNames()
Get a set of all the attributes that have values for this table.Map<String,Object>
getAttributes(Collection<String> excludedAttrs)
Get all attributes from the desired table except the items that appear in excluded.TableDefinition
getDefinition()
String
getDescription()
long
getLastNotificationStep()
Get the last logical clock step on which this element dispatched a notification.protected NotificationQueue
getNotificationQueue()
Get the notification queue to insert notifications into as they are generated by listeners duringDynamicTable.notifyListeners(Index, Index, Index)
.WeakReference<? extends LivenessReferent>
getWeakReference()
Get aWeakReference
to this referent.boolean
hasAttribute(String name)
Check if the specified attribute exists in this table.void
initializeTransientFieldsForLiveness()
Package-private forSerializable
sub-classes to use inreadObject
only.<SL extends SwapListenerBase>
voidinitializeWithSnapshot(String logPrefix, SL swapListener, ConstructSnapshot.SnapshotFunction snapshotFunction)
boolean
isAddOnly()
Returns true if this table is static, or has an attribute asserting that no modifies, shifts, or removals are generated.static boolean
isAddOnly(Table table)
Returns true if this provided table is static, or has an attribute asserting that no modifies, shifts, or removals are generated.boolean
isFailed()
boolean
isRefreshing()
Is the node updating?boolean
isSystemicObject()
Returns true if this is a systemically important object (seeSystemicObjectTracker
).Table
layoutHints(String hints)
void
listenForDirectUpdates(Listener listener)
Subscribe for updates to this table.void
listenForUpdates(Listener listener, boolean replayInitialImage)
Subscribe for updates to this table.void
listenForUpdates(ShiftAwareListener listener)
Subscribe for updates to this table.void
markSystemic()
Mark this object as systemically important.void
notifyListeners(ShiftAwareListener.Update update)
Initiate update delivery to this table's listeners.void
notifyListenersOnError(Throwable e, UpdatePerformanceTracker.Entry sourceEntry)
Initiate failure delivery to this table's listeners.protected void
onReferenceCountAtZero()
Callback method that will be invoked when the reference count returns to zero.void
removeDirectUpdateListener(Listener listenerToRemove)
Unsubscribe the supplied listener.void
removeUpdateListener(Listener listenerToRemove)
Unsubscribe the supplied listener.void
removeUpdateListener(ShiftAwareListener listenerToRemove)
Unsubscribe the supplied listener.Table
restrictSortTo(String... allowedSortingColumns)
Disallow sorting on all but the specified columns.boolean
satisfied(long step)
Is this ancestor satisfied? Note that this method must be safe to call on any thread.void
setAttribute(String key, Object object)
Set the value of an attribute.Table
setColumnRenderers(ColumnRenderersBuilder builder)
Sets renderers for columns.void
setLastNotificationStep(long lastNotificationStep)
Deliver a last notification step to this receiver.boolean
setRefreshing(boolean refreshing)
Change the node's refresh mode.Table
setTotalsTable(TotalsTableBuilder builder)
Sets parameters for the default totals table display.protected static boolean
shouldCopyAttribute(String attrName, BaseTable.CopyAttributeOperation copyType)
String
toString()
boolean
tryManage(LivenessReferent referent)
Attempt to add the specified referent to this manager.boolean
tryRetainReference()
If this referent is "live", behave asLivenessReferent.retainReference()
and return true.Table
withColumnDescription(Map<String,String> descriptions)
Add a set of column descriptions to the table.Table
withKeys(String... columns)
Set the table's key columns.Table
withTableDescription(String description)
Table
withUniqueKeys(String... columns)
Set the table's key columns and indicate that each key set will be unique.Methods inherited from class com.illumon.iris.db.util.liveness.LivenessArtifact
manageWithCurrentScope, unmanage, unmanage
Methods inherited from class com.illumon.util.referencecounting.ReferenceCounted
decrementReferenceCount, incrementReferenceCount, resetReferenceCount, tryDecrementReferenceCount, tryIncrementReferenceCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.v2.DynamicTable
listenForUpdates, newModifiedColumnSet, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetTransformer, newModifiedColumnSetTransformer, newModifiedColumnSetTransformer, notifyListeners, silent
Methods inherited from interface com.illumon.iris.db.util.liveness.LivenessManager
manage, tryManage
Methods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
Methods inherited from interface com.illumon.iris.db.util.LongSizedDataStructure
intSize, intSize, size
Methods inherited from interface com.illumon.iris.db.tables.Table
absSumBy, absSumBy, absSumBy, absSumBy, aj, aj, aj, aj, aj, aj, apply, applyToAllBy, applyToAllBy, applyToAllBy, applyToAllBy, avgBy, avgBy, avgBy, avgBy, by, by, by, by, by, by, by, byExternal, byExternal, byteColumnIterator, characterColumnIterator, close, coalesce, columnIterator, countBy, countBy, countBy, countBy, dateTimeColumnAsNanos, dateTimeColumnAsNanos, deflate, deflate, doubleColumnIterator, dropColumnFormats, dropColumns, dropColumns, exactJoin, exactJoin, exactJoin, exactJoin, exactJoin, firstBy, firstBy, firstBy, firstBy, flatten, floatColumnIterator, formatColumns, formatColumnWhere, formatRowWhere, getAttributes, getColumn, getColumn, getColumns, getColumnSource, getColumnSource, getColumnSourceMap, getColumnSources, getIndex, getMeta, getRecord, getSubTable, getViewPort, hasColumns, hasColumns, head, headBy, headBy, headBy, headPct, integerColumnIterator, isEmpty, isFlat, isLive, join, join, join, join, join, join, join, join, join, join, lastBy, lastBy, lastBy, lastBy, layoutHints, lazyUpdate, lazyUpdate, lazyUpdate, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, longColumnIterator, maxBy, maxBy, maxBy, maxBy, medianBy, medianBy, medianBy, medianBy, minBy, minBy, minBy, minBy, moveColumns, moveColumns, moveDownColumns, moveUpColumns, naturalJoin, naturalJoin, naturalJoin, naturalJoin, naturalJoin, preemptiveSnapshotTable, preemptiveSnapshotTable, preemptiveUpdatesTable, raj, raj, raj, raj, raj, raj, releaseCachedResources, renameAllColumns, renameColumns, renameColumns, renameColumns, reverse, rollup, rollup, rollup, rollup, rollup, rollup, rollup, rollup, select, select, select, select, selectDistinct, selectDistinct, selectDistinct, selectDistinct, shortColumnIterator, sizeForInstrumentation, slice, snapshot, snapshot, snapshotHistory, snapshotIncremental, snapshotIncremental, sort, sort, sort, sortDescending, sortDescending, stdBy, stdBy, stdBy, stdBy, subscribeToPreemptiveUpdates, sumBy, sumBy, sumBy, sumBy, supportsPreemptiveSubscription, tail, tailBy, tailBy, tailBy, tailPct, treeTable, ungroup, ungroup, ungroup, ungroup, ungroupAllBut, update, update, update, updateBy, updateBy, updateBy, updateBy, updateBy, updateBy, updateView, updateView, updateView, validateSelect, validateSelect, varBy, varBy, varBy, varBy, view, view, view, wavgBy, wavgBy, wavgBy, wavgBy, where, where, where, where, whereIn, whereIn, whereIn, whereIn, whereNotIn, whereNotIn, whereOneOf, whereOneOf, whereOneOf, withColumnDescription, wouldMatch, wouldMatch, wsumBy, wsumBy, wsumBy, wsumBy
-
Field Details
-
PRINT_SERIALIZED_UPDATE_OVERLAPS
public static final boolean PRINT_SERIALIZED_UPDATE_OVERLAPS -
definition
This table's definition. -
description
This table's description. -
attributes
-
sharedAttributes
protected volatile boolean sharedAttributes
-
-
Constructor Details
-
Method Details
-
getDefinition
- Specified by:
getDefinition
in interfaceTable
-
getDescription
- Specified by:
getDescription
in interfaceTable
-
toString
- Overrides:
toString
in classReferenceCounted
-
append
public com.fishlib.base.log.LogOutput append(@NotNull com.fishlib.base.log.LogOutput logOutput)- Specified by:
append
in interfacecom.fishlib.base.log.LogOutputAppendable
- Overrides:
append
in classReferenceCounted
-
setAttribute
Description copied from interface:Table
Set the value of an attribute.- Specified by:
setAttribute
in interfaceTable
- Parameters:
key
- the name of the attributeobject
- the value
-
getAttribute
Description copied from interface:Table
Get the value of the specified attribute.- Specified by:
getAttribute
in interfaceTable
- Parameters:
key
- the name of the attribute- Returns:
- the value, or null if there was none.
-
getAttributeNames
Description copied from interface:Table
Get a set of all the attributes that have values for this table.- Specified by:
getAttributeNames
in interfaceTable
- Returns:
- a set of names
-
hasAttribute
Description copied from interface:Table
Check if the specified attribute exists in this table.- Specified by:
hasAttribute
in interfaceTable
- Parameters:
name
- the name of the attribute- Returns:
- true if the attribute exists
-
getAttributes
Description copied from interface:Table
Get all attributes from the desired table except the items that appear in excluded.- Specified by:
getAttributes
in interfaceTable
- Parameters:
excludedAttrs
- A set of attributes to exclude from the result- Returns:
- All of the table's attributes except the ones present in excluded
-
shouldCopyAttribute
protected static boolean shouldCopyAttribute(String attrName, BaseTable.CopyAttributeOperation copyType) -
copyAttributes
Copy this table's attributes to the specified table. Attributes will be copied based upon the inputBaseTable.CopyAttributeOperation
.- Parameters:
dest
- The table to copy attributes tocopyType
- The operation being performed that requires attributes to be copied.
-
copyAttributes
Copy this table's attributes to the specified table. Attributes are copied based on a predicate.- Parameters:
dest
- The table to copy attributes toshouldCopy
- should we copy this attribute?
-
isAddOnly
public boolean isAddOnly()Returns true if this table is static, or has an attribute asserting that no modifies, shifts, or removals are generated.- Returns:
- true if this table does not produce modifications, shifts, or removals
-
isAddOnly
Returns true if this provided table is static, or has an attribute asserting that no modifies, shifts, or removals are generated.- Returns:
- true if the table does not produce modifications, shifts, or removals
-
addParentReference
Description copied from interface:DynamicNode
Called on a dependent node to ensure that a strong reference is maintained to any parent object that is required for the proper maintenance and functioning of the dependent. In the most common case, the parent object is a child listener to a parent node. The parent node only keeps a weak reference to its child listener, but the listener maintains a strong reference to the parent node. In this scenario, the only strong reference to the listener (and thus indirectly to the parent node itself) is the reference kept by the dependent node.- Specified by:
addParentReference
in interfaceDynamicNode
- Parameters:
parent
- A parent of this node
-
satisfied
public boolean satisfied(long step)Description copied from interface:NotificationQueue.Dependency
Is this ancestor satisfied? Note that this method must be safe to call on any thread.- Specified by:
satisfied
in interfaceNotificationQueue.Dependency
- Parameters:
step
- The step for which we are testing satisfaction- Returns:
- Whether the dependency is satisfied on
step
(and will not fire subsequent notifications)
-
awaitUpdate
Description copied from interface:DynamicTable
Wait for updates to this DynamicTable.
In some implementations, this call may also terminate in case of interrupt or spurious wakeup (see java.util.concurrent.locks.Condition#await()).
- Specified by:
awaitUpdate
in interfaceDynamicTable
- Throws:
InterruptedException
- In the event this thread is interrupted
-
awaitUpdate
Description copied from interface:DynamicTable
Wait for updates to this DynamicTable.
In some implementations, this call may also terminate in case of interrupt or spurious wakeup (see java.util.concurrent.locks.Condition#await()).
- Specified by:
awaitUpdate
in interfaceDynamicTable
- Parameters:
timeout
- The maximum time to wait in milliseconds.- Returns:
- false if the timeout elapses without notification, true otherwise.
- Throws:
InterruptedException
- In the event this thread is interrupted
-
listenForUpdates
Description copied from interface:DynamicTable
Subscribe for updates to this table. After the optional initial image, listener will be invoked via the LiveTableMonitor notification queue associated with this DynamicTable.- Specified by:
listenForUpdates
in interfaceDynamicTable
- Parameters:
listener
- listener for updatesreplayInitialImage
- true to process updates for all initial rows in the table plus all new row changes; false to only process new row changes
-
listenForUpdates
Description copied from interface:DynamicTable
Subscribe for updates to this table. Listener will be invoked via the LiveTableMonitor notification queue associated with this DynamicTable.- Specified by:
listenForUpdates
in interfaceDynamicTable
- Parameters:
listener
- listener for updates
-
listenForDirectUpdates
Description copied from interface:DynamicTable
Subscribe for updates to this table. Direct listeners are invoked immediately when changes are published, rather than via a LiveTableMonitor notification queue.- Specified by:
listenForDirectUpdates
in interfaceDynamicTable
- Parameters:
listener
- listener for updates
-
removeUpdateListener
Description copied from interface:DynamicTable
Unsubscribe the supplied listener.- Specified by:
removeUpdateListener
in interfaceDynamicTable
- Parameters:
listenerToRemove
- listener for updates
-
removeUpdateListener
Description copied from interface:DynamicTable
Unsubscribe the supplied listener.- Specified by:
removeUpdateListener
in interfaceDynamicTable
- Parameters:
listenerToRemove
- listener for updates
-
removeDirectUpdateListener
Description copied from interface:DynamicTable
Unsubscribe the supplied listener.- Specified by:
removeDirectUpdateListener
in interfaceDynamicTable
- Parameters:
listenerToRemove
- listener for updates
-
notifyListenersOnError
public final void notifyListenersOnError(Throwable e, @Nullable UpdatePerformanceTracker.Entry sourceEntry)Description copied from interface:DynamicTable
Initiate failure delivery to this table's listeners. Will notify direct listeners before completing, and enqueue notifications for all other listeners.- Specified by:
notifyListenersOnError
in interfaceDynamicTable
- Parameters:
e
- errorsourceEntry
- performance tracking
-
isRefreshing
public final boolean isRefreshing()Description copied from interface:DynamicNode
Is the node updating?- Specified by:
isRefreshing
in interfaceDynamicNode
- Returns:
- true if the node is updating; false otherwise.
-
setRefreshing
public final boolean setRefreshing(boolean refreshing)Description copied from interface:DynamicNode
Change the node's refresh mode.- Specified by:
setRefreshing
in interfaceDynamicNode
- Parameters:
refreshing
- true to cause the node to update; false otherwise.- Returns:
- new refreshing state
-
isFailed
public boolean isFailed()- Specified by:
isFailed
in interfaceDynamicTable
- Returns:
- true if this table is in a failure state.
-
notifyListeners
Description copied from interface:DynamicTable
Initiate update delivery to this table's listeners. Will notify direct listeners before completing, and enqueue notifications for all other listeners.- Specified by:
notifyListeners
in interfaceDynamicTable
- Parameters:
update
- the set of table changes to propagate The caller gives this update object away; the invocation ofnotifyListeners
takes ownership, and will callrelease
on it once it is not used anymore; callers should pass aclone
for updates they intend to further use.
-
getNotificationQueue
Get the notification queue to insert notifications into as they are generated by listeners duringDynamicTable.notifyListeners(Index, Index, Index)
. This method may be overridden to provide a different notification queue than theLiveTableMonitor.DEFAULT
instance for more complex behavior.- Returns:
- The
NotificationQueue
to add to.
-
getLastNotificationStep
public long getLastNotificationStep()Description copied from interface:NotificationStepSource
Get the last logical clock step on which this element dispatched a notification.- Specified by:
getLastNotificationStep
in interfaceNotificationStepSource
- Returns:
- The last notification step
-
setLastNotificationStep
public void setLastNotificationStep(long lastNotificationStep)Description copied from interface:NotificationStepReceiver
Deliver a last notification step to this receiver.- Specified by:
setLastNotificationStep
in interfaceNotificationStepReceiver
- Parameters:
lastNotificationStep
- The last notification step to be delivered
-
isSystemicObject
public boolean isSystemicObject()Description copied from interface:SystemicObject
Returns true if this is a systemically important object (seeSystemicObjectTracker
).- Specified by:
isSystemicObject
in interfaceSystemicObject
- Returns:
- true if this is a systemically important object, false otherwise.
-
markSystemic
public void markSystemic()Description copied from interface:SystemicObject
Mark this object as systemically important.- Specified by:
markSystemic
in interfaceSystemicObject
-
withKeys
Description copied from interface:Table
Set the table's key columns. -
withUniqueKeys
Description copied from interface:Table
Set the table's key columns and indicate that each key set will be unique.- Specified by:
withUniqueKeys
in interfaceTable
- Returns:
- The same table this method was invoked on, with the keyColumns and unique attributes set
-
restrictSortTo
Description copied from interface:Table
Disallow sorting on all but the specified columns.
- Specified by:
restrictSortTo
in interfaceTable
- Parameters:
allowedSortingColumns
- The columns on which sorting is allowed.- Returns:
- The same table this was invoked on.
-
clearSortingRestrictions
Description copied from interface:Table
Clear all sorting restrictions that was applied to the current table.
Note that this table operates on the table it was invoked on and does not create a new table. So in the following code
T1 = baseTable.where(...) T2 = T1.restrictSortTo("C1") T3 = T2.clearSortingRestrictions()
T1 == T2 == T3 and the result has no restrictions on sorting.- Specified by:
clearSortingRestrictions
in interfaceTable
- Returns:
- The same table this was invoked on.
-
layoutHints
- Specified by:
layoutHints
in interfaceTable
-
copy
Copies this table, but with a new set of attributes.- Returns:
- an identical table; but with a new set of attributes
-
setTotalsTable
Description copied from interface:Table
Sets parameters for the default totals table display.- Specified by:
setTotalsTable
in interfaceTable
- Parameters:
builder
- aTotalsTableBuilder
object- Returns:
- a table with the totals applied
-
setColumnRenderers
Description copied from interface:Table
Sets renderers for columns.- Specified by:
setColumnRenderers
in interfaceTable
- Parameters:
builder
- a builder that creates the packed string for the attribute- Returns:
- The same table with the ColumnRenderes attribute set
-
initializeWithSnapshot
public <SL extends SwapListenerBase> void initializeWithSnapshot(String logPrefix, SL swapListener, ConstructSnapshot.SnapshotFunction snapshotFunction) -
createSwapListenerIfRefreshing
@Nullable public <T extends SwapListenerBase> T createSwapListenerIfRefreshing(BaseTable.SwapListenerFactory<T> factory)If we are a refreshing table, then we should create a swap listener and listen for updates. Otherwise, we return null.- Returns:
- a swap listener for this table (or null)
-
destroy
protected void destroy()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.
-
withTableDescription
- Specified by:
withTableDescription
in interfaceTable
-
withColumnDescription
Description copied from interface:Table
Add a set of column descriptions to the table.- Specified by:
withColumnDescription
in interfaceTable
- Parameters:
descriptions
- a map of Column name to Column description.- Returns:
- a copy of the table with the descriptions applied.
-
initializeTransientFieldsForLiveness
Package-private forSerializable
sub-classes to use inreadObject
only. 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:LivenessReferent
If this referent is "live", behave asLivenessReferent.retainReference()
and return true. Otherwise, returns false rather than throwing an exception.- Specified by:
tryRetainReference
in interfaceLivenessReferent
- Returns:
- True if this referent was retained, false otherwise
-
dropReference
public final void dropReference()Description copied from interface:LivenessReferent
Drop a previously-retained reference to this referent.- Specified by:
dropReference
in interfaceLivenessReferent
-
getWeakReference
Description copied from interface:LivenessReferent
Get aWeakReference
to this referent. This may be cached, or newly created.- Specified by:
getWeakReference
in interfaceLivenessReferent
- Returns:
- A new or cached reference to this referent
-
tryManage
Description copied from interface:LivenessManager
Attempt to add the specified referent to this manager.- Specified by:
tryManage
in interfaceLivenessManager
- Parameters:
referent
- The referent to add- Returns:
- Whether the referent was in fact added
-
onReferenceCountAtZero
protected final void onReferenceCountAtZero()Description copied from class:ReferenceCounted
Callback method that will be invoked when the reference count returns to zero.- Specified by:
onReferenceCountAtZero
in classReferenceCounted
-