10 |
|
import java.util.Queue; |
11 |
|
|
12 |
|
/** |
13 |
< |
* A {@link java.util.Queue} that additionally supports operations |
14 |
< |
* that wait for the queue to become non-empty when retrieving an |
15 |
< |
* element, and wait for space to become available in the queue when |
16 |
< |
* storing an element. |
13 |
> |
* A {@link Queue} that additionally supports operations that wait for |
14 |
> |
* the queue to become non-empty when retrieving an element, and wait |
15 |
> |
* for space to become available in the queue when storing an element. |
16 |
|
* |
17 |
|
* <p>{@code BlockingQueue} methods come in four forms, with different ways |
18 |
|
* of handling operations that cannot be satisfied immediately, but may be |
34 |
|
* </tr> |
35 |
|
* <tr> |
36 |
|
* <td><b>Insert</b></td> |
37 |
< |
* <td>{@link #add add(e)}</td> |
38 |
< |
* <td>{@link #offer offer(e)}</td> |
39 |
< |
* <td>{@link #put put(e)}</td> |
37 |
> |
* <td>{@link #add(Object) add(e)}</td> |
38 |
> |
* <td>{@link #offer(Object) offer(e)}</td> |
39 |
> |
* <td>{@link #put(Object) put(e)}</td> |
40 |
|
* <td>{@link #offer(Object, long, TimeUnit) offer(e, time, unit)}</td> |
41 |
|
* </tr> |
42 |
|
* <tr> |
43 |
|
* <td><b>Remove</b></td> |
44 |
< |
* <td>{@link #remove remove()}</td> |
45 |
< |
* <td>{@link #poll poll()}</td> |
46 |
< |
* <td>{@link #take take()}</td> |
44 |
> |
* <td>{@link #remove() remove()}</td> |
45 |
> |
* <td>{@link #poll() poll()}</td> |
46 |
> |
* <td>{@link #take() take()}</td> |
47 |
|
* <td>{@link #poll(long, TimeUnit) poll(time, unit)}</td> |
48 |
|
* </tr> |
49 |
|
* <tr> |
50 |
|
* <td><b>Examine</b></td> |
51 |
< |
* <td>{@link #element element()}</td> |
52 |
< |
* <td>{@link #peek peek()}</td> |
51 |
> |
* <td>{@link #element() element()}</td> |
52 |
> |
* <td>{@link #peek() peek()}</td> |
53 |
|
* <td><em>not applicable</em></td> |
54 |
|
* <td><em>not applicable</em></td> |
55 |
|
* </tr> |
69 |
|
* |
70 |
|
* <p>{@code BlockingQueue} implementations are designed to be used |
71 |
|
* primarily for producer-consumer queues, but additionally support |
72 |
< |
* the {@link java.util.Collection} interface. So, for example, it is |
72 |
> |
* the {@link Collection} interface. So, for example, it is |
73 |
|
* possible to remove an arbitrary element from a queue using |
74 |
|
* {@code remove(x)}. However, such operations are in general |
75 |
|
* <em>not</em> performed very efficiently, and are intended for only |