|
12 | 12 | import java.util.Map; |
13 | 13 | import java.util.concurrent.CompletableFuture; |
14 | 14 | import java.util.concurrent.ConcurrentHashMap; |
15 | | -import java.util.concurrent.Executor; |
16 | | -import java.util.concurrent.ForkJoinPool; |
17 | 15 | import java.util.concurrent.Phaser; |
18 | 16 | import java.util.concurrent.atomic.AtomicReference; |
19 | 17 | import org.slf4j.Logger; |
|
36 | 34 | * </ul> |
37 | 35 | * |
38 | 36 | * <p>This is the single entry point for all execution coordination. Internal coordination (polling, checkpointing) uses |
39 | | - * the common ForkJoinPool, while user operations run on a customer-configured executor. |
| 37 | + * a dedicated SDK thread pool, while user-defined operations run on a customer-configured executor. |
| 38 | + * |
| 39 | + * @see InternalExecutor |
40 | 40 | */ |
41 | 41 | public class ExecutionManager { |
42 | 42 |
|
43 | 43 | private static final Logger logger = LoggerFactory.getLogger(ExecutionManager.class); |
44 | 44 |
|
45 | | - /** Internal executor for SDK coordination tasks (polling, phaser management). */ |
46 | | - private static final Executor INTERNAL_EXECUTOR = ForkJoinPool.commonPool(); |
47 | | - |
48 | 45 | // ===== Execution State ===== |
49 | 46 | private final Map<String, Operation> operations = new ConcurrentHashMap<>(); |
50 | 47 | private final String executionOperationId; |
@@ -256,7 +253,7 @@ public CompletableFuture<Void> sendOperationUpdate(OperationUpdate update) { |
256 | 253 | // wait while another thread is still running and we therefore are not |
257 | 254 | // re-invoked because we never suspended. |
258 | 255 | public void pollForOperationUpdates(String operationId, Instant firstPollTime, Duration period) { |
259 | | - INTERNAL_EXECUTOR.execute(() -> { |
| 256 | + InternalExecutor.INSTANCE.execute(() -> { |
260 | 257 | // Sleep until the start |
261 | 258 | try { |
262 | 259 | var sleepDuration = Duration.between(Instant.now(), firstPollTime); |
@@ -296,7 +293,7 @@ public void pollForOperationUpdates(String operationId, Instant firstPollTime, D |
296 | 293 | // re-invoked because we never suspended. |
297 | 294 | public void pollUntilReady( |
298 | 295 | String operationId, CompletableFuture<Void> future, Instant firstPollTime, Duration period) { |
299 | | - INTERNAL_EXECUTOR.execute(() -> { |
| 296 | + InternalExecutor.INSTANCE.execute(() -> { |
300 | 297 | // Sleep until first poll time |
301 | 298 | try { |
302 | 299 | Duration sleepDuration = Duration.between(Instant.now(), firstPollTime); |
|
0 commit comments