# | Line 281 | Line 281 | public class FairSemaphore extends Semap | |
---|---|---|
281 | */ | |
282 | public void release(long permits) { | |
283 | if (permits < 0) throw new IllegalArgumentException(); | |
284 | < | lock.lock(); |
284 | > | // Even if using fair locks, releases should try to barge in. |
285 | > | if (!lock.tryLock()) |
286 | > | lock.lock(); |
287 | try { | |
288 | count += permits; | |
289 | for (int i = 0; i < permits; ++i) |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |