31 |
|
threadAssertEquals(v, two); |
32 |
|
Object w = e.exchange(v); |
33 |
|
threadAssertEquals(w, one); |
34 |
< |
} catch(InterruptedException e){ |
34 |
> |
} catch (InterruptedException e){ |
35 |
|
threadUnexpectedException(); |
36 |
|
} |
37 |
|
} |
43 |
|
threadAssertEquals(v, one); |
44 |
|
Object w = e.exchange(v); |
45 |
|
threadAssertEquals(w, two); |
46 |
< |
} catch(InterruptedException e){ |
46 |
> |
} catch (InterruptedException e){ |
47 |
|
threadUnexpectedException(); |
48 |
|
} |
49 |
|
} |
53 |
|
t2.start(); |
54 |
|
t1.join(); |
55 |
|
t2.join(); |
56 |
< |
} catch(InterruptedException ex) { |
56 |
> |
} catch (InterruptedException ex) { |
57 |
|
unexpectedException(); |
58 |
|
} |
59 |
|
} |
70 |
|
threadAssertEquals(v, two); |
71 |
|
Object w = e.exchange(v, SHORT_DELAY_MS, TimeUnit.MILLISECONDS); |
72 |
|
threadAssertEquals(w, one); |
73 |
< |
} catch(InterruptedException e){ |
73 |
> |
} catch (InterruptedException e){ |
74 |
|
threadUnexpectedException(); |
75 |
< |
} catch(TimeoutException toe) { |
75 |
> |
} catch (TimeoutException toe) { |
76 |
|
threadUnexpectedException(); |
77 |
|
} |
78 |
|
} |
84 |
|
threadAssertEquals(v, one); |
85 |
|
Object w = e.exchange(v, SHORT_DELAY_MS, TimeUnit.MILLISECONDS); |
86 |
|
threadAssertEquals(w, two); |
87 |
< |
} catch(InterruptedException e){ |
87 |
> |
} catch (InterruptedException e){ |
88 |
|
threadUnexpectedException(); |
89 |
< |
} catch(TimeoutException toe) { |
89 |
> |
} catch (TimeoutException toe) { |
90 |
|
threadUnexpectedException(); |
91 |
|
} |
92 |
|
} |
96 |
|
t2.start(); |
97 |
|
t1.join(); |
98 |
|
t2.join(); |
99 |
< |
} catch(InterruptedException ex) { |
99 |
> |
} catch (InterruptedException ex) { |
100 |
|
unexpectedException(); |
101 |
|
} |
102 |
|
} |
111 |
|
try { |
112 |
|
e.exchange(one); |
113 |
|
threadShouldThrow(); |
114 |
< |
} catch(InterruptedException success){ |
114 |
> |
} catch (InterruptedException success){ |
115 |
|
} |
116 |
|
} |
117 |
|
}); |
120 |
|
Thread.sleep(SHORT_DELAY_MS); |
121 |
|
t.interrupt(); |
122 |
|
t.join(); |
123 |
< |
} catch(InterruptedException ex) { |
123 |
> |
} catch (InterruptedException ex) { |
124 |
|
unexpectedException(); |
125 |
|
} |
126 |
|
} |
135 |
|
try { |
136 |
|
e.exchange(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); |
137 |
|
threadShouldThrow(); |
138 |
< |
} catch(InterruptedException success){ |
139 |
< |
} catch(Exception e2){ |
138 |
> |
} catch (InterruptedException success){ |
139 |
> |
} catch (Exception e2){ |
140 |
|
threadFail("should throw IE"); |
141 |
|
} |
142 |
|
} |
145 |
|
t.start(); |
146 |
|
t.interrupt(); |
147 |
|
t.join(); |
148 |
< |
} catch(InterruptedException ex){ |
148 |
> |
} catch (InterruptedException ex){ |
149 |
|
unexpectedException(); |
150 |
|
} |
151 |
|
} |
160 |
|
try { |
161 |
|
e.exchange(null, SHORT_DELAY_MS, TimeUnit.MILLISECONDS); |
162 |
|
threadShouldThrow(); |
163 |
< |
} catch(TimeoutException success){ |
164 |
< |
} catch(InterruptedException e2){ |
163 |
> |
} catch (TimeoutException success){ |
164 |
> |
} catch (InterruptedException e2){ |
165 |
|
threadFail("should throw TOE"); |
166 |
|
} |
167 |
|
} |
169 |
|
try { |
170 |
|
t.start(); |
171 |
|
t.join(); |
172 |
< |
} catch(InterruptedException ex){ |
172 |
> |
} catch (InterruptedException ex){ |
173 |
|
unexpectedException(); |
174 |
|
} |
175 |
|
} |
186 |
|
threadAssertEquals(v, two); |
187 |
|
Object w = e.exchange(v); |
188 |
|
threadShouldThrow(); |
189 |
< |
} catch(InterruptedException success){ |
189 |
> |
} catch (InterruptedException success){ |
190 |
|
} |
191 |
|
} |
192 |
|
}); |
198 |
|
Thread.sleep(SMALL_DELAY_MS); |
199 |
|
Object w = e.exchange(v); |
200 |
|
threadAssertEquals(w, three); |
201 |
< |
} catch(InterruptedException e){ |
201 |
> |
} catch (InterruptedException e){ |
202 |
|
threadUnexpectedException(); |
203 |
|
} |
204 |
|
} |
209 |
|
Thread.sleep(SMALL_DELAY_MS); |
210 |
|
Object w = e.exchange(three); |
211 |
|
threadAssertEquals(w, one); |
212 |
< |
} catch(InterruptedException e){ |
212 |
> |
} catch (InterruptedException e){ |
213 |
|
threadUnexpectedException(); |
214 |
|
} |
215 |
|
} |
224 |
|
t1.join(); |
225 |
|
t2.join(); |
226 |
|
t3.join(); |
227 |
< |
} catch(InterruptedException ex) { |
227 |
> |
} catch (InterruptedException ex) { |
228 |
|
unexpectedException(); |
229 |
|
} |
230 |
|
} |