Class ExecutionEnvironment
java.lang.Object
oracle.pgx.api.internal.ApiObject
oracle.pgx.api.executionenvironment.ExecutionEnvironment
public final class ExecutionEnvironment
extends oracle.pgx.api.internal.ApiObject
A session bound environment holding the execution configuration for each task type.
-
Constructor Summary
ConstructorsConstructorDescriptionExecutionEnvironment(PgxSession session, oracle.pgx.api.internal.CoreSessionApi coreSessionApi) -
Method Summary
Modifier and TypeMethodDescriptionbooleanBlocking version ofallowsConcurrentTasksAsync().Checks if the session allows the tasks to run concurrently.Blocking version ofgetUpdateConsistencyModelAsync().Gets the consistency model to be used with in-place updates (if enabled).Blocking version ofgetValuesAsync().voidreset()Blocking version ofresetAsync().Resets the environment for this session to the configured default values.voidBlocking version ofresetUpdateConsistencyModelAsync().Resets the consistency model to be used with in-place updates (if enabled) to the default value, as configured inPgxConfig.getInPlaceUpdateConsistencyModel()voidBlocking version ofsetUpdateConsistencyModelAsync(UpdateConsistencyModel).Sets the consistency model to be used with in-place updates (if enabled).toString()<T> TwithMaxNumThreads(int maxNumThreads, Supplier<PgxFuture<T>> asyncRequest) Blocking version ofwithMaxNumThreadsAsync(int, Supplier).<T> PgxFuture<T>withMaxNumThreadsAsync(int maxNumThreads, Supplier<PgxFuture<T>> asyncRequest) Executes the given asynchronous request with at mostmaxNumThreads.<T> TwithUpdateConsistencyModel(UpdateConsistencyModel model, Supplier<PgxFuture<T>> asyncRequest) Blocking version ofwithUpdateConsistencyModelAsync(UpdateConsistencyModel, Supplier).<T> PgxFuture<T>withUpdateConsistencyModelAsync(UpdateConsistencyModel model, Supplier<PgxFuture<T>> asyncRequest) Executes the given asynchronous request with the given consistency model (only relevant if in-place updates are enabled).
-
Constructor Details
-
ExecutionEnvironment
public ExecutionEnvironment(PgxSession session, oracle.pgx.api.internal.CoreSessionApi coreSessionApi)
-
-
Method Details
-
getValuesAsync
- Returns:
- the current configuration
-
withMaxNumThreadsAsync
public <T> PgxFuture<T> withMaxNumThreadsAsync(int maxNumThreads, Supplier<PgxFuture<T>> asyncRequest) Executes the given asynchronous request with at mostmaxNumThreads. This affects all task types.- Parameters:
maxNumThreads- the maximum number of threads to use for the requestasyncRequest- the asynchronous request to execute- Returns:
- the result of the asynchronous request
-
resetAsync
Resets the environment for this session to the configured default values. -
reset
- Throws:
InterruptedException- if the caller thread gets interrupted while waiting for completion.ExecutionException- if any exception occurred during asynchronous execution. The actual exception will be nested.
-
withMaxNumThreads
public <T> T withMaxNumThreads(int maxNumThreads, Supplier<PgxFuture<T>> asyncRequest) throws ExecutionException, InterruptedException Blocking version ofwithMaxNumThreadsAsync(int, Supplier). CallswithMaxNumThreadsAsync(int, Supplier)and waits for returnedPgxFutureto complete.- Throws:
InterruptedException- if the caller thread gets interrupted while waiting for completion.ExecutionException- if any exception occurred during asynchronous execution. The actual exception will be nested.
-
getValues
Blocking version ofgetValuesAsync(). CallsgetValuesAsync()and waits for returnedPgxFutureto complete.- Throws:
InterruptedException- if the caller thread gets interrupted while waiting for completion.ExecutionException- if any exception occurred during asynchronous execution. The actual exception will be nested.
-
getSession
- Returns:
- the session associated with this execution environment.
-
getIoEnvironment
- Returns:
- the execution environment for IO tasks
-
setUpdateConsistencyModelAsync
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
Gets the consistency model to be used with in-place updates (if enabled).- Returns:
- The current update consistency model for this session
-
resetUpdateConsistencyModelAsync
Resets the consistency model to be used with in-place updates (if enabled) to the default value, as configured inPgxConfig.getInPlaceUpdateConsistencyModel() -
withUpdateConsistencyModelAsync
public <T> PgxFuture<T> withUpdateConsistencyModelAsync(UpdateConsistencyModel model, 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 useasyncRequest- the asynchronous request to execute- Returns:
- the result of the asynchronous request
-
setUpdateConsistencyModel
Blocking version ofsetUpdateConsistencyModelAsync(UpdateConsistencyModel). CallssetUpdateConsistencyModelAsync(UpdateConsistencyModel)and waits for returnedPgxFutureto complete.- Parameters:
model- The desired Consistnecy Model
-
resetUpdateConsistencyModel
public void resetUpdateConsistencyModel()Blocking version ofresetUpdateConsistencyModelAsync(). CallsresetUpdateConsistencyModelAsync()and waits for returnedPgxFutureto complete. -
withUpdateConsistencyModel
public <T> T withUpdateConsistencyModel(UpdateConsistencyModel model, Supplier<PgxFuture<T>> asyncRequest) Blocking version ofwithUpdateConsistencyModelAsync(UpdateConsistencyModel, Supplier). CallswithUpdateConsistencyModelAsync(UpdateConsistencyModel, Supplier)and waits for returnedPgxFutureto complete. -
getUpdateConsistencyModel
Blocking version ofgetUpdateConsistencyModelAsync(). CallsgetUpdateConsistencyModelAsync()and waits for returnedPgxFutureto complete. -
getAnalysisEnvironment
- Returns:
- the execution environment for analysis tasks
-
getFastAnalysisEnvironment
- Returns:
- the execution environment for fast analysis tasks
-
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
-
allowsConcurrentTasks
public boolean allowsConcurrentTasks()Blocking version ofallowsConcurrentTasksAsync(). CallsallowsConcurrentTasksAsync()and waits for returnedPgxFutureto complete. -
toString
-