pluginagentmarketplace/custom-plugin-java

java-concurrency

Master Java concurrency - threads, executors, locks, CompletableFuture, virtual threads

First seen Jan 21, 2026

Installation

$ npx skills add pluginagentmarketplace/custom-plugin-java --skill java-concurrency

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from pluginagentmarketplace/custom-plugin-java · top by installs.

npx skills add pluginagentmarketplace/custom-plugin-java

Browse all from pluginagentmarketplace/custom-plugin-java

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 40
License LICENSE
Default branch main
Open issues 2
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

Version3.0.0
Allowed toolsRead, Write, Bash, Glob, Grep

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,731 B
  • docs SUMMARY.md 111 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 446 installs

SKILL.md

Java Concurrency Skill

Master Java concurrency patterns for thread-safe applications.

Overview

This skill covers concurrency from basic threads to virtual threads (Java 21+), including thread pools, synchronization, and CompletableFuture.

When to Use This Skill

Use when you need to:

  • Write thread-safe code
  • Implement parallel processing
  • Use async programming patterns
  • Tune thread pools
  • Debug concurrency issues

Topics Covered

Thread Management

  • Thread lifecycle and states
  • Daemon vs user threads
  • Interrupt handling

Synchronization

  • synchronized, volatile
  • Lock interfaces (ReentrantLock)
  • Atomic operations

Executors

  • ThreadPoolExecutor configuration
  • ForkJoinPool
  • Virtual Threads (Java 21+)

CompletableFuture

  • Async execution
  • Chaining and composition
  • Exception handling

Quick Reference

// Virtual Threads (Java 21+)
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
    IntStream.range(0, 10_000).forEach(i ->
        executor.submit(() -> processRequest(i)));
}

// CompletableFuture composition
CompletableFuture<Result> result = fetchUser(id)
    .thenCompose(user -> fetchOrders(user.id()))
    .thenApply(orders -> processOrders(orders))
    .exceptionally(ex -> handleError(ex))
    .orTimeout(5, TimeUnit.SECONDS);

// Thread pool configuration
ThreadPoolExecutor executor = new ThreadPoolExecutor(
    10, 50, 60L, TimeUnit.SECONDS,
    new ArrayBlockingQueue<>(1000),
    new ThreadPoolExecutor.CallerRunsPolicy()
);

// Lock with timeout
ReentrantLock lock = new ReentrantLock();
if (lock.tryLock(1, TimeUnit.SECONDS)) {
    try {
        // critical section
    } finally {
        lock.unlock();
    }
}

Thread Pool Sizing

Workload Formula Example
CPU-bound cores 8 threads
I/O-bound cores * (1 + wait/compute) 80 threads

Troubleshooting

Problem Cause Solution
Deadlock Circular lock Lock ordering, tryLock
Race condition Missing sync Add locks/atomics
Thread starvation Unfair scheduling Fair locks

Debug Commands

jstack -l <pid> > threaddump.txt
jcmd <pid> Thread.print

Usage

Skill("java-concurrency")