12 |
|
/** |
13 |
|
* A {@link java.util.Queue} that additionally supports operations |
14 |
|
* that wait for elements to exist when retrieving them, and wait for |
15 |
< |
* space to exist when putting them. |
15 |
> |
* space to exist when storing them. |
16 |
|
* |
17 |
|
* <p>A <tt>BlockingQueue</tt> does not accept <tt>null</tt> elements. |
18 |
< |
* Implementations throw <tt>IllegalArgumentException</tt> on attempts |
18 |
> |
* Implementations throw <tt>NullPointerException</tt> on attempts |
19 |
|
* to <tt>add</tt>, <tt>put</tt> or <tt>offer</tt> a <tt>null</tt>. A |
20 |
|
* <tt>null</tt> is used as a sentinel value to indicate failure of |
21 |
|
* <tt>poll</tt> operations. |
27 |
|
* reports a remaining capacity of <tt>Integer.MAX_VALUE</tt>. |
28 |
|
* |
29 |
|
* <p> While <tt>BlockingQueue</tt> is designed to be used primarily |
30 |
< |
* as for producer-consumer queues, it additionally supports the |
30 |
> |
* for producer-consumer queues, it additionally supports the |
31 |
|
* <tt>Collection</tt> interface. So, for example, it is possible to |
32 |
|
* remove an arbitrary element from within a queue using |
33 |
|
* <tt>remove(x)</tt>. However, such operations are in general |
99 |
|
|
100 |
|
/** |
101 |
|
* @throws IllegalStateException if this queue is full |
102 |
< |
* @throws NullPointerException if <tt>x<tt> is <tt>null</tt>. |
102 |
> |
* @throws NullPointerException if <tt>o<tt> is <tt>null</tt>. |
103 |
|
*/ |
104 |
< |
boolean add(E x); |
104 |
> |
boolean add(E o); |
105 |
|
|
106 |
|
/** |
107 |
|
* @throws IllegalStateException if this queue is full |
108 |
< |
* @throws NullPointerException if <tt>x<tt> is <tt>null</tt>. |
108 |
> |
* @throws NullPointerException if any element of <tt>c<tt> |
109 |
> |
* is <tt>null</tt>. |
110 |
|
*/ |
111 |
|
boolean addAll(Collection<? extends E> c); |
112 |
|
|
113 |
|
/** |
114 |
< |
* @throws NullPointerException if <tt>x<tt> is <tt>null</tt>. |
114 |
> |
* @throws NullPointerException if <tt>o<tt> is <tt>null</tt>. |
115 |
|
*/ |
116 |
< |
public boolean offer(E x); |
116 |
> |
public boolean offer(E o); |
117 |
|
|
118 |
|
/** |
119 |
|
* Add the specified element to this queue, waiting if necessary up to the |
120 |
|
* specified wait time for space to become available. |
121 |
< |
* @param x the element to add |
121 |
> |
* @param o the element to add |
122 |
|
* @param timeout how long to wait before giving up, in units of |
123 |
|
* <tt>unit</tt> |
124 |
|
* @param unit a <tt>TimeUnit</tt> determining how to interpret the |
126 |
|
* @return <tt>true</tt> if successful, or <tt>false</tt> if |
127 |
|
* the specified waiting time elapses before space is available. |
128 |
|
* @throws InterruptedException if interrupted while waiting. |
129 |
< |
* @throws NullPointerException if <tt>x</tt> is <tt>null</tt>. |
129 |
> |
* @throws NullPointerException if <tt>o</tt> is <tt>null</tt>. |
130 |
|
*/ |
131 |
< |
boolean offer(E x, long timeout, TimeUnit unit) |
131 |
> |
boolean offer(E o, long timeout, TimeUnit unit) |
132 |
|
throws InterruptedException; |
133 |
|
|
134 |
|
/** |
158 |
|
/** |
159 |
|
* Add the specified element to this queue, waiting if necessary for |
160 |
|
* space to become available. |
161 |
< |
* @param x the element to add |
161 |
> |
* @param o the element to add |
162 |
|
* @throws InterruptedException if interrupted while waiting. |
163 |
< |
* @throws NullPointerException if <tt>x</tt> is <tt>null</tt>. |
163 |
> |
* @throws NullPointerException if <tt>o</tt> is <tt>null</tt>. |
164 |
|
*/ |
165 |
< |
void put(E x) throws InterruptedException; |
165 |
> |
void put(E o) throws InterruptedException; |
166 |
|
|
167 |
|
|
168 |
|
/** |