1 |
tim |
1.1 |
package java.util.concurrent; |
2 |
|
|
|
3 |
|
|
import java.util.*; |
4 |
|
|
|
5 |
|
|
/** |
6 |
|
|
* A Queue in which each put must wait for a take, and vice versa. |
7 |
|
|
* SynchronousQueues are similar to rendezvous channels used in CSP |
8 |
|
|
* and Ada. They are well suited for handoff designs, in which an |
9 |
|
|
* object running in one thread must synch up with an object running |
10 |
|
|
* in another thread in order to hand it some information, event, or |
11 |
|
|
* task. |
12 |
|
|
**/ |
13 |
|
|
public class SynchronousQueue<E> extends AbstractCollection<E> |
14 |
|
|
implements BlockingQueue<E>, java.io.Serializable { |
15 |
|
|
|
16 |
|
|
public SynchronousQueue() {} |
17 |
|
|
public void put(E x) throws InterruptedException { |
18 |
|
|
} |
19 |
|
|
public E take() throws InterruptedException { |
20 |
|
|
return null; |
21 |
|
|
} |
22 |
|
|
public boolean add(E x) { |
23 |
|
|
return false; |
24 |
|
|
} |
25 |
|
|
public boolean offer(E x) { |
26 |
|
|
return false; |
27 |
|
|
} |
28 |
|
|
public boolean remove(Object x) { |
29 |
|
|
return false; |
30 |
|
|
} |
31 |
|
|
public E remove() { |
32 |
|
|
return null; |
33 |
|
|
} |
34 |
|
|
public Iterator<E> iterator() { |
35 |
|
|
return null; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
public E element() { |
39 |
|
|
return null; |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
public E poll() { |
43 |
|
|
return null; |
44 |
|
|
} |
45 |
|
|
public boolean offer(E x, long timeout, TimeUnit granularity) throws InterruptedException { |
46 |
|
|
return false; |
47 |
|
|
} |
48 |
|
|
public E poll(long timeout, TimeUnit granularity) throws InterruptedException { |
49 |
|
|
return null; |
50 |
|
|
} |
51 |
|
|
public E peek() { |
52 |
|
|
return null; |
53 |
|
|
} |
54 |
|
|
public boolean isEmpty() { |
55 |
|
|
return false; |
56 |
|
|
} |
57 |
|
|
public int size() { |
58 |
|
|
return 0; |
59 |
|
|
} |
60 |
|
|
public Object[] toArray() { |
61 |
|
|
return null; |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
public <T> T[] toArray(T[] array) { |
65 |
|
|
return null; |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
|
69 |
|
|
} |