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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Releases all resources and persistent external state associated with this script session.voidDrop 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 anExecutionContextinstance for the current script session.Provides access to the query scope defined by the state in this script session.WeakReference<? extends LivenessReferent>Get aWeakReferenceto this referent.voidObserve (and report viaonScopeChanges) any changes to this ScriptSession'sQueryScopethat may have been made externally, rather than duringscript evaluation.booleantryManage(@NotNull LivenessReferent referent) Attempt to addreferentto this manager.booleanIf this referent is "live", behave asLivenessReferent.retainReference()and return true.booleantryUnmanage(@NotNull LivenessReferent referent) If this manager manages referent one or more times, drop one such reference.booleantryUnmanage(@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, waitMethods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage, unmanage, unmanageMethods inherited from interface io.deephaven.engine.liveness.LivenessReferent
getReferentDescription, retainReferenceMethods inherited from interface io.deephaven.engine.util.ScriptSession
evaluateScript, sanitizeThrowable, unwrapObject
-
Constructor Details
-
DelegatingScriptSession
-
-
Method Details
-
cleanup
public void cleanup()Description copied from interface:ScriptSessionReleases all resources and persistent external state associated with this script session.Implementations of
ScriptSessionmay create state outside of the JVM (e.g. on-disk caches or temporary directories) that is not automatically cleaned up. If left unmanaged, this state may persist even after the session is no longer in use.This method should be called when the session is no longer needed to ensure that any external resources are properly released.
- Specified by:
cleanupin interfaceScriptSession
-
getExecutionContext
Description copied from interface:ScriptSessionObtain anExecutionContextinstance for the current script session. This is the execution context that is used when executing scripts.- Specified by:
getExecutionContextin interfaceScriptSession
-
observeScopeChanges
public void observeScopeChanges()Description copied from interface:ScriptSessionObserve (and report viaonScopeChanges) any changes to this ScriptSession'sQueryScopethat may have been made externally, rather than duringscript evaluation.- Specified by:
observeScopeChangesin interfaceScriptSession
-
getQueryScope
Description copied from interface:ScriptSessionProvides access to the query scope defined by the state in this script session.- Specified by:
getQueryScopein interfaceScriptSession- Returns:
- an implementation defined QueryScope, allowing access to state in the script session
-
evaluateScript
Description copied from interface:ScriptSessionEvaluates 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:
evaluateScriptin 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:ScriptSessionEvaluates 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:
evaluateScriptin interfaceScriptSession- Parameters:
scriptPath- the path to the script to execute- Returns:
- the changes made to the exportable objects
-
scriptType
- Specified by:
scriptTypein interfaceScriptSession- Returns:
- a textual description of this script session's language for use in messages.
-
tryManage
Description copied from interface:LivenessManagerAttempt to addreferentto this manager. Will succeed ifreferentis live and if this manager is not aLivenessReferentor is live.- Specified by:
tryManagein interfaceLivenessManager- Parameters:
referent- The referent to add- Returns:
- Whether the referent was in fact added
-
tryUnmanage
Description copied from interface:LivenessManagerIf 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 ifthisis not live.Strongly prefer using
LivenessManager.tryUnmanage(Stream)} when multiple referents should be unmanaged.- Specified by:
tryUnmanagein 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 returnstrueif dropping a reference via this method is supported by the implementation.
-
tryUnmanage
Description copied from interface:LivenessManagerFor 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 ifthisis not live.- Specified by:
tryUnmanagein 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 returnstrueif dropping a reference via this method is supported by the implementation.
-
tryRetainReference
public 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 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
-