semaphore
-
SemaphoreStaticPL/JAVA 2020. 2. 27. 15:44
1. Overview Semaphore can be used to restrict the number of users to a particular resource or a group of resources, unlike the locks that allow only one user per resource. The semaphore can restrict any given number of users to a resource. 2. Description 2.1 How to use Semaphore semaphore = new Semaphore(NUMBER_OF_PERMITS); semaphore.acquire(5); // NUMBER_OF_PERMITS useResource(); semaphore.rele..