SysHelper.java
601 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
package com.sitech.util;
import java.io.Serializable;
public class SysHelper implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 冻结线程
*/
public static void waitIt(Object o, long time) {
synchronized (o) {
try {
if (time == -1)
o.wait(5000L);
else
o.wait(time);
} catch (InterruptedException iex) {
iex.printStackTrace();
}
}
}
public static void waitIt(Object o) {
waitIt(o, -1);
}
/**
* 唤醒线程
*/
public static void notifyIt(Object o) {
synchronized (o) {
o.notify();
}
}
}