Class ExecutionEnvironment


  • public final class ExecutionEnvironment
    extends oracle.pgx.api.internal.ApiObject
    A session bound environment holding the execution configuration for each task type.
    • Constructor Detail

      • ExecutionEnvironment

        public ExecutionEnvironment​(PgxSession session,
                                    oracle.pgx.api.internal.CoreSessionApi coreSessionApi)
    • Method Detail

      • getValuesAsync

        public PgxFuture<java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.Object>>> getValuesAsync()
        Returns:
        the current configuration
      • withMaxNumThreadsAsync

        public <T> PgxFuture<T> withMaxNumThreadsAsync​(int maxNumThreads,
                                                       java.util.function.Supplier<PgxFuture<T>> asyncRequest)
        Executes the given asynchronous request with at most maxNumThreads. This affects all task types.
        Parameters:
        maxNumThreads - the maximum number of threads to use for the request
        asyncRequest - the asynchronous request to execute
        Returns:
        the result of the asynchronous request
      • resetAsync

        public PgxFuture<java.lang.Void> resetAsync()
        Resets the environment for this session to the configured default values.
      • reset

        public void reset()
                   throws java.util.concurrent.ExecutionException,
                          java.lang.InterruptedException
        Blocking version of resetAsync(). Calls resetAsync() and waits for returned PgxFuture to complete.
        Throws:
        java.lang.InterruptedException - if the caller thread gets interrupted while waiting for completion.
        java.util.concurrent.ExecutionException - if any exception occurred during asynchronous execution. The actual exception will be nested.
      • withMaxNumThreads

        public <T> T withMaxNumThreads​(int maxNumThreads,
                                       java.util.function.Supplier<PgxFuture<T>> asyncRequest)
                                throws java.util.concurrent.ExecutionException,
                                       java.lang.InterruptedException
        Blocking version of withMaxNumThreadsAsync(int, Supplier). Calls withMaxNumThreadsAsync(int, Supplier) and waits for returned PgxFuture to complete.
        Throws:
        java.lang.InterruptedException - if the caller thread gets interrupted while waiting for completion.
        java.util.concurrent.ExecutionException - if any exception occurred during asynchronous execution. The actual exception will be nested.
      • getValues

        public java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.Object>> getValues()
                                                                                               throws java.util.concurrent.ExecutionException,
                                                                                                      java.lang.InterruptedException
        Blocking version of getValuesAsync(). Calls getValuesAsync() and waits for returned PgxFuture to complete.
        Throws:
        java.lang.InterruptedException - if the caller thread gets interrupted while waiting for completion.
        java.util.concurrent.ExecutionException - if any exception occurred during asynchronous execution. The actual exception will be nested.
      • getSession

        public PgxSession getSession()
        Returns:
        the session associated with this execution environment.
      • getIoEnvironment

        public IoEnvironment getIoEnvironment()
        Returns:
        the execution environment for IO tasks
      • setUpdateConsistencyModelAsync

        public PgxFuture<java.lang.Void> setUpdateConsistencyModelAsync​(UpdateConsistencyModel model)
        Sets the consistency model to be used with in-place updates (if enabled). If in-place updates are disabled this value is ignored
        Parameters:
        model - The desired Consistency Model
      • getUpdateConsistencyModelAsync

        public PgxFuture<UpdateConsistencyModel> getUpdateConsistencyModelAsync()
        Gets the consistency model to be used with in-place updates (if enabled).
        Returns:
        The current update consistency model for this session
      • withUpdateConsistencyModelAsync

        public <T> PgxFuture<T> withUpdateConsistencyModelAsync​(UpdateConsistencyModel model,
                                                                java.util.function.Supplier<PgxFuture<T>> asyncRequest)
        Executes the given asynchronous request with the given consistency model (only relevant if in-place updates are enabled).
        Parameters:
        model - the update consistency model to use
        asyncRequest - the asynchronous request to execute
        Returns:
        the result of the asynchronous request
      • getAnalysisEnvironment

        public CpuEnvironment getAnalysisEnvironment()
        Returns:
        the execution environment for analysis tasks
      • getFastAnalysisEnvironment

        public CpuEnvironment getFastAnalysisEnvironment()
        Returns:
        the execution environment for fast analysis tasks
      • allowsConcurrentTasksAsync

        public PgxFuture<java.lang.Boolean> allowsConcurrentTasksAsync()
        Checks if the session allows the tasks to run concurrently.
        Returns:
        true if the session allows concurrent tasks, false otherwise
        Since:
        3.3.0
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object