changeset 4740:e5d65a583c15

Merge
author michaelm
date Thu, 10 Nov 2011 15:41:49 +0000
parents 0ccfb35cce26 d6a5da5f6ba0
children 830d2e46023a
files
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Thu Nov 10 15:30:45 2011 +0000
+++ b/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Thu Nov 10 15:41:49 2011 +0000
@@ -742,6 +742,8 @@
             throw new NullPointerException();
         if (c == this)
             throw new IllegalArgumentException();
+        if (maxElements <= 0)
+            return 0;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
--- a/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Thu Nov 10 15:30:45 2011 +0000
+++ b/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Thu Nov 10 15:41:49 2011 +0000
@@ -332,7 +332,7 @@
         // Note: convention in all put/take/etc is to preset local var
         // holding count negative to indicate failure unless set.
         int c = -1;
-        Node<E> node = new Node(e);
+        Node<E> node = new Node<E>(e);
         final ReentrantLock putLock = this.putLock;
         final AtomicInteger count = this.count;
         putLock.lockInterruptibly();
@@ -412,7 +412,7 @@
         if (count.get() == capacity)
             return false;
         int c = -1;
-        Node<E> node = new Node(e);
+        Node<E> node = new Node<E>(e);
         final ReentrantLock putLock = this.putLock;
         putLock.lock();
         try {
@@ -728,6 +728,8 @@
             throw new NullPointerException();
         if (c == this)
             throw new IllegalArgumentException();
+        if (maxElements <= 0)
+            return 0;
         boolean signalNotFull = false;
         final ReentrantLock takeLock = this.takeLock;
         takeLock.lock();