Interface ExecutionContext
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
CPUExecutionContext, CUDAExecutionContext, DistributedExecutionContext, OpenCLExecutionContext
Execution context for running operations on a backend.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases resources associated with this context.<T> TExecutes an operation synchronously and returns the result.default <T> CompletableFuture<T> executeAsync(Operation<T> operation) Executes an operation asynchronously.
-
Method Details
-
execute
Executes an operation synchronously and returns the result.- Type Parameters:
T- the result type- Parameters:
operation- the operation to execute- Returns:
- the operation result
- Throws:
RuntimeException- if execution fails
-
executeAsync
Executes an operation asynchronously.- Type Parameters:
T- the result type- Parameters:
operation- the operation to execute- Returns:
- a future representing the pending result
-
close
void close()Releases resources associated with this context.This method is called automatically when used in try-with-resources.
- Specified by:
closein interfaceAutoCloseable
-