OnJava8-Examples/concurrency/NaiveExceptionHandling.java

18 lines
461 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// concurrency/NaiveExceptionHandling.java
2015-06-15 17:47:35 -07:00
// {ValidateByHand}
// {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!
System.out.println("Exception was handled!");
}
}
2015-09-07 11:44:36 -06:00
}