forked from PacktPublishing/Java-Coding-Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
26 lines (17 loc) · 777 Bytes
/
Main.java
File metadata and controls
26 lines (17 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package modern.challenge;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
public class Main {
public static void main(String[] args) throws InterruptedException {
System.setProperty("java.util.logging.SimpleFormatter.format",
"[%1$tT] [%4$-7s] %5$s %n");
AssemblyLine.startAssemblyLine(new ConcurrentLinkedQueue<>());
Thread.sleep(10 * 1000);
Queue<String> remainingTasks = AssemblyLine.stopAssemblyLine();
Thread.sleep(2000);
System.out.println("\nStarting assembly line again ...");
AssemblyLine.startAssemblyLine(new ConcurrentLinkedQueue<>(remainingTasks));
Thread.sleep(60 * 100);
AssemblyLine.stopAssemblyLine();
}
}