java-concurrency-jvm-memory
/java-concurrency-jvm-memory
Use this skill when diagnosing multi-threaded race conditions, volatile visibility, garbage collection tuning, and lock contention in Java.
- Author
- nextboxis ↗
- Repository
- library-skill-agents ↗
- Licence
- MIT
- Last repository change
- 28.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 28.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use this skill when diagnosing multi-threaded race conditions, volatile visibility, garbage collection tuning, and lock contention in Java.
Original author description
Use this skill when diagnosing multi-threaded race conditions, volatile visibility, garbage collection tuning, and lock contention in Java.
How it works
- When to use
- Prerequisites
- Step-by-step workflow
- Commands / code examples
- Common mistakes & pitfalls
- Verification checklist
- Related skills
SKILL.md preview
---
name: java-concurrency-jvm-memory
description: Use this skill when diagnosing multi-threaded race conditions, volatile visibility, garbage collection tuning, and lock contention in Java.
---
# Java Concurrency & JVM Memory Model
## When to use
Use this skill when you need to diagnosing multi-threaded race conditions, volatile visibility, garbage collection tuning, and lock contention in Java.
## Prerequisites
- Working knowledge of relevant programming language or database fundamentals.
- Access to testing environment or local runtime instance.
## Step-by-step workflow
1. **Analyze operational requirements**: Review performance boundaries, data integrity constraints, and query patterns.
2. **Design schema / interface**: Define explicit data contracts, types, or indexes supporting planned operations.
3. **Implement core routines**: Construct declarative, type-safe, or parameterized queries and functions.
4. **Validate performance**: Verify execution metrics using profilers, EXPLAIN plans, or benchmark test suites.
5. **Implement defensive controls**: Enforce timeout boundaries, connection pooling limits, and transaction safety.
## Commands / code examples
```java
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class MetricRegistry {
private final AtomicLong requestCounter = new AtomicLong(0);
private final ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
private String systemState = "INITIALIZING";
public void increment() {
requestCounter.incrementAndGet();
}
public void updateState(String newState) {
rwLock.writeLock().lock();
try {
this.systemState = newState;
} finally {
rwLock.writeLock().unlock();
}
}
}
```
## Common mistakes & pitfalls
- Overlooking indexing strategies on foreign keys and frequently queried filter columns.
- Running unparameterized dynamic queries, creating severe SQL injection vulnerabilities.
- Holding open long-running database transactions during slow external network calls.
## Verification checklist
- [ ] Schema contracts and type signatures are strictly enforced.
- [ ] Queries are fully parameterized against injection vulnerabilities.
- [ ] Profiling or execution plans show optimal resource consumption.
- [ ] Error handling safely releases locks and rolls back aborted transactions.
## Related skills
- postgresql-query-optimization-explain
- sql-anti-patterns-remediation
- acid-transactions-isolation-levels
- secure-code-review-static-analysis-sast
Versions
The database has no other skills named java-concurrency-jvm-memory.
Database snapshot: 13.11.2026 · package version d1d51e0e2ed9 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90jvm-memory-model
Apply happens-before reasoning, volatile, and safe publication to write correct concurrent Java/Kotlin. Use when writing shared-state JVM code or diagnosing visibility and reordering bugs. - 100java
Expert modern Java (Java 17/21 LTS) assistance covering records, pattern matching, virtual threads (Project Loom), Stream API, and JVM memory tuning. Use when writing idiomatic enterprise Java, optimizing garbage collection, or building concurrent backend applications. - 95java-optimization
执行 Java 代码性能优化,包括 JVM 调优、并发编程、内存管理、缓存策略、数据库优化、集合框架优化等。Invoke when user needs to optimize Java code performance. - 90cc-java-runtime
Use when Java thread pools, JVM memory/GC, JFR or thread-dump evidence, blocking contention or runtime latency need diagnosis or controlled tuning. - 100deadlock-race-condition-troubleshooting
Use this skill when detect and reproduce subtle multi-threaded race conditions and lock ordering deadlocks. - 100java-performance
JVM performance tuning guide — heap size configuration, GC selection, Kubernetes CPU throttling, and Prometheus monitoring. Use when optimizing Java applications, configuring the JVM for containers or Kubernetes, choosing the right Garbage Collector (G1, ZGC, ParallelGC),…