-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLiftOff.java
More file actions
49 lines (41 loc) · 1.07 KB
/
LiftOff.java
File metadata and controls
49 lines (41 loc) · 1.07 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* <html>
* <body>
* <P> Copyright 1994 JsonInternational</p>
* <p> All rights reserved. - https://github.com/Jasonandy/Java-Core-Advanced </p>
* <p> Created by Jason</p>
* </body>
* </html>
*/
package cn.ucaner.core.concurrent;
/**
* @Package:cn.ucaner.core.concurrent
* @ClassName:LiftOff
* @Description: <p> LiftOff 启动起飞</p>
* @Author: - wubin
* @CreatTime:2018年5月16日 下午6:05:59
* @Modify By:
* @ModifyTime: 2018年5月16日
* @Modify marker:
* @version V1.0
*/
public class LiftOff implements Runnable {
protected int countDown = 10;
private static int taskCount = 0;
private final int id = taskCount++;
public LiftOff() {
}
public LiftOff(int countDown) {
this.countDown = countDown;
}
public String status() {
return "#" + id + "(" + (countDown > 0 ? countDown : "LiftOff!") + "), ";
}
@Override
public void run() {
while (countDown-- > 0) {
System.out.print(status());
Thread.yield();
}
}
}