Semaphores and Mutexes in Java: Controlling Concurrent Access

From counting semaphores to mutual exclusion — when to use each.