13 |
|
import java.math.BigInteger; |
14 |
|
import java.security.*; |
15 |
|
|
16 |
< |
public class AbstractExecutorServiceTest extends JSR166TestCase{ |
16 |
> |
public class AbstractExecutorServiceTest extends JSR166TestCase { |
17 |
|
public static void main(String[] args) { |
18 |
|
junit.textui.TestRunner.run (suite()); |
19 |
|
} |
265 |
|
ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1)); |
266 |
|
try { |
267 |
|
|
268 |
< |
for (int i = 0; i < 5; ++i){ |
268 |
> |
for (int i = 0; i < 5; ++i) { |
269 |
|
p.submit(new MediumRunnable()); |
270 |
|
} |
271 |
|
shouldThrow(); |
272 |
< |
} catch (RejectedExecutionException success){} |
272 |
> |
} catch (RejectedExecutionException success) {} |
273 |
|
joinPool(p); |
274 |
|
} |
275 |
|
|
284 |
|
p.submit(new SmallCallable()); |
285 |
|
} |
286 |
|
shouldThrow(); |
287 |
< |
} catch (RejectedExecutionException e){} |
287 |
> |
} catch (RejectedExecutionException e) {} |
288 |
|
joinPool(p); |
289 |
|
} |
290 |
|
|
303 |
|
try { |
304 |
|
Thread.sleep(MEDIUM_DELAY_MS); |
305 |
|
shouldThrow(); |
306 |
< |
} catch (InterruptedException e){ |
306 |
> |
} catch (InterruptedException e) { |
307 |
|
} |
308 |
|
return null; |
309 |
|
} |
310 |
|
}).get(); |
311 |
< |
} catch (InterruptedException success){ |
311 |
> |
} catch (InterruptedException success) { |
312 |
|
} catch (Exception e) { |
313 |
|
unexpectedException(); |
314 |
|
} |
319 |
|
t.start(); |
320 |
|
Thread.sleep(SHORT_DELAY_MS); |
321 |
|
t.interrupt(); |
322 |
< |
} catch (Exception e){ |
322 |
> |
} catch (Exception e) { |
323 |
|
unexpectedException(); |
324 |
|
} |
325 |
|
joinPool(p); |
337 |
|
try { |
338 |
|
p.submit(new SmallCallable()).get(); |
339 |
|
shouldThrow(); |
340 |
< |
} catch (InterruptedException e){} |
341 |
< |
catch (RejectedExecutionException e2){} |
342 |
< |
catch (ExecutionException e3){} |
340 |
> |
} catch (InterruptedException e) {} |
341 |
> |
catch (RejectedExecutionException e2) {} |
342 |
> |
catch (ExecutionException e3) {} |
343 |
|
return Boolean.TRUE; |
344 |
|
} |
345 |
|
}; |
350 |
|
public void run() { |
351 |
|
try { |
352 |
|
c.call(); |
353 |
< |
} catch (Exception e){} |
353 |
> |
} catch (Exception e) {} |
354 |
|
} |
355 |
|
}); |
356 |
|
try { |
358 |
|
Thread.sleep(SHORT_DELAY_MS); |
359 |
|
t.interrupt(); |
360 |
|
t.join(); |
361 |
< |
} catch (InterruptedException e){ |
361 |
> |
} catch (InterruptedException e) { |
362 |
|
unexpectedException(); |
363 |
|
} |
364 |
|
|
380 |
|
} |
381 |
|
}; |
382 |
|
|
383 |
< |
for (int i =0; i < 5; i++){ |
383 |
> |
for (int i =0; i < 5; i++) { |
384 |
|
p.submit(c).get(); |
385 |
|
} |
386 |
|
|
387 |
|
shouldThrow(); |
388 |
|
} |
389 |
< |
catch (ExecutionException success){ |
389 |
> |
catch (ExecutionException success) { |
390 |
|
} catch (Exception e) { |
391 |
|
unexpectedException(); |
392 |
|
} |