AsyncExecutors { public static AsyncExecutor buffered(int maxParallelCalls) { return buffered(maxParallelCalls, Integer.MAX_VALUE); }  static AsyncExecutor direct(); static AsyncExecutor ofEventloop(@NotNull Eventloop eventloop); static AsyncExecutor roundRobin(@NotNull List<AsyncExecutor> executors); static AsyncExecutor sequential(); static AsyncExecutor buffered(int maxParallelCalls); static AsyncExecutor buffered(int maxParallelCalls, int maxBufferedCalls); static AsyncExecutor retry(@NotNull RetryPolicy<?> retryPolicy); static AsyncExecutor ofMaxRecursiveCalls(int maxRecursiveCalls);  }
@Test public void testBufferedForStackOverflow() { AsyncExecutor buffered = AsyncExecutors.buffered(50_000, 100_000); List<Promise<Void>> promises = new ArrayList<>(); for (int i = 0; i < 100_000; i++) { int finalI = i; promises.add(buffered.execute(() -> { Promise<Void> completePromise = Promise.complete(); if (finalI < 50_000){ return completePromise.async(); } else { return completePromise; } })); } await(Promises.toList(promises)); }