线程执行方法(做一些项目启动后 一直要执行的操作,比如根据时间自动更改订单状态,比如订单签收30天自动收货功能,比如根据时间来更改状态)
| 4 | * 线程执行方法(做一些项目启动后 一直要执行的操作,比如根据时间自动更改订单状态,比如订单签收30天自动收货功能,比如根据时间来更改状态) |
| 5 | */ |
| 6 | public class MyThreadMethod extends Thread { |
| 7 | public void run() { |
| 8 | while (!this.isInterrupted()) {// 线程未中断执行循环 |
| 9 | try { |
| 10 | Thread.sleep(5000); //每隔2000ms执行一次 |
| 11 | } catch (InterruptedException e) { |
| 12 | e.printStackTrace(); |
| 13 | } |
| 14 | |
| 15 | // ------------------ 开始执行 --------------------------- |
| 16 | // System.out.println("线程执行中:" + System.currentTimeMillis()); |
| 17 | } |
| 18 | } |
| 19 | } |
nothing calls this directly
no outgoing calls
no test coverage detected