有没有哪位大神知道类似彩票项目每隔10分钟一开奖,这个是怎么控制的
有多种方法,这里用线程
package hhh;
public class Task {
public static void main(String[] args) {
final long timeInterval = 1000*60*10;//间隔10分钟执行
Runnable runnable = new Runnable() {
public void run() {
while (true) {
System.out.println("这是你要执行内容的部分");
try {
Thread.sleep(timeInterval);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
Thread thread = new Thread(runnable);
thread.start();
}
}
用线程,让他睡10分钟
线程制作工艺流程原料
定时器,百度一下,js就可以写
js定时器或者spring定时器
用线程去实现 就可以了
Timer计时器,就行了
定时器 Timer 或者 spring 的 schedule 都可以配置这些