Use when Java concurrency with ExecutorService, CompletableFuture, and virtual threads. Use when building concurrent applications.
View on GitHubTheBushidoCollective/han
jutsu-java
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/TheBushidoCollective/han/blob/main/jutsu/jutsu-java/skills/java-concurrency/SKILL.md -a claude-code --skill java-concurrencyInstallation paths:
.claude/skills/java-concurrency/# Java Concurrency
Master Java's concurrency utilities including ExecutorService,
CompletableFuture, locks, and modern virtual threads for building
high-performance concurrent applications.
## Thread Basics
Understanding Java threads is fundamental to concurrency.
**Creating and running threads:**
```java
public class ThreadBasics {
public static void main(String[] args) {
// Using Thread class
Thread thread1 = new Thread(() -> {
System.out.println("Running in thread: " +
Thread.currentThread().getName());
});
thread1.start();
// Using Runnable
Runnable task = () -> {
for (int i = 0; i < 5; i++) {
System.out.println("Task iteration: " + i);
}
};
Thread thread2 = new Thread(task);
thread2.start();
// Join threads
try {
thread1.join();
thread2.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
```
## ExecutorService
ExecutorService provides thread pool management and task scheduling.
**Basic executor usage:**
```java
import java.util.concurrent.*;
public class ExecutorBasics {
public static void main(String[] args) {
// Fixed thread pool
ExecutorService executor = Executors.newFixedThreadPool(3);
// Submit tasks
for (int i = 0; i < 5; i++) {
final int taskId = i;
executor.submit(() -> {
System.out.println("Task " + taskId + " on " +
Thread.currentThread().getName());
return taskId * 2;
});
}
// Shutdown executor
executor.shutdown();
try {
if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.c