#!/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 [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