Add virtual-thread, structured-concurrency demos for the Spring Security context propagation guide
Three verified programs (JDK 25, Spring Security 7.1.1, Spring Boot 4.1.1 dependency versions) backing the ankurm.com post: InheritableThreadLocal across thread models, @Async on a virtual-thread SimpleAsyncTaskExecutor (DelegatingSecurityContextExecutor vs ContextPropagatingTaskDecorator), and StructuredTaskScope.fork() propagation. Captured console output and docs chapters included.
This commit is contained in:
19
scripts/run-all.sh
Executable file
19
scripts/run-all.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Compiles and runs all three demos, regenerating docs/output/*.txt.
|
||||
# Requires JDK 25 (StructuredTaskScope is a preview API through JDK 25/JEP 505).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
mvn -q dependency:build-classpath -Dmdep.outputFile=cp.txt
|
||||
CP=$(cat cp.txt)
|
||||
|
||||
rm -rf target/classes
|
||||
mkdir -p target/classes docs/output
|
||||
javac --release 25 --enable-preview -cp "$CP" -d target/classes $(find src -name '*.java')
|
||||
|
||||
for demo in Demo1PlainThreadLocal Demo2AsyncVirtualThreads Demo3StructuredConcurrency; do
|
||||
num=$(echo "$demo" | grep -o '[0-9]')
|
||||
out="docs/output/demo${num}.txt"
|
||||
echo "Running $demo -> $out"
|
||||
java --enable-preview -cp "target/classes:$CP" "com.ankurm.vt.$demo" | tee "$out"
|
||||
done
|
||||
Reference in New Issue
Block a user