89 |
|
takeLock.lock(); |
90 |
|
try { |
91 |
|
notEmpty.signal(); |
92 |
< |
} |
93 |
< |
finally { |
92 |
> |
} finally { |
93 |
|
takeLock.unlock(); |
94 |
|
} |
95 |
|
} |
101 |
|
putLock.lock(); |
102 |
|
try { |
103 |
|
notFull.signal(); |
104 |
< |
} |
106 |
< |
finally { |
104 |
> |
} finally { |
105 |
|
putLock.unlock(); |
106 |
|
} |
107 |
|
} |
258 |
|
try { |
259 |
|
while (count.get() == capacity) |
260 |
|
notFull.await(); |
261 |
< |
} |
264 |
< |
catch (InterruptedException ie) { |
261 |
> |
} catch (InterruptedException ie) { |
262 |
|
notFull.signal(); // propagate to a non-interrupted thread |
263 |
|
throw ie; |
264 |
|
} |
266 |
|
c = count.getAndIncrement(); |
267 |
|
if (c + 1 < capacity) |
268 |
|
notFull.signal(); |
269 |
< |
} |
273 |
< |
finally { |
269 |
> |
} finally { |
270 |
|
putLock.unlock(); |
271 |
|
} |
272 |
|
if (c == 0) |
298 |
|
return false; |
299 |
|
try { |
300 |
|
nanos = notFull.awaitNanos(nanos); |
301 |
< |
} |
306 |
< |
catch (InterruptedException ie) { |
301 |
> |
} catch (InterruptedException ie) { |
302 |
|
notFull.signal(); // propagate to a non-interrupted thread |
303 |
|
throw ie; |
304 |
|
} |
305 |
|
} |
306 |
< |
} |
312 |
< |
finally { |
306 |
> |
} finally { |
307 |
|
putLock.unlock(); |
308 |
|
} |
309 |
|
if (c == 0) |
330 |
|
if (c + 1 < capacity) |
331 |
|
notFull.signal(); |
332 |
|
} |
333 |
< |
} |
340 |
< |
finally { |
333 |
> |
} finally { |
334 |
|
putLock.unlock(); |
335 |
|
} |
336 |
|
if (c == 0) |
347 |
|
try { |
348 |
|
while (count.get() == 0) |
349 |
|
notEmpty.await(); |
350 |
< |
} |
358 |
< |
catch (InterruptedException ie) { |
350 |
> |
} catch (InterruptedException ie) { |
351 |
|
notEmpty.signal(); // propagate to a non-interrupted thread |
352 |
|
throw ie; |
353 |
|
} |
356 |
|
c = count.getAndDecrement(); |
357 |
|
if (c > 1) |
358 |
|
notEmpty.signal(); |
359 |
< |
} |
368 |
< |
finally { |
359 |
> |
} finally { |
360 |
|
takeLock.unlock(); |
361 |
|
} |
362 |
|
if (c == capacity) |
382 |
|
return null; |
383 |
|
try { |
384 |
|
nanos = notEmpty.awaitNanos(nanos); |
385 |
< |
} |
395 |
< |
catch (InterruptedException ie) { |
385 |
> |
} catch (InterruptedException ie) { |
386 |
|
notEmpty.signal(); // propagate to a non-interrupted thread |
387 |
|
throw ie; |
388 |
|
} |
389 |
|
} |
390 |
< |
} |
401 |
< |
finally { |
390 |
> |
} finally { |
391 |
|
takeLock.unlock(); |
392 |
|
} |
393 |
|
if (c == capacity) |
408 |
|
if (c > 1) |
409 |
|
notEmpty.signal(); |
410 |
|
} |
411 |
< |
} |
423 |
< |
finally { |
411 |
> |
} finally { |
412 |
|
takeLock.unlock(); |
413 |
|
} |
414 |
|
if (c == capacity) |
427 |
|
return null; |
428 |
|
else |
429 |
|
return first.item; |
430 |
< |
} |
443 |
< |
finally { |
430 |
> |
} finally { |
431 |
|
takeLock.unlock(); |
432 |
|
} |
433 |
|
} |
467 |
|
if (count.getAndDecrement() == capacity) |
468 |
|
notFull.signalAll(); |
469 |
|
} |
470 |
< |
} |
484 |
< |
finally { |
470 |
> |
} finally { |
471 |
|
fullyUnlock(); |
472 |
|
} |
473 |
|
return removed; |
482 |
|
for (Node<E> p = head.next; p != null; p = p.next) |
483 |
|
a[k++] = p.item; |
484 |
|
return a; |
485 |
< |
} |
500 |
< |
finally { |
485 |
> |
} finally { |
486 |
|
fullyUnlock(); |
487 |
|
} |
488 |
|
} |
499 |
|
for (Node p = head.next; p != null; p = p.next) |
500 |
|
a[k++] = (T)p.item; |
501 |
|
return a; |
502 |
< |
} |
518 |
< |
finally { |
502 |
> |
} finally { |
503 |
|
fullyUnlock(); |
504 |
|
} |
505 |
|
} |
508 |
|
fullyLock(); |
509 |
|
try { |
510 |
|
return super.toString(); |
511 |
< |
} |
528 |
< |
finally { |
511 |
> |
} finally { |
512 |
|
fullyUnlock(); |
513 |
|
} |
514 |
|
} |
543 |
|
current = head.next; |
544 |
|
if (current != null) |
545 |
|
currentElement = current.item; |
546 |
< |
} |
564 |
< |
finally { |
546 |
> |
} finally { |
547 |
|
fullyUnlock(); |
548 |
|
} |
549 |
|
} |
563 |
|
if (current != null) |
564 |
|
currentElement = current.item; |
565 |
|
return x; |
566 |
< |
} |
585 |
< |
finally { |
566 |
> |
} finally { |
567 |
|
fullyUnlock(); |
568 |
|
} |
569 |
|
|
589 |
|
if (c == capacity) |
590 |
|
notFull.signalAll(); |
591 |
|
} |
592 |
< |
} |
612 |
< |
finally { |
592 |
> |
} finally { |
593 |
|
fullyUnlock(); |
594 |
|
} |
595 |
|
} |
617 |
|
|
618 |
|
// Use trailing null as sentinel |
619 |
|
s.writeObject(null); |
620 |
< |
} |
641 |
< |
finally { |
620 |
> |
} finally { |
621 |
|
fullyUnlock(); |
622 |
|
} |
623 |
|
} |