In this recipe, you have used the following methods to get information about a semaphore:
- availablePermits(): This method returns an int value, which is the number of available resources of a semaphore.
- hasQueuedThreads(): This method returns a Boolean value indicating if there are threads waiting for a resource protected by a semaphore.
- getQueueLength(): This method returns the number of threads that are waiting for a resource protected by a semaphore.
- isFair(): This method returns a Boolean value indicating if a semaphore has the fair mode activated. When the fair mode is active (this method returns the true value), and the lock has to select another thread to give to it the access to the shared resource, it selects the ...