java-concurrency-reviewlisted
Install: claude install-skill limited-grisaille833/claude-java-plugins
Review the Java code for concurrency correctness. Before reviewing, detect the Java version from `pom.xml` or `build.gradle` — suggest modern alternatives only if the version supports them.
## Step 1 — Identify concurrency primitives in use
List all concurrency mechanisms found: `synchronized`, `volatile`, `AtomicXxx`, `Lock`, `ExecutorService`, `CompletableFuture`, `CountDownLatch`, `Semaphore`, `BlockingQueue`, virtual threads (Java 21+).
## Step 2 — Review for race conditions
- Flag shared mutable fields accessed from multiple threads without synchronization
- Flag read-modify-write operations (e.g., `count++`) not wrapped in `synchronized` or `AtomicInteger`
- Flag non-atomic check-then-act patterns: `if (map.containsKey(k)) map.get(k)` → suggest `map.computeIfAbsent()`
- Flag `HashMap` shared across threads → suggest `ConcurrentHashMap`
- Flag `ArrayList` / `HashSet` shared across threads → suggest concurrent alternatives
## Step 3 — Review for deadlocks
- Flag multiple locks acquired in inconsistent order across methods
- Flag `synchronized` calls that invoke external/unknown code while holding a lock
- Flag `ReentrantLock` without `try/finally` unlock → lock may never be released
- Flag nested `synchronized` blocks on different objects
## Step 4 — Review synchronization granularity
- Flag `synchronized` on entire methods where only a small critical section needs protection
- Suggest `ReentrantLock` for fine-grained locking with timeout capability
- Flag `synchroniz