import java.util.Timer;
import java.util.TimerTask;
public class VarTimer {
private Timer timer;
private int iFreq;
private boolean bRuning;
public VarTimer() {
timer = null;
bRuning = false;
iFreq = 10;
}
public void start(){
if(!bRuning){
timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
bRuning = false;
timer.cancel();
}
} , iFreq * 60 * 1000);
bRuning = true;
}
}
public boolean getCanSendDo(){
return !bRuning;
}
}
文章来源于领测软件测试网 https://www.ltesting.net/