Identify and apply Java concurrency best practices to improve thread safety, scalability, and maintainability by using modern java.util.concurrent utilities, virtual threads, and structured concurrency.
Prerequisites: Run ./mvnw compile or mvn compile before applying any change. If compilation fails, stop immediately — compilation failure is a blocking condition that prevents any further processing.
Core areas: Thread safety fundamentals (ConcurrentHashMap, AtomicInteger, ReentrantLock, ReadWriteLock, Java Memory Model), ExecutorService thread pool configuration (sizing, keep-alive, bounded queues, rejection policies, graceful shutdown), Producer-Consumer and Publish-Subscribe concurrent design patterns (BlockingQueue), CompletableFuture for non-blocking async composition (thenApply/thenCompose/exceptionally/...
스레드 안전 기본 사항, ExecutorService 스레드 풀 관리, Producer-Consumer와 같은 동시 설계 패턴, CompletableFuture를 사용한 비동기 프로그래밍, 불변성 및 안전한 게시, 교착 상태 방지, 가상 스레드 및 구조화된 동시성, 범위가 지정된 값, 역압, 취소 규칙, 동시 시스템에 대한 관찰 가능성 등 Java 동시성 모범 사례를 적용해야 할 때 사용합니다. Skills-for-Java 프로젝트의 일부 출처: jabrena/cursor-rules-java.