Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
12 lines
586 B
Bash
Executable File
12 lines
586 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Runs one demo: ./scripts/run.sh odd-even | ping-pong | ordered | deadlock | virtual
|
|
# Needs JDK 25 and Maven (Maven only to compile). The "virtual" demo is started with ONE carrier thread.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
mvn -B -q compile 2>&1 | grep -E 'ERROR' || true
|
|
FLAGS=(-Xmx256m)
|
|
if [ "${1:-}" = "virtual" ]; then
|
|
FLAGS+=(-Djdk.virtualThreadScheduler.parallelism=1 -Djdk.virtualThreadScheduler.maxPoolSize=1)
|
|
fi
|
|
java "${FLAGS[@]}" -cp target/classes com.ankurm.interviewlab.multithreading.Demo "$1" 2>&1 | grep -v '^Picked up JAVA_TOOL_OPTIONS'
|