Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

java-concurrency

БесплатноБез исполняемых скриптовНе проверен

Implement modern concurrency with Virtual Threads and Structured Concurrency in Java. Use when implementing Java Virtual Threads (Java 21+), Structured…

HoangNguyen0403от 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): StructuredTaskScope is 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-preview to 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 — plain CompletableFuture cancellation 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, LongAdder for simple counters.
  • Locks: synchronized is correct mutual exclusion. Prefer ReentrantLock / ReadWriteLock when you need timed/try/interruptible locking, fairness, or multiple conditions — not merely to avoid carrier pinning.
  • Thread Safety: Document @ThreadSafe or @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

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/evals.jsonreferences/structured-concurrency.md

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), без исполняемых скриптов.

Похожие скиллы

Сравнить java-concurrency с