Skip to content

Commit

Permalink
add ForkJoinPool note to bulkhead tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slu-it committed Nov 24, 2023
1 parent 16c8a6d commit 39acb65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class DownstreamServiceWithAnnotationBasedBulkheadTests(
assertThat(results).containsOnly(42, null)
}

// Default CompletableFuture.supplyAsync(..) without an executor relies on the default ForkJoinPool.
// That pool scales according to the available CPU cores.
// This test would not run on our CI environment because we only have 1 available core.
// Under those conditions, the bulkhead threshold would never be reached.
private fun <T> supplyAsyncWithExecutor(block: () -> T): CompletableFuture<T> =
supplyAsync(block, executor)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class DownstreamServiceWithProgrammaticBulkheadTests {
assertThat(results).containsOnly(42, null)
}

// Default CompletableFuture.supplyAsync(..) without an executor relies on the default ForkJoinPool.
// That pool scales according to the available CPU cores.
// This test would not run on our CI environment because we only have 1 available core.
// Under those conditions, the bulkhead threshold would never be reached.
private fun <T> supplyAsyncWithExecutor(block: () -> T): CompletableFuture<T> =
supplyAsync(block, executor)
}

0 comments on commit 39acb65

Please sign in to comment.