ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/LinkedBlockingQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/LinkedBlockingQueue.java (file contents):
Revision 1.16 by tim, Wed Aug 6 18:22:09 2003 UTC vs.
Revision 1.17 by tim, Fri Aug 8 20:05:07 2003 UTC

# Line 89 | Line 89 | public class LinkedBlockingQueue<E> exte
89          takeLock.lock();
90          try {
91              notEmpty.signal();
92 <        }
93 <        finally {
92 >        } finally {
93              takeLock.unlock();
94          }
95      }
# Line 102 | Line 101 | public class LinkedBlockingQueue<E> exte
101          putLock.lock();
102          try {
103              notFull.signal();
104 <        }
106 <        finally {
104 >        } finally {
105              putLock.unlock();
106          }
107      }
# Line 260 | Line 258 | public class LinkedBlockingQueue<E> exte
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              }
# Line 269 | Line 266 | public class LinkedBlockingQueue<E> exte
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)
# Line 302 | Line 298 | public class LinkedBlockingQueue<E> exte
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)
# Line 336 | Line 330 | public class LinkedBlockingQueue<E> exte
330                  if (c + 1 < capacity)
331                      notFull.signal();
332              }
333 <        }
340 <        finally {
333 >        } finally {
334              putLock.unlock();
335          }
336          if (c == 0)
# Line 354 | Line 347 | public class LinkedBlockingQueue<E> exte
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              }
# Line 364 | Line 356 | public class LinkedBlockingQueue<E> exte
356              c = count.getAndDecrement();
357              if (c > 1)
358                  notEmpty.signal();
359 <        }
368 <        finally {
359 >        } finally {
360              takeLock.unlock();
361          }
362          if (c == capacity)
# Line 391 | Line 382 | public class LinkedBlockingQueue<E> exte
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)
# Line 419 | Line 408 | public class LinkedBlockingQueue<E> exte
408                  if (c > 1)
409                      notEmpty.signal();
410              }
411 <        }
423 <        finally {
411 >        } finally {
412              takeLock.unlock();
413          }
414          if (c == capacity)
# Line 439 | Line 427 | public class LinkedBlockingQueue<E> exte
427                  return null;
428              else
429                  return first.item;
430 <        }
443 <        finally {
430 >        } finally {
431              takeLock.unlock();
432          }
433      }
# Line 480 | Line 467 | public class LinkedBlockingQueue<E> exte
467                  if (count.getAndDecrement() == capacity)
468                      notFull.signalAll();
469              }
470 <        }
484 <        finally {
470 >        } finally {
471              fullyUnlock();
472          }
473          return removed;
# Line 496 | Line 482 | public class LinkedBlockingQueue<E> exte
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      }
# Line 514 | Line 499 | public class LinkedBlockingQueue<E> exte
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      }
# Line 524 | Line 508 | public class LinkedBlockingQueue<E> exte
508          fullyLock();
509          try {
510              return super.toString();
511 <        }
528 <        finally {
511 >        } finally {
512              fullyUnlock();
513          }
514      }
# Line 560 | Line 543 | public class LinkedBlockingQueue<E> exte
543                  current = head.next;
544                  if (current != null)
545                      currentElement = current.item;
546 <            }
564 <            finally {
546 >            } finally {
547                  fullyUnlock();
548              }
549          }
# Line 581 | Line 563 | public class LinkedBlockingQueue<E> exte
563                  if (current != null)
564                      currentElement = current.item;
565                  return x;
566 <            }
585 <            finally {
566 >            } finally {
567                  fullyUnlock();
568              }
569  
# Line 608 | Line 589 | public class LinkedBlockingQueue<E> exte
589                      if (c == capacity)
590                          notFull.signalAll();
591                  }
592 <            }
612 <            finally {
592 >            } finally {
593                  fullyUnlock();
594              }
595          }
# Line 637 | Line 617 | public class LinkedBlockingQueue<E> exte
617  
618              // Use trailing null as sentinel
619              s.writeObject(null);
620 <        }
641 <        finally {
620 >        } finally {
621              fullyUnlock();
622          }
623      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines