Add the async module

Every @Async behaviour that surprises people, asserted by a test and captured
to docs/output/: the self-invocation trap, what CGLIB cannot override, the
IllegalArgumentException a plain return type throws, the unbounded queue that
makes max-size decoration, spring.task.execution.propagate-context (new in
Boot 4.1.0), the two Executor beans that leave @Async on an unpooled
SimpleAsyncTaskExecutor, and JEP 491 measured on JDK 21 against JDK 25.
This commit is contained in:
2026-09-01 23:27:47 +05:30
commit 9b3fe88813
53 changed files with 1891 additions and 0 deletions

24
async/scripts/pinning-probe.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Runs PinningProbe with the virtual-thread scheduler limited to two carrier threads, so that
# pinning (if it happened) would serialise the work into visible seconds.
#
# The probe is compiled on its own with --release 21 rather than as part of the module, so the
# same class file can be run on a JDK 21 and a JDK 25 JVM. That comparison is the whole point:
# JEP 491 landed in JDK 24, and the difference between the two runs is the feature.
#
# Usage: scripts/pinning-probe.sh <path-to-javac> <path-to-java> [more java binaries...]
set -euo pipefail
cd "$(dirname "$0")/.."
JAVAC_BIN="${1:-javac}"
shift || true
OUT=target/probe-classes
mkdir -p "$OUT"
"$JAVAC_BIN" --release 21 -d "$OUT" src/main/java/com/ankurm/async/PinningProbe.java
for JAVA_BIN in "${@:-java}"; do
echo "---------------------------------------------------------------"
"$JAVA_BIN" \
-Djdk.virtualThreadScheduler.parallelism=2 \
-Djdk.virtualThreadScheduler.maxPoolSize=2 \
-cp "$OUT" com.ankurm.async.PinningProbe
done