Package io.deephaven.engine.liveness
Class ReferenceCountedLivenessNode
java.lang.Object
io.deephaven.util.referencecounting.ReferenceCounted
io.deephaven.engine.liveness.ReferenceCountedLivenessReferent
io.deephaven.engine.liveness.ReferenceCountedLivenessNode
- All Implemented Interfaces:
LogOutputAppendable
,LivenessManager
,LivenessNode
,LivenessReferent
- Direct Known Subclasses:
BarrageSnapshotImpl
,BarrageSubscriptionImpl
,LivenessArtifact
,LivenessScope
,StreamPublisherBase
public abstract class ReferenceCountedLivenessNode
extends ReferenceCountedLivenessReferent
implements LivenessNode
LivenessNode
implementation that relies on reference counting to determine its liveness.-
Constructor Summary
ModifierConstructorDescriptionprotected
ReferenceCountedLivenessNode
(boolean enforceStrongReachability) -
Method Summary
Modifier and TypeMethodDescriptionWeakReference<? extends LivenessReferent>
Get aWeakReference
to this referent.final void
Package-private forSerializable
sub-classes to use inreadObject
only.final void
Callback method that will be invoked when the reference count returns to zero.final boolean
tryManage
(@NotNull LivenessReferent referent) Attempt to addreferent
to this manager.final boolean
tryUnmanage
(@NotNull LivenessReferent referent) If this node is still live and manages referent one or more times, drop one such reference.final boolean
tryUnmanage
(@NotNull Stream<? extends LivenessReferent> referents) For each referent in referents, if this node is still live and manages referent one or more times, drop one such reference.Methods inherited from class io.deephaven.engine.liveness.ReferenceCountedLivenessReferent
destroy, dropReference, tryRetainReference
Methods inherited from class io.deephaven.util.referencecounting.ReferenceCounted
append, decrementReferenceCount, forceReferenceCountToZero, getReferenceCountDebug, incrementReferenceCount, resetReferenceCount, toString, tryDecrementReferenceCount, tryIncrementReferenceCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage
Methods inherited from interface io.deephaven.engine.liveness.LivenessNode
unmanage, unmanage
Methods inherited from interface io.deephaven.engine.liveness.LivenessReferent
dropReference, getReferentDescription, retainReference, tryRetainReference
-
Constructor Details
-
ReferenceCountedLivenessNode
protected ReferenceCountedLivenessNode(boolean enforceStrongReachability) - Parameters:
enforceStrongReachability
- Whether thisLivenessManager
should maintain strong references to its referents
-
-
Method Details
-
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. -
getWeakReference
Description copied from interface:LivenessReferent
Get aWeakReference
to this referent. This may be cached, or newly created.- Specified by:
getWeakReference
in interfaceLivenessReferent
- Overrides:
getWeakReference
in classReferenceCountedLivenessReferent
- Returns:
- A new or cached reference to this referent
-
tryManage
Description copied from interface:LivenessManager
Attempt to addreferent
to this manager. Will succeed ifreferent
is live and if this manager is not aLivenessReferent
or is live.- Specified by:
tryManage
in interfaceLivenessManager
- Parameters:
referent
- The referent to add- Returns:
- Whether the referent was in fact added
-
tryUnmanage
Description copied from interface:LivenessNode
If this node is still live and manages referent one or more times, drop one such reference.- Specified by:
tryUnmanage
in interfaceLivenessNode
- Parameters:
referent
- The referent to drop- Returns:
- Whether this node was live and thus in fact tried to drop a reference
-
tryUnmanage
Description copied from interface:LivenessNode
For each referent in referents, if this node is still live and manages referent one or more times, drop one such reference.- Specified by:
tryUnmanage
in interfaceLivenessNode
- Parameters:
referents
- The referents to drop- Returns:
- Whether this node was live and thus in fact tried to drop a reference
-
onReferenceCountAtZero
public final void onReferenceCountAtZero()Description copied from class:ReferenceCounted
Callback method that will be invoked when the reference count returns to zero.- Overrides:
onReferenceCountAtZero
in classReferenceCountedLivenessReferent
-