111 |
|
public Object call(){ |
112 |
|
try{ |
113 |
|
Thread.sleep(MEDIUM_DELAY_MS); |
114 |
< |
}catch(InterruptedException e){ |
114 |
> |
} catch(InterruptedException e){ |
115 |
|
fail("unexpected exception"); |
116 |
|
} |
117 |
|
return Boolean.TRUE; |
121 |
|
public void run(){ |
122 |
|
try{ |
123 |
|
ft.get(); |
124 |
< |
}catch(Exception e){ |
124 |
> |
} catch(Exception e){ |
125 |
|
fail("unexpected exception"); |
126 |
|
} |
127 |
|
} |
146 |
|
public Object call(){ |
147 |
|
try{ |
148 |
|
Thread.sleep(MEDIUM_DELAY_MS); |
149 |
< |
}catch(InterruptedException e){ |
149 |
> |
} catch(InterruptedException e){ |
150 |
|
fail("unexpected exception"); |
151 |
|
} |
152 |
|
return Boolean.TRUE; |
182 |
|
public Object call(){ |
183 |
|
try{ |
184 |
|
Thread.sleep(MEDIUM_DELAY_MS); |
185 |
< |
}catch(InterruptedException e){ |
185 |
> |
} catch(InterruptedException e){ |
186 |
|
fail("unexpected exception"); |
187 |
|
} |
188 |
|
return Boolean.TRUE; |
195 |
|
try{ |
196 |
|
ft.get(); |
197 |
|
fail("should throw"); |
198 |
< |
}catch(CancellationException success){ |
198 |
> |
} catch(CancellationException success){ |
199 |
|
} |
200 |
|
catch(Exception e){ |
201 |
|
fail("unexpected exception"); |
205 |
|
t.start(); |
206 |
|
ft.cancel(true); |
207 |
|
t.join(); |
208 |
< |
}catch(InterruptedException sucess){ |
208 |
> |
} catch(InterruptedException success){ |
209 |
|
fail("unexpected exception"); |
210 |
|
} |
211 |
|
} |
228 |
|
try{ |
229 |
|
ft.get(3 * SHORT_DELAY_MS, TimeUnit.MILLISECONDS); |
230 |
|
fail("should throw"); |
231 |
< |
}catch(CancellationException success) {} |
231 |
> |
} catch(CancellationException success) {} |
232 |
|
catch(Exception e){ |
233 |
|
fail("unexpected exception"); |
234 |
|
} |
239 |
|
ft.cancel(true); |
240 |
|
Thread.sleep(SHORT_DELAY_MS); |
241 |
|
t.join(); |
242 |
< |
}catch(InterruptedException ie){ |
242 |
> |
} catch(InterruptedException ie){ |
243 |
|
fail("unexpected exception"); |
244 |
|
} |
245 |
|
} |
255 |
|
ft.run(); |
256 |
|
ft.get(); |
257 |
|
fail("should throw"); |
258 |
< |
}catch(ExecutionException success){ |
258 |
> |
} catch(ExecutionException success){ |
259 |
|
} |
260 |
|
catch(Exception e){ |
261 |
|
fail("unexpected exception"); |
273 |
|
ft.run(); |
274 |
|
ft.get(SHORT_DELAY_MS, TimeUnit.MILLISECONDS); |
275 |
|
fail("should throw"); |
276 |
< |
}catch(ExecutionException success) { |
277 |
< |
}catch(TimeoutException success) { } // unlikely but OK |
276 |
> |
} catch(ExecutionException success) { |
277 |
> |
} catch(TimeoutException success) { } // unlikely but OK |
278 |
|
catch(Exception e){ |
279 |
|
fail("unexpected exception"); |
280 |
|
} |
319 |
|
try{ |
320 |
|
ft.get(100,TimeUnit.SECONDS); |
321 |
|
fail("should throw"); |
322 |
< |
}catch(InterruptedException success){} |
322 |
> |
} catch(InterruptedException success){} |
323 |
|
catch(Exception e){ |
324 |
|
fail("unexpected exception"); |
325 |
|
} |
344 |
|
try{ |
345 |
|
ft.get(1,TimeUnit.MILLISECONDS); |
346 |
|
fail("should throw"); |
347 |
< |
}catch(TimeoutException success){} |
348 |
< |
catch(Exception sucess){ |
347 |
> |
} catch(TimeoutException success){} |
348 |
> |
catch(Exception success){ |
349 |
|
fail("unexpected exception"); |
350 |
|
} |
351 |
|
|