--- jsr166/src/jsr166x/BlockingDeque.java 2009/11/16 04:16:42 1.2 +++ jsr166/src/jsr166x/BlockingDeque.java 2016/07/15 18:49:12 1.9 @@ -1,10 +1,11 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; // XXX This belongs in java.util!!! XXX + import java.util.concurrent.*; // XXX This import goes away XXX import java.util.*; @@ -43,17 +44,17 @@ import java.util.*; * * * - *

Like any {@link BlockingQueue}, a BlockingDeque is + *

Like any {@link BlockingQueue}, a {@code BlockingDeque} is * thread safe and may (or may not) be capacity-constrained. A - * BlockingDeque implementation may be used directly as a - * FIFO BlockingQueue. The blocking methods inherited from - * the BlockingQueue interface are precisely equivalent to - * BlockingDeque methods as indicated in the following table:

+ * {@code BlockingDeque} implementation may be used directly as a + * FIFO {@code BlockingQueue}. The blocking methods inherited from + * the {@code BlockingQueue} interface are precisely equivalent to + * {@code BlockingDeque} methods as indicated in the following table:

* * * - * - * + * + * * * * @@ -74,7 +75,6 @@ import java.util.*; * *
BlockingQueue Method Equivalent BlockingDeque Method {@code BlockingQueue} Method Equivalent {@code BlockingDeque} Method
* - * *

