-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.java
More file actions
42 lines (37 loc) · 834 Bytes
/
Copy pathUtils.java
File metadata and controls
42 lines (37 loc) · 834 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* Copyright (c) 2020 Copyright bp All Rights Reserved.
* Author: pengxiang.li
* Desc:
*/
package cn.brainpoint.febs;
/**
* @author pengxiang.li
*/
public class Utils {
static {
Febs.init();
}
public Utils() {
}
/**
* Sleep in promise way. <i>e.g.</i> <code>
* febs.Utils.sleep(1000).then(()->{
* // Will call in 1000ms.
* });
* </code>
*
* @param millisecond sleep time.
* @return Promise object
*/
public Promise<Void> sleep(long millisecond) {
return new Promise<>((resolve, reject) -> {
try {
Thread.sleep(millisecond);
} catch (Exception e) {
reject.execute(e);
return;
}
resolve.execute(null);
});
}
}