Create Sleep.java
设置休眠
This commit is contained in:
parent
f0dc55aad6
commit
ddef2a1051
30
src/main/java/org/wltea/analyzer/help/Sleep.java
Normal file
30
src/main/java/org/wltea/analyzer/help/Sleep.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package org.wltea.analyzer.help;
|
||||||
|
|
||||||
|
public class Sleep {
|
||||||
|
public enum Type{MSEC,SEC,MIN,HOUR};
|
||||||
|
public static void sleep(Type type,int num){
|
||||||
|
try {
|
||||||
|
switch(type){
|
||||||
|
case MSEC:
|
||||||
|
Thread.sleep(num);
|
||||||
|
return;
|
||||||
|
case SEC:
|
||||||
|
Thread.sleep(num*1000);
|
||||||
|
return;
|
||||||
|
case MIN:
|
||||||
|
Thread.sleep(num*60*1000);
|
||||||
|
return;
|
||||||
|
case HOUR:
|
||||||
|
Thread.sleep(num*60*60*1000);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
System.err.println("输入类型错误,应为MSEC,SEC,MIN,HOUR之一");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user