2015-04-20 15:36:01 -07:00
|
|
|
//: concurrency/NaiveExceptionHandling.java
|
2015-05-07 17:25:05 -07:00
|
|
|
// {RunByHand}
|
2015-04-20 15:36:01 -07:00
|
|
|
// {ThrowsException}
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
|
|
|
public class NaiveExceptionHandling {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
try {
|
|
|
|
ExecutorService exec =
|
|
|
|
Executors.newCachedThreadPool();
|
|
|
|
exec.execute(new ExceptionThread());
|
|
|
|
} catch(RuntimeException ue) {
|
|
|
|
// This statement will NOT execute!
|
2015-04-29 12:53:35 -07:00
|
|
|
System.out.println("Exception was handled!");
|
2015-04-20 15:36:01 -07:00
|
|
|
}
|
|
|
|
}
|
2015-05-05 11:20:13 -07:00
|
|
|
} ///:~
|