Package io.deephaven.engine.util
Interface ScriptSession
- All Superinterfaces:
LivenessManager,LivenessNode,LivenessReferent
- All Known Implementing Classes:
AbstractScriptSession,DelegatingScriptSession,GroovyDeephavenSession,NoLanguageDeephavenSession,PythonDeephavenSession
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic interface -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Releases all resources and persistent external state associated with this script session.default ScriptSession.ChangesevaluateScript(String script) Evaluates the script and manages liveness of objects that are exported to the user.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.voidObserve (and report viaonScopeChanges) any changes to this ScriptSession'sQueryScopethat may have been made externally, rather than duringscript evaluation.default ThrowableIf this script session can throw unserializable exceptions, this method is responsible for turning those exceptions into something suitable for sending back to a client.default ObjectunwrapObject(@Nullable Object object) Asks the session to remove any wrapping that exists on scoped objects so that clients can fetch them.Methods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage, tryManage, tryUnmanage, tryUnmanage, unmanage, unmanageMethods inherited from interface io.deephaven.engine.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
-
Method Details
-
cleanup
void cleanup()Releases 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.
-
getQueryScope
QueryScope getQueryScope()Provides access to the query scope defined by the state in this script session.- Returns:
- an implementation defined QueryScope, allowing access to state in the script session
-
getExecutionContext
ExecutionContext getExecutionContext()Obtain anExecutionContextinstance for the current script session. This is the execution context that is used when executing scripts. -
observeScopeChanges
void observeScopeChanges()Observe (and report viaonScopeChanges) any changes to this ScriptSession'sQueryScopethat may have been made externally, rather than duringscript evaluation.- ApiNote:
- This method should be regarded as an unstable API
-
evaluateScript
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.- Parameters:
script- the code to execute- Returns:
- the changes made to the exportable objects
-
evaluateScript
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.- 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
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.- Parameters:
scriptPath- the path to the script to execute- Returns:
- the changes made to the exportable objects
-
scriptType
String scriptType()- Returns:
- a textual description of this script session's language for use in messages.
-
sanitizeThrowable
If this script session can throw unserializable exceptions, this method is responsible for turning those exceptions into something suitable for sending back to a client.- Parameters:
e- the exception to (possibly) sanitize- Returns:
- the sanitized exception
-
unwrapObject
Asks the session to remove any wrapping that exists on scoped objects so that clients can fetch them. Defaults to returning the object itself.- Parameters:
object- the scoped object- Returns:
- an obj which can be consumed by a client
-