ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166x/BlockingDeque.java
(Generate patch)

Comparing jsr166/src/jsr166x/BlockingDeque.java (file contents):
Revision 1.1 by dl, Sun Dec 5 21:15:31 2004 UTC vs.
Revision 1.6 by jsr166, Sun Dec 30 02:05:53 2012 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   package jsr166x;     // XXX This belongs in java.util!!! XXX
8   import java.util.concurrent.*;  // XXX This import goes away        XXX
9 < import java.util.*;  
9 > import java.util.*;
10  
11   /**
12   * A {@link Deque} that additionally supports operations that wait for
# Line 32 | Line 32 | import java.util.*;
32   *    <td>{@link #putFirst putFirst(e)}</td>
33   *    <td>{@link #offerFirst(Object, long, TimeUnit) offerFirst(e, time, unit)}</td>
34   *    <td>{@link #putLast putLast(e)}</td>
35 < *    <td>{@link #offerLast(Object, long, TimeUnit) offerLast(e, time, unit)}</td>
35 > *    <td>{@link #offerLast(Object, long, TimeUnit) offerLast(e, time, unit)}</td>
36   *  </tr>
37   *  <tr>
38   *    <td><b>Remove</b></td>
# Line 89 | Line 89 | public interface BlockingDeque<E> extend
89       * Adds the specified element as the first element of this deque,
90       * waiting if necessary for space to become available.
91       * @param o the element to add
92 <     * @throws InterruptedException if interrupted while waiting.
93 <     * @throws NullPointerException if the specified element is <tt>null</tt>.
92 >     * @throws InterruptedException if interrupted while waiting
93 >     * @throws NullPointerException if the specified element is <tt>null</tt>
94       */
95      void putFirst(E o) throws InterruptedException;
96  
# Line 98 | Line 98 | public interface BlockingDeque<E> extend
98       * Adds the specified element as the last element of this deque,
99       * waiting if necessary for space to become available.
100       * @param o the element to add
101 <     * @throws InterruptedException if interrupted while waiting.
102 <     * @throws NullPointerException if the specified element is <tt>null</tt>.
101 >     * @throws InterruptedException if interrupted while waiting
102 >     * @throws NullPointerException if the specified element is <tt>null</tt>
103       */
104      void putLast(E o) throws InterruptedException;
105  
# Line 107 | Line 107 | public interface BlockingDeque<E> extend
107       * Retrieves and removes the first element of this deque, waiting
108       * if no elements are present on this deque.
109       * @return the head of this deque
110 <     * @throws InterruptedException if interrupted while waiting.
110 >     * @throws InterruptedException if interrupted while waiting
111       */
112      E takeFirst() throws InterruptedException;
113  
# Line 115 | Line 115 | public interface BlockingDeque<E> extend
115       * Retrieves and removes the last element of this deque, waiting
116       * if no elements are present on this deque.
117       * @return the head of this deque
118 <     * @throws InterruptedException if interrupted while waiting.
118 >     * @throws InterruptedException if interrupted while waiting
119       */
120      E takeLast() throws InterruptedException;
121  
# Line 129 | Line 129 | public interface BlockingDeque<E> extend
129       * @param unit a <tt>TimeUnit</tt> determining how to interpret the
130       * <tt>timeout</tt> parameter
131       * @return <tt>true</tt> if successful, or <tt>false</tt> if
132 <     * the specified waiting time elapses before space is available.
133 <     * @throws InterruptedException if interrupted while waiting.
134 <     * @throws NullPointerException if the specified element is <tt>null</tt>.
132 >     * the specified waiting time elapses before space is available
133 >     * @throws InterruptedException if interrupted while waiting
134 >     * @throws NullPointerException if the specified element is <tt>null</tt>
135       */
136      boolean offerFirst(E o, long timeout, TimeUnit unit)
137          throws InterruptedException;
# Line 146 | Line 146 | public interface BlockingDeque<E> extend
146       * @param unit a <tt>TimeUnit</tt> determining how to interpret the
147       * <tt>timeout</tt> parameter
148       * @return <tt>true</tt> if successful, or <tt>false</tt> if
149 <     * the specified waiting time elapses before space is available.
150 <     * @throws InterruptedException if interrupted while waiting.
151 <     * @throws NullPointerException if the specified element is <tt>null</tt>.
149 >     * the specified waiting time elapses before space is available
150 >     * @throws InterruptedException if interrupted while waiting
151 >     * @throws NullPointerException if the specified element is <tt>null</tt>
152       */
153      boolean offerLast(E o, long timeout, TimeUnit unit)
154          throws InterruptedException;
# Line 163 | Line 163 | public interface BlockingDeque<E> extend
163       * @param unit a <tt>TimeUnit</tt> determining how to interpret the
164       * <tt>timeout</tt> parameter
165       * @return the head of this deque, or <tt>null</tt> if the
166 <     * specified waiting time elapses before an element is present.
167 <     * @throws InterruptedException if interrupted while waiting.
166 >     * specified waiting time elapses before an element is present
167 >     * @throws InterruptedException if interrupted while waiting
168       */
169      E pollFirst(long timeout, TimeUnit unit)
170          throws InterruptedException;
# Line 178 | Line 178 | public interface BlockingDeque<E> extend
178       * @param unit a <tt>TimeUnit</tt> determining how to interpret the
179       * <tt>timeout</tt> parameter
180       * @return the head of this deque, or <tt>null</tt> if the
181 <     * specified waiting time elapses before an element is present.
182 <     * @throws InterruptedException if interrupted while waiting.
181 >     * specified waiting time elapses before an element is present
182 >     * @throws InterruptedException if interrupted while waiting
183       */
184      E pollLast(long timeout, TimeUnit unit)
185          throws InterruptedException;
# Line 187 | Line 187 | public interface BlockingDeque<E> extend
187      /**
188       * Adds the specified element as the last element of this deque,
189       * waiting if necessary for space to become available.  This
190 <     * method is equivalent to to putLast
190 >     * method is equivalent to putLast.
191       * @param o the element to add
192 <     * @throws InterruptedException if interrupted while waiting.
193 <     * @throws NullPointerException if the specified element is <tt>null</tt>.
192 >     * @throws InterruptedException if interrupted while waiting
193 >     * @throws NullPointerException if the specified element is <tt>null</tt>
194       */
195      void put(E o) throws InterruptedException;
196  
197 <    /**
197 >    /**
198       * Inserts the specified element as the lest element of this
199       * deque, if possible.  When using deques that may impose
200       * insertion restrictions (for example capacity bounds), method
201       * <tt>offer</tt> is generally preferable to method {@link
202       * Collection#add}, which can fail to insert an element only by
203 <     * throwing an exception.  This method is equivalent to to
204 <     * offerLast
203 >     * throwing an exception.  This method is equivalent to
204 >     * offerLast.
205       *
206 <     * @param o the element to add.
206 >     * @param o the element to add
207       * @return <tt>true</tt> if it was possible to add the element to
208       *         this deque, else <tt>false</tt>
209       * @throws NullPointerException if the specified element is <tt>null</tt>
# Line 214 | Line 214 | public interface BlockingDeque<E> extend
214      /**
215       * Retrieves and removes the first element of this deque, waiting
216       * if no elements are present on this deque.
217 <     * This method is equivalent to to takeFirst
217 >     * This method is equivalent to takeFirst.
218       * @return the head of this deque
219 <     * @throws InterruptedException if interrupted while waiting.
219 >     * @throws InterruptedException if interrupted while waiting
220       */
221      E take() throws InterruptedException;
222  
223      /**
224       * Retrieves and removes the first element of this deque, waiting
225       * if necessary up to the specified wait time if no elements are
226 <     * present on this deque.  This method is equivalent to to
227 <     * pollFirst
226 >     * present on this deque.  This method is equivalent to
227 >     * pollFirst.
228       * @param timeout how long to wait before giving up, in units of
229       * <tt>unit</tt>
230       * @param unit a <tt>TimeUnit</tt> determining how to interpret the
231       * <tt>timeout</tt> parameter
232       * @return the head of this deque, or <tt>null</tt> if the
233 <     * specified waiting time elapses before an element is present.
234 <     * @throws InterruptedException if interrupted while waiting.
233 >     * specified waiting time elapses before an element is present
234 >     * @throws InterruptedException if interrupted while waiting
235       */
236      E poll(long timeout, TimeUnit unit)
237          throws InterruptedException;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines