pear-concurrency

Eliminate unsafe Java concurrent and asynchronous code patterns.

Updated May 15, 2026
One-click install
npx skills add https://github.com/Pear-Commerce/pear-ai-skills --skill pear-concurrency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pear-concurrency
Source: https://github.com/Pear-Commerce/pear-ai-skills/tree/main/skills/pear-concurrency
Command: npx skills add https://github.com/Pear-Commerce/pear-ai-skills --skill pear-concurrency

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the common, high-impact bugs caused by unsafe Java concurrent and asynchronous code, including indefinite hangs from missing timeouts, thread pool leaks, virtual thread pinning, and unsafe shared state that lead to production outages and difficult-to-debug errors.

Core Features & Use Cases

  • Safe Parallel Execution Patterns: Mandates timeout usage for all future aggregations, provides helper methods for submitting tasks with backpressure to prevent resource exhaustion.
  • Pre-built Thread Pool Utilities: Offers configurations for bounded platform thread pools, hybrid virtual/platform overflow pools, and ad-hoc pools with enforced shutdown guardrails.
  • Concurrency Safety Primitives: Includes KeyedLock for key-based mutual exclusion, request deduplication caches, cross-server distributed locks, and AtomicVelocityCounter for progress tracking.
  • Use Case Example: When building a high-concurrency data scraping service, use this Skill to configure a hybrid thread pool, submit tasks with enforced timeouts, and track processing progress without risking thread leaks or deadlocks.

Quick Start

Ask the pear-concurrency skill to audit your Java async code for hanging futures, missing timeouts, and unsafe thread pool configurations.

Frequently Asked Questions about pear-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent Java thread pool leaks and indefinite hangs in concurrent applications?

To prevent Java thread pool leaks and indefinite hangs, enforce mandatory timeout usage for future aggregations and apply bounded thread pool utilities with enforced shutdown guardrails, eliminating unsafe parallel execution patterns.

What causes virtual thread pinning in Java async code and how do I fix it?

Virtual thread pinning in Java async code is caused by unsafe concurrent execution patterns. Fix it by configuring hybrid virtual and platform overflow thread pools to manage backpressure and prevent resource exhaustion.

How do I implement keyed locking for request deduplication in Java?

Implement keyed locking for request deduplication in Java by using the KeyedLock concurrency primitive, which provides key-based mutual exclusion to ensure safe shared state access across parallel tasks.

Does this concurrency Skill support cross-server distributed locks and progress tracking?

Yes, this Java concurrency Skill supports cross-server distributed locks and progress tracking through the AtomicVelocityCounter primitive, meeting high-concurrency application requirements for safe parallel task execution.

What is the best way to configure a bounded thread pool for high-concurrency Java applications?

The best way to configure a bounded thread pool for high-concurrency Java applications is using pre-built utilities that offer bounded platform thread pools, hybrid virtual and platform overflow pools, and ad-hoc pools with enforced shutdown guardrails.

Why do my Java async tasks hang when aggregating futures without timeouts?

Java async tasks hang when aggregating futures without timeouts because unsafe concurrent code allows indefinite blocking. Mandating timeout usage for all future aggregations eliminates these indefinite hangs and production outages.