Package io.deephaven.engine.util
Class DelegatingScriptSession
java.lang.Object
io.deephaven.engine.util.DelegatingScriptSession
- All Implemented Interfaces:
LivenessManager
,LivenessNode
,LivenessReferent
,ScriptSession
The delegating script session delegates all calls to another script session. When evaluating a script it massages the
Changes to the QueryScope so that any modifications that are being seen for the first time by the api-client come
across as new entries and not as modified entries.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.util.ScriptSession
ScriptSession.Changes, ScriptSession.Listener
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Drop a previously-retained reference to this referent.evaluateScript
(String script, @Nullable String scriptName) Evaluates the script and manages liveness of objects that are exported to the user.evaluateScript
(Path scriptPath) Evaluates the script and manages liveness of objects that are exported to the user.Obtain anExecutionContext
instance for the current script session.Provides access to the query scope defined by the state in this script session.WeakReference<? extends LivenessReferent>
Get aWeakReference
to this referent.void
Observe (and report viaonScopeChanges
) any changes to this ScriptSession'sQueryScope
that may have been made externally, rather than duringscript evaluation
.boolean
tryManage
(@NotNull LivenessReferent referent) Attempt to addreferent
to this manager.boolean
If this referent is "live", behave asLivenessReferent.retainReference()
and return true.boolean
tryUnmanage
(@NotNull LivenessReferent referent) If this manager manages referent one or more times, drop one such reference.boolean
tryUnmanage
(@NotNull Stream<? extends LivenessReferent> referents) For each referent in referents, if this manager manages referent one or more times, drop one such reference.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage, unmanage, unmanage
Methods inherited from interface io.deephaven.engine.liveness.LivenessReferent
getReferentDescription, retainReference
Methods inherited from interface io.deephaven.engine.util.ScriptSession
evaluateScript, sanitizeThrowable, unwrapObject
-
Constructor Details
-
DelegatingScriptSession
-
-
Method Details
-
getExecutionContext
Description copied from interface:ScriptSession
Obtain anExecutionContext
instance for the current script session. This is the execution context that is used when executing scripts.- Specified by:
getExecutionContext
in interfaceScriptSession
-
observeScopeChanges
public void observeScopeChanges()Description copied from interface:ScriptSession
Observe (and report viaonScopeChanges
) any changes to this ScriptSession'sQueryScope
that may have been made externally, rather than duringscript evaluation
.- Specified by:
observeScopeChanges
in interfaceScriptSession
-
getQueryScope
Description copied from interface:ScriptSession
Provides access to the query scope defined by the state in this script session.- Specified by:
getQueryScope
in interfaceScriptSession
- Returns:
- an implementation defined QueryScope, allowing access to state in the script session
-
evaluateScript
Description copied from interface:ScriptSession
Evaluates the script and manages liveness of objects that are exported to the user. This method should be called from the serial executor as it manipulates static state.- Specified by:
evaluateScript
in interfaceScriptSession
- Parameters:
script
- the code to executescriptName
- an optional script name, which may be ignored by the implementation, or used improve error messages or for other internal purposes- Returns:
- the changes made to the exportable objects
-
evaluateScript
Description copied from interface:ScriptSession
Evaluates the script and manages liveness of objects that are exported to the user. This method should be called from the serial executor as it manipulates static state.- Specified by:
evaluateScript
in interfaceScriptSession
- Parameters:
scriptPath
- the path to the script to execute- Returns:
- the changes made to the exportable objects
-
scriptType
- Specified by:
scriptType
in interfaceScriptSession
- Returns:
- a textual description of this script session's language for use in messages.
-
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:LivenessManager
If this manager manages referent one or more times, drop one such reference. If this manager is also aLivenessReferent
, then this method is a no-op ifthis
is not live.- Specified by:
tryUnmanage
in interfaceLivenessManager
- Parameters:
referent
- The referent to drop- Returns:
- If this node is also a
LivenessReferent
, whether this node was live and thus in fact tried to drop a reference. Else always returnstrue
if dropping a reference via this method is supported by the implementation.
-
tryUnmanage
Description copied from interface:LivenessManager
For each referent in referents, if this manager manages referent one or more times, drop one such reference. If this manager is also aLivenessReferent
, then this method is a no-op ifthis
is not live.- Specified by:
tryUnmanage
in interfaceLivenessManager
- Parameters:
referents
- The referents to drop- Returns:
- If this node is also a
LivenessReferent
, whether this node was live and thus in fact tried to drop the references. Else always returnstrue
if dropping a reference via this method is supported by the implementation.
-
tryRetainReference
public 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 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
-