- All Implemented Interfaces:
- Sync
public class Semaphore
extends java.lang.Object
implements Sync
A semaphore is a old locking technique where only a specified number of threads can obtain the lock at one time. The other
threads that wants to acquire the lock will wait in line until the lock is released. Everyone takes turns obtaining the
lock. The number of locks that can be acquired at one time is determined by the constructor. This class does not
guarantee that a thread waiting to obtain a lock will get it, even if it is waiting for it before other threads. There is
no Priority assigned to the waiting.