260 |
|
* less than or equal to zero, the method will not wait at all. |
261 |
|
* |
262 |
|
* @param timeout the maximum time to wait for a permit |
263 |
< |
* @param granularity the time unit of the <tt>timeout</tt> argument. |
263 |
> |
* @param unit the time unit of the <tt>timeout</tt> argument. |
264 |
|
* @return <tt>true</tt> if a permit was acquired and <tt>false</tt> |
265 |
|
* if the waiting time elapsed before a permit was acquired. |
266 |
|
* |
269 |
|
* @see Thread#interrupt |
270 |
|
* |
271 |
|
*/ |
272 |
< |
public boolean tryAcquire(long timeout, TimeUnit granularity) |
272 |
> |
public boolean tryAcquire(long timeout, TimeUnit unit) |
273 |
|
throws InterruptedException { |
274 |
|
lock.lockInterruptibly(); |
275 |
< |
long nanos = granularity.toNanos(timeout); |
275 |
> |
long nanos = unit.toNanos(timeout); |
276 |
|
try { |
277 |
|
for (;;) { |
278 |
|
if (count > 0) { |