This interface is a member of the * * Java Collections Framework. @@ -89,8 +89,8 @@ public interface BlockingDeque extend * Adds the specified element as the first element of this deque, * waiting if necessary for space to become available. * @param o the element to add - * @throws InterruptedException if interrupted while waiting. - * @throws NullPointerException if the specified element is null. + * @throws InterruptedException if interrupted while waiting + * @throws NullPointerException if the specified element is {@code null} */ void putFirst(E o) throws InterruptedException; @@ -98,8 +98,8 @@ public interface BlockingDeque extend * Adds the specified element as the last element of this deque, * waiting if necessary for space to become available. * @param o the element to add - * @throws InterruptedException if interrupted while waiting. - * @throws NullPointerException if the specified element is null. + * @throws InterruptedException if interrupted while waiting + * @throws NullPointerException if the specified element is {@code null} */ void putLast(E o) throws InterruptedException; @@ -107,7 +107,7 @@ public interface BlockingDeque extend * Retrieves and removes the first element of this deque, waiting * if no elements are present on this deque. * @return the head of this deque - * @throws InterruptedException if interrupted while waiting. + * @throws InterruptedException if interrupted while waiting */ E takeFirst() throws InterruptedException; @@ -115,7 +115,7 @@ public interface BlockingDeque extend * Retrieves and removes the last element of this deque, waiting * if no elements are present on this deque. * @return the head of this deque - * @throws InterruptedException if interrupted while waiting. + * @throws InterruptedException if interrupted while waiting */ E takeLast() throws InterruptedException; @@ -125,13 +125,13 @@ public interface BlockingDeque extend * become available. * @param o the element to add * @param timeout how long to wait before giving up, in units of - * unit - * @param unit a TimeUnit determining how to interpret the - * timeout parameter - * @return true if successful, or false if - * the specified waiting time elapses before space is available. - * @throws InterruptedException if interrupted while waiting. - * @throws NullPointerException if the specified element is null. + * {@code unit} + * @param unit a {@code TimeUnit} determining how to interpret the + * {@code timeout} parameter + * @return {@code true} if successful, or {@code false} if + * the specified waiting time elapses before space is available + * @throws InterruptedException if interrupted while waiting + * @throws NullPointerException if the specified element is {@code null} */ boolean offerFirst(E o, long timeout, TimeUnit unit) throws InterruptedException; @@ -142,13 +142,13 @@ public interface BlockingDeque extend * become available. * @param o the element to add * @param timeout how long to wait before giving up, in units of - * unit - * @param unit a TimeUnit determining how to interpret the - * timeout parameter - * @return true if successful, or false if - * the specified waiting time elapses before space is available. - * @throws InterruptedException if interrupted while waiting. - * @throws NullPointerException if the specified element is null. + * {@code unit} + * @param unit a {@code TimeUnit} determining how to interpret the + * {@code timeout} parameter + * @return {@code true} if successful, or {@code false} if + * the specified waiting time elapses before space is available + * @throws InterruptedException if interrupted while waiting + * @throws NullPointerException if the specified element is {@code null} */ boolean offerLast(E o, long timeout, TimeUnit unit) throws InterruptedException; @@ -159,12 +159,12 @@ public interface BlockingDeque extend * if necessary up to the specified wait time if no elements are * present on this deque. * @param timeout how long to wait before giving up, in units of - * unit - * @param unit a TimeUnit determining how to interpret the - * timeout parameter - * @return the head of this deque, or null if the - * specified waiting time elapses before an element is present. - * @throws InterruptedException if interrupted while waiting. + * {@code unit} + * @param unit a {@code TimeUnit} determining how to interpret the + * {@code timeout} parameter + * @return the head of this deque, or {@code null} if the + * specified waiting time elapses before an element is present + * @throws InterruptedException if interrupted while waiting */ E pollFirst(long timeout, TimeUnit unit) throws InterruptedException; @@ -174,12 +174,12 @@ public interface BlockingDeque extend * if necessary up to the specified wait time if no elements are * present on this deque. * @param timeout how long to wait before giving up, in units of - * unit - * @param unit a TimeUnit determining how to interpret the - * timeout parameter - * @return the head of this deque, or null if the - * specified waiting time elapses before an element is present. - * @throws InterruptedException if interrupted while waiting. + * {@code unit} + * @param unit a {@code TimeUnit} determining how to interpret the + * {@code timeout} parameter + * @return the head of this deque, or {@code null} if the + * specified waiting time elapses before an element is present + * @throws InterruptedException if interrupted while waiting */ E pollLast(long timeout, TimeUnit unit) throws InterruptedException; @@ -187,10 +187,10 @@ public interface BlockingDeque extend /** * Adds the specified element as the last element of this deque, * waiting if necessary for space to become available. This - * method is equivalent to to putLast + * method is equivalent to putLast. * @param o the element to add - * @throws InterruptedException if interrupted while waiting. - * @throws NullPointerException if the specified element is null. + * @throws InterruptedException if interrupted while waiting + * @throws NullPointerException if the specified element is {@code null} */ void put(E o) throws InterruptedException; @@ -198,15 +198,15 @@ public interface BlockingDeque extend * Inserts the specified element as the lest element of this * deque, if possible. When using deques that may impose * insertion restrictions (for example capacity bounds), method - * offer is generally preferable to method {@link + * {@code offer} is generally preferable to method {@link * Collection#add}, which can fail to insert an element only by - * throwing an exception. This method is equivalent to to - * offerLast + * throwing an exception. This method is equivalent to + * offerLast. * - * @param o the element to add. - * @return true if it was possible to add the element to - * this deque, else false - * @throws NullPointerException if the specified element is null + * @param o the element to add + * @return {@code true} if it was possible to add the element to + * this deque, else {@code false} + * @throws NullPointerException if the specified element is {@code null} */ boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException; @@ -214,24 +214,24 @@ public interface BlockingDeque extend /** * Retrieves and removes the first element of this deque, waiting * if no elements are present on this deque. - * This method is equivalent to to takeFirst + * This method is equivalent to takeFirst. * @return the head of this deque - * @throws InterruptedException if interrupted while waiting. + * @throws InterruptedException if interrupted while waiting */ E take() throws InterruptedException; /** * Retrieves and removes the first element of this deque, waiting * if necessary up to the specified wait time if no elements are - * present on this deque. This method is equivalent to to - * pollFirst + * present on this deque. This method is equivalent to + * pollFirst. * @param timeout how long to wait before giving up, in units of - * unit - * @param unit a TimeUnit determining how to interpret the - * timeout parameter - * @return the head of this deque, or null if the - * specified waiting time elapses before an element is present. - * @throws InterruptedException if interrupted while waiting. + * {@code unit} + * @param unit a {@code TimeUnit} determining how to interpret the + * {@code timeout} parameter + * @return the head of this deque, or {@code null} if the + * specified waiting time elapses before an element is present + * @throws InterruptedException if interrupted while waiting */ E poll(long timeout, TimeUnit unit) throws InterruptedException;