214 |
|
return capacity - count.get(); |
215 |
|
} |
216 |
|
|
217 |
+ |
/** |
218 |
+ |
* Adds the specified element to the tail of this queue, waiting if |
219 |
+ |
* necessary for space to become available. |
220 |
+ |
* @throws NullPointerException if the specified element is <tt>null</tt>. |
221 |
+ |
*/ |
222 |
|
public void put(E o) throws InterruptedException { |
223 |
|
if (o == null) throw new NullPointerException(); |
224 |
|
// Note: convention in all put/take/etc is to preset |
253 |
|
signalNotEmpty(); |
254 |
|
} |
255 |
|
|
256 |
+ |
/** |
257 |
+ |
* Inserts the specified element at the tail of this queue, waiting if |
258 |
+ |
* necessary up to the specified wait time for space to become available. |
259 |
+ |
* @throws NullPointerException if the specified element is <tt>null</tt>. |
260 |
+ |
*/ |
261 |
|
public boolean offer(E o, long timeout, TimeUnit unit) |
262 |
|
throws InterruptedException { |
263 |
|
|
292 |
|
} |
293 |
|
|
294 |
|
/** |
295 |
< |
* Adds the specified element to the tail of this queue if possible, |
295 |
> |
* Inserts the specified element at the tail of this queue if possible, |
296 |
|
* returning immediately if this queue is full. |
297 |
|
* |
288 |
– |
* @param o the element to add. |
289 |
– |
* @return <tt>true</tt> if it was possible to add the element to |
290 |
– |
* this queue, else <tt>false</tt> |
298 |
|
* @throws NullPointerException if the specified element is <tt>null</tt> |
299 |
|
*/ |
300 |
|
public boolean offer(E o) { |