java-concurrency
БесплатноБез исполняемых скриптовНе проверенImplement modern concurrency with Virtual Threads and Structured Concurrency in Java. Use when implementing Java Virtual Threads (Java 21+), Structured…
от HoangNguyen0403★ 598 звёзд на GitHubОб этом скилле
Java Concurrency
Priority: P1 (HIGH)
Implementation Guidelines
- Virtual Threads (Java 21+, stable): Use for high-throughput I/O.
Executors.newVirtualThreadPerTaskExecutor(). - Structured Concurrency (preview):
StructuredTaskScopeis a preview API in JDK 21 and still preview in current JDKs, and its API changed between previews. Use it only when the project opts in: pin the exact JDK, add--enable-previewto compilation and runtime, and check that JDK's javadoc. Otherwise use a virtual-thread executor and observe completions in arrival order (ExecutorCompletionService) so a failure in either task is seen and unfinished siblings are interrupted — plainCompletableFuturecancellation does not interrupt. - Immutability: Share immutable data between threads to avoid race conditions.
- CompletableFuture: Use for composing async pipelines (if not using Virtual Threads).
- Atomic Variables: Use
AtomicInteger,LongAdderfor simple counters. - Locks:
synchronizedis correct mutual exclusion. PreferReentrantLock/ReadWriteLockwhen you need timed/try/interruptible locking, fairness, or multiple conditions — not merely to avoid carrier pinning. - Thread Safety: Document
@ThreadSafeor@NotThreadSafe.
Anti-Patterns
- No new Thread(): Use Executors or virtual threads; never create threads manually.
- No Pooling Virtual Threads: Virtual threads cheap; never pool them.
- No Preview by Default: Never recommend a preview API as production guidance without an explicit project opt-in and exact-JDK pin.
- No Blanket synchronized Ban: JDK 21–23 pins the carrier while blocking inside a monitor; JDK 24+ (JEP 491) removes that. Judge by contention and lock needs, and measure before making performance claims.
- No Shared Mutable State: Share only immutable data between threads.
- No Thread.stop/suspend: Deprecated; use interruption or cancellation instead.
References
Установить java-concurrency в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл java-concurrency?
Implement modern concurrency with Virtual Threads and Structured Concurrency in Java. Use when implementing Java Virtual Threads (Java 21+), Structured Concurrency with StructuredTaskScope, CompletableFuture pipelines, or debugging race conditions.
Как установить скилл java-concurrency?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл java-concurrency запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic