Package io.deephaven.engine.liveness
Interface DelegatingLivenessNode
- All Superinterfaces:
LivenessManager
,LivenessNode
,LivenessReferent
- All Known Implementing Classes:
FigureWidget
Indicates that this class implements LivenessNode via a member rather than implementing it directly. The real
LivenessNode is exposed via
asLivenessNode()
, all other methods delegate to this instance.-
Method Summary
Modifier and TypeMethodDescriptionReturns the "real"LivenessNode
instance.default void
Drop a previously-retained reference to this referent.default WeakReference<? extends LivenessReferent>
Get aWeakReference
to this referent.default boolean
tryManage
(@NotNull LivenessReferent referent) Attempt to addreferent
to this manager.default boolean
If this referent is "live", behave asLivenessReferent.retainReference()
and return true.default boolean
tryUnmanage
(@NotNull LivenessReferent referent) If this node is still live and manages referent one or more times, drop one such reference.default 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 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
getReferentDescription, retainReference
-
Method Details
-
asLivenessNode
LivenessNode asLivenessNode()Returns the "real"LivenessNode
instance. When implementing this, care should be taken to match lifecycle of theDelegatingLivenessNode
instance with this instance, as the returnedLivenessNode
behaves as a proxy forthis
.- Returns:
- a LivenessNode to use to manage this object's liveness.
-
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
-
tryRetainReference
default 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
default 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
-