We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1bc3eed commit 8514df2Copy full SHA for 8514df2
1 file changed
src/com/java8/concurrency/examples/ExecutorServiceDemo.java
@@ -0,0 +1,24 @@
1
+package com.java8.concurrency.examples;
2
+
3
+import java.util.concurrent.ExecutorService;
4
+import java.util.concurrent.Executors;
5
+import java.util.concurrent.TimeUnit;
6
7
+public class ExecutorServiceDemo {
8
9
+ public static void main(String[] args) {
10
11
+ try {
12
+ ExecutorService service = Executors.newSingleThreadExecutor();
13
+ service.submit(() -> {
14
+ String name = Thread.currentThread().getName();
15
+ System.out.println("Hello - " + name);
16
+ });
17
+ service.shutdown();
18
+ service.awaitTermination(5, TimeUnit.SECONDS);
19
+ } catch (InterruptedException e) {
20
+ e.printStackTrace();
21
+ }
22
23
24
+}
0 commit comments