cow: CopyOnWriteArrayList - deterministic iterator-snapshot and synchronizedList CME demos, JMH read/write throughput, and the addLast/removeFirst fix for a real concurrent-writer race

This commit is contained in:
Claude
2026-10-01 12:09:44 +00:00
parent 2eaa464bad
commit 434054f246
17 changed files with 709 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
mvn -q -B compile
java -cp target/classes com.ankurm.cow.IteratorSnapshotDemo 2>&1 \
| grep -vE 'JAVA_TOOL_OPTIONS|^WARNING' > output/01-iterator-snapshot-demo.txt
java -cp target/classes com.ankurm.cow.SynchronizedListCmeDemo 2>&1 \
| grep -vE 'JAVA_TOOL_OPTIONS|^WARNING' > output/02-synchronizedlist-cme-demo.txt
mvn -q -B test
cp target/surefire-reports/com.ankurm.cow.CowClaimsTest.txt output/03-tests.txt
mvn -q -B package -DskipTests
java -jar target/benchmarks.jar ReadThroughputBenchmark -rf text -rff output/04-read-throughput-jmh.txt
java -jar target/benchmarks.jar WriteThroughputBenchmark -rf text -rff output/05-write-throughput-jmh.txt
echo "Regenerated output/01-05. output/06-write-throughput-race.txt is a one-off captured failure"
echo "from an earlier, deliberately buggy version of the write benchmark - see the README - and"
echo "is NOT regenerated by this script."
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Run one of the demo classes ad hoc, e.g.: ./scripts/run.sh IteratorSnapshotDemo
set -euo pipefail
cd "$(dirname "$0")/.."
mvn -q -B compile
java -cp target/classes "com.ankurm.cow.$1"