Concurrency Utilities
Keyed concurrency utilities for parallel testing
Keyed concurrency utilities for fine-grained synchronization.
KeyedMutexManager
Provides mutual exclusion per key using static methods.
KeyedMutexManager.lock("key");
try {
// Critical section for this key
} finally {
KeyedMutexManager.unlock("key");
}
KeyedLatchManager
Count-down latches per key using static methods.
KeyedLatchManager.createLatch("key", 3); // Count of 3
KeyedLatchManager.countDown("key");
KeyedLatchManager.await("key"); // Waits until count reaches 0
KeyedSemaphoreManager
Semaphores per key for resource limiting using static methods.
KeyedSemaphoreManager.createSemaphore("resource", 5); // Max 5 permits
KeyedSemaphoreManager.acquire("resource");
try {
// Use resource
} finally {
KeyedSemaphoreManager.release("resource");
}
See Also
- Advanced → Keyed Concurrency - Detailed usage guide
- Advanced → Parallelism - Parallel execution patterns
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.