Class CpuEnvironment


  • public final class CpuEnvironment
    extends oracle.pgx.api.internal.ApiObject
    A sub environment for CPU bound tasks
    See Also:
    AnalysisTaskConfig
    • Method Detail

      • setWeightAsync

        public PgxFuture<java.lang.Void> setWeightAsync​(java.lang.Integer weight)
        Sets the weight to the given value
        Parameters:
        weight - the new weight
        See Also:
        AnalysisTaskConfig.Field.WEIGHT
      • setMaxNumThreadsAsync

        public PgxFuture<java.lang.Void> setMaxNumThreadsAsync​(java.lang.Integer maxNumThreads)
        Sets the limit on the numbers of thread to use to the given value
        Parameters:
        maxNumThreads - the new limit on the numbers of threads to use
        See Also:
        AnalysisTaskConfig.Field.MAX_THREADS
      • withWeightAsync

        public <T> PgxFuture<T> withWeightAsync​(int weight,
                                                java.util.function.Supplier<PgxFuture<T>> asyncRequest)
        Executes the given asynchronous request with the given weight.
        Parameters:
        weight - the temporary weight
        asyncRequest - the request to execute
        Returns:
        the result of the asynchronous request
      • withPriorityAsync

        public <T> PgxFuture<T> withPriorityAsync​(TaskPriority priority,
                                                  java.util.function.Supplier<PgxFuture<T>> asyncRequest)
        Executes the given asynchronous request with the given priority.
        Parameters:
        priority - the temporary priority
        asyncRequest - the request to execute
        Returns:
        the result of the asynchronous request
      • withMaxNumThreadsAsync

        public <T> PgxFuture<T> withMaxNumThreadsAsync​(int maxNumThreads,
                                                       java.util.function.Supplier<PgxFuture<T>> asyncRequest)
        Executes the given asynchronous request with the given limit on the number of threads to use
        Parameters:
        maxNumThreads - the temporary limit on the numbers of threads to use
        asyncRequest - the request to execute
        Returns:
        the result of the asynchronous request
      • getWeight

        public int getWeight()
                      throws java.util.concurrent.ExecutionException,
                             java.lang.InterruptedException
        Blocking version of getWeightAsync(). Calls getWeightAsync() 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.
      • getPriority

        public TaskPriority getPriority()
                                 throws java.util.concurrent.ExecutionException,
                                        java.lang.InterruptedException
        Blocking version of getPriorityAsync(). Calls getPriorityAsync() 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.
      • getMaxNumThreads

        public int getMaxNumThreads()
                             throws java.util.concurrent.ExecutionException,
                                    java.lang.InterruptedException
        Blocking version of getMaxNumThreadsAsync(). Calls getMaxNumThreadsAsync() 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.
      • setWeight

        public void setWeight​(java.lang.Integer weight)
                       throws java.util.concurrent.ExecutionException,
                              java.lang.InterruptedException
        Blocking version of setWeightAsync(Integer). Calls setWeightAsync(Integer) 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.
      • setPriority

        public void setPriority​(TaskPriority priority)
                         throws java.util.concurrent.ExecutionException,
                                java.lang.InterruptedException
        Blocking version of setPriorityAsync(TaskPriority). Calls setPriorityAsync(TaskPriority) 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.
      • setMaxNumThreads

        public void setMaxNumThreads​(java.lang.Integer maxNumThreads)
                              throws java.util.concurrent.ExecutionException,
                                     java.lang.InterruptedException
        Blocking version of setMaxNumThreadsAsync(Integer). Calls setMaxNumThreadsAsync(Integer) 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.
      • withWeight

        public <T> T withWeight​(int weight,
                                java.util.function.Supplier<PgxFuture<T>> asyncRequest)
                         throws java.util.concurrent.ExecutionException,
                                java.lang.InterruptedException
        Blocking version of withWeightAsync(int, Supplier). Calls withWeightAsync(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.
      • withPriority

        public <T> T withPriority​(TaskPriority priority,
                                  java.util.function.Supplier<PgxFuture<T>> asyncRequest)
                           throws java.util.concurrent.ExecutionException,
                                  java.lang.InterruptedException
        Blocking version of withPriorityAsync(TaskPriority, Supplier). Calls withPriorityAsync(TaskPriority, 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.
      • 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.
      • getValuesAsync

        public final PgxFuture<java.util.Map<java.lang.String,​java.lang.Object>> getValuesAsync()
        Returns:
        the current configuration of the sub environment
      • resetAsync

        public final PgxFuture<java.lang.Void> resetAsync()
        reset the sub environment to the configured default values
      • reset

        public final 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.
      • getValues

        public final java.util.Map<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.
      • toString

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