We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2cd9ac8 commit f3f6632Copy full SHA for f3f6632
1 file changed
03concurrency/0301/src/main/java/java0/conc0302/threadpool/ExceptionDemo.java
@@ -11,22 +11,20 @@ public static void main(String[] args) {
11
12
try {
13
Future<Double> future = executorService.submit(() -> {
14
- int a = 1;
15
- return 10.0/(a-1);
+ throw new RuntimeException("executorService.submit()");
16
});
17
18
double b = future.get();
19
System.out.println(b);
20
21
} catch (Exception ex) {
22
- System.out.println("catch execute");
+ System.out.println("catch submit");
23
ex.printStackTrace();
24
}
25
26
27
executorService.execute(() -> {
28
29
- float b = 10/(a-1);
+ throw new RuntimeException("executorService.execute()");
30
31
32
System.out.println("catch execute");
0 commit comments