Class ExecutionContext

java.lang.Object
io.deephaven.engine.context.ExecutionContext

public class ExecutionContext extends Object
Container for context-specific objects, that can be activated on a thread or passed to certain operations. ExecutionContexts are immutable, and support a builder pattern to create new instances and "with" methods to customize existing ones. Any thread that interacts with the Deephaven engine will need to have an active ExecutionContext.
  • Method Details

    • newBuilder

      public static ExecutionContext.Builder newBuilder()
      Creates a new builder for an ExecutionContext, capturing the current thread's auth context, update graph, and operation initializer. Typically, this method should be called on a thread that already has an active ExecutionContext, to more easily reuse those.
      Returns:
      a new builder to create an ExecutionContext
    • makeExecutionContext

      public static ExecutionContext makeExecutionContext(boolean isSystemic)
    • getDefaultContext

      public static ExecutionContext getDefaultContext()
    • getContextToRecord

      public static ExecutionContext getContextToRecord()
      Returns:
      an object representing the current execution context or null if the current context is systemic
    • getContext

      public static ExecutionContext getContext()
      Returns:
      an object representing the current execution context
    • withSystemic

      public ExecutionContext withSystemic(boolean isSystemic)
      Returns, or creates, an execution context with the given value for isSystemic and existing values for the other members.
      Parameters:
      isSystemic - if the context should be systemic
      Returns:
      the execution context
    • withAuthContext

      public ExecutionContext withAuthContext(AuthContext authContext)
      Returns, or creates, an execution context with the given value for authContext and existing values for the other members. This is not intended to be used by user code.
      Parameters:
      authContext - the auth context to use instead; null values are ignored
      Returns:
      the execution context
    • withUpdateGraph

      public ExecutionContext withUpdateGraph(UpdateGraph updateGraph)
      Returns, or creates, an execution context with the given value for updateGraph and existing values for the other members. This is not intended to be used by user code.
      Parameters:
      updateGraph - the update context to use instead
      Returns:
      the execution context
    • withOperationInitializer

      public ExecutionContext withOperationInitializer(OperationInitializer operationInitializer)
    • withQueryScope

      public ExecutionContext withQueryScope(QueryScope queryScope)
      Returns, or creates, an execution context with the given value for queryScope and existing values for the other members.
      Parameters:
      queryScope - the query scope to use instead
      Returns:
      the execution context
    • apply

      public void apply(Runnable runnable)
      Execute runnable within this execution context.
    • apply

      public <T> T apply(Supplier<T> supplier)
      Executes supplier within this execution context.
    • open

      public SafeCloseable open()
      Installs the executionContext and returns a function that will restore the original executionContext.
      Returns:
      a closeable to cleanup the execution context
    • getQueryLibrary

      public QueryLibrary getQueryLibrary()
    • getQueryScope

      public QueryScope getQueryScope()
    • getQueryCompiler

      public QueryCompiler getQueryCompiler()
    • getAuthContext

      public AuthContext getAuthContext()
    • getUpdateGraph

      public UpdateGraph getUpdateGraph()
    • getOperationInitializer

      public OperationInitializer getOperationInitializer()