Class CpuEnvironment
- java.lang.Object
-
- oracle.pgx.api.internal.ApiObject
-
- oracle.pgx.api.executionenvironment.CpuEnvironment
-
public final class CpuEnvironment extends oracle.pgx.api.internal.ApiObjectA sub environment for CPU bound tasks- See Also:
AnalysisTaskConfig
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxNumThreads()Blocking version ofgetMaxNumThreadsAsync().PgxFuture<java.lang.Integer>getMaxNumThreadsAsync()TaskPrioritygetPriority()Blocking version ofgetPriorityAsync().PgxFuture<TaskPriority>getPriorityAsync()java.util.Map<java.lang.String,java.lang.Object>getValues()Blocking version ofgetValuesAsync().PgxFuture<java.util.Map<java.lang.String,java.lang.Object>>getValuesAsync()intgetWeight()Blocking version ofgetWeightAsync().PgxFuture<java.lang.Integer>getWeightAsync()voidreset()Blocking version ofresetAsync().PgxFuture<java.lang.Void>resetAsync()reset the sub environment to the configured default valuesvoidsetMaxNumThreads(java.lang.Integer maxNumThreads)Blocking version ofsetMaxNumThreadsAsync(Integer).PgxFuture<java.lang.Void>setMaxNumThreadsAsync(java.lang.Integer maxNumThreads)Sets the limit on the numbers of thread to use to the given valuevoidsetPriority(TaskPriority priority)Blocking version ofsetPriorityAsync(TaskPriority).PgxFuture<java.lang.Void>setPriorityAsync(TaskPriority priority)Sets the priority to the given valuevoidsetWeight(java.lang.Integer weight)Blocking version ofsetWeightAsync(Integer).PgxFuture<java.lang.Void>setWeightAsync(java.lang.Integer weight)Sets the weight to the given valuejava.lang.StringtoString()<T> TwithMaxNumThreads(int maxNumThreads, java.util.function.Supplier<PgxFuture<T>> asyncRequest)Blocking version ofwithMaxNumThreadsAsync(int, Supplier).<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<T> TwithPriority(TaskPriority priority, java.util.function.Supplier<PgxFuture<T>> asyncRequest)Blocking version ofwithPriorityAsync(TaskPriority, Supplier).<T> PgxFuture<T>withPriorityAsync(TaskPriority priority, java.util.function.Supplier<PgxFuture<T>> asyncRequest)Executes the given asynchronous request with the given priority.<T> TwithWeight(int weight, java.util.function.Supplier<PgxFuture<T>> asyncRequest)Blocking version ofwithWeightAsync(int, Supplier).<T> PgxFuture<T>withWeightAsync(int weight, java.util.function.Supplier<PgxFuture<T>> asyncRequest)Executes the given asynchronous request with the given weight.
-
-
-
Method Detail
-
getWeightAsync
public PgxFuture<java.lang.Integer> getWeightAsync()
- Returns:
- the currently configured weight
- See Also:
AnalysisTaskConfig.Field.WEIGHT
-
getPriorityAsync
public PgxFuture<TaskPriority> getPriorityAsync()
- Returns:
- the currently configured priority
- See Also:
AnalysisTaskConfig.Field.PRIORITY
-
getMaxNumThreadsAsync
public PgxFuture<java.lang.Integer> getMaxNumThreadsAsync()
- Returns:
- the currently configured limit on the numbers of thread to use
- See Also:
AnalysisTaskConfig.Field.MAX_THREADS
-
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
-
setPriorityAsync
public PgxFuture<java.lang.Void> setPriorityAsync(TaskPriority priority)
Sets the priority to the given value- Parameters:
priority- the new priority- See Also:
AnalysisTaskConfig.Field.PRIORITY
-
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 weightasyncRequest- 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 priorityasyncRequest- 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 useasyncRequest- the request to execute- Returns:
- the result of the asynchronous request
-
getWeight
public int getWeight() throws java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionBlocking version ofgetWeightAsync(). CallsgetWeightAsync()and waits for returnedPgxFutureto 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 ofgetPriorityAsync(). CallsgetPriorityAsync()and waits for returnedPgxFutureto 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.InterruptedExceptionBlocking version ofgetMaxNumThreadsAsync(). CallsgetMaxNumThreadsAsync()and waits for returnedPgxFutureto 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.InterruptedExceptionBlocking version ofsetWeightAsync(Integer). CallssetWeightAsync(Integer)and waits for returnedPgxFutureto 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 ofsetPriorityAsync(TaskPriority). CallssetPriorityAsync(TaskPriority)and waits for returnedPgxFutureto 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.InterruptedExceptionBlocking version ofsetMaxNumThreadsAsync(Integer). CallssetMaxNumThreadsAsync(Integer)and waits for returnedPgxFutureto 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.InterruptedExceptionBlocking version ofwithWeightAsync(int, Supplier). CallswithWeightAsync(int, Supplier)and waits for returnedPgxFutureto 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 ofwithPriorityAsync(TaskPriority, Supplier). CallswithPriorityAsync(TaskPriority, Supplier)and waits for returnedPgxFutureto 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.InterruptedExceptionBlocking version ofwithMaxNumThreadsAsync(int, Supplier). CallswithMaxNumThreadsAsync(int, Supplier)and waits for returnedPgxFutureto 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- 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.InterruptedExceptionBlocking version ofgetValuesAsync(). CallsgetValuesAsync()and waits for returnedPgxFutureto 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:
toStringin classjava.lang.Object
-
-