# | Line 20 | Line 20 | import java.util.concurrent.locks.Abstra | |
---|---|---|
20 | * <p>Semaphores are often used to restrict the number of threads than can | |
21 | * access some (physical or logical) resource. For example, here is | |
22 | * a class that uses a semaphore to control access to a pool of items: | |
23 | < | * <pre> {@code |
23 | > | * <pre> {@code |
24 | * class Pool { | |
25 | * private static final int MAX_AVAILABLE = 100; | |
26 | * private final Semaphore available = new Semaphore(MAX_AVAILABLE, true); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |