Java--定时

 1 TimerTask task = new TimerTask() {
 2 
 3             @Override
 4             public void run() {
 5                 // TODO Auto-generated method stub
 6                 synchronized (lock) {
 7                     lock.notify();
 8                 }
 9             }
10         };
11         Timer timer = new Timer();
12         long delay = 0;
13         long intevalPeriod = 1000;
14         timer.schedule(task, delay, intevalPeriod);
原文地址:https://www.cnblogs.com/microcat/p/6365651.html