Class DistributedExecutionContext
java.lang.Object
org.episteme.core.distributed.DistributedExecutionContext
- All Implemented Interfaces:
AutoCloseable, ExecutionContext
Execution context adapter that bridges
DistributedContext with
the ExecutionContext interface.
This allows distributed contexts (MPI, Spark, local) to be used within the unified backend execution model.
- Since:
- 1.2
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new distributed execution context wrapping the given delegate. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases resources associated with this context.<T> TExecutes an operation synchronously and returns the result.<T> CompletableFuture<T> executeAsync(Operation<T> operation) Executes an operation asynchronously.Returns the underlying distributed context.intReturns the parallelism level of the underlying context.
-
Constructor Details
-
DistributedExecutionContext
Creates a new distributed execution context wrapping the given delegate.- Parameters:
delegate- the underlying distributed context
-
-
Method Details
-
execute
Description copied from interface:ExecutionContextExecutes an operation synchronously and returns the result.- Specified by:
executein interfaceExecutionContext- Type Parameters:
T- the result type- Parameters:
operation- the operation to execute- Returns:
- the operation result
-
executeAsync
Description copied from interface:ExecutionContextExecutes an operation asynchronously.- Specified by:
executeAsyncin interfaceExecutionContext- Type Parameters:
T- the result type- Parameters:
operation- the operation to execute- Returns:
- a future representing the pending result
-
getDistributedContext
Returns the underlying distributed context.- Returns:
- the delegate context
-
getParallelism
public int getParallelism()Returns the parallelism level of the underlying context.- Returns:
- available processing nodes or cores
-
close
public void close()Description copied from interface:ExecutionContextReleases resources associated with this context.This method is called automatically when used in try-with-resources.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceExecutionContext
-