java定时执行任务
ScheduledExecutorService ses = Executors.newScheduledThreadPool(1); Runnable command = new Runnable(){ public void run(){ System.out.println("start ping ..."+new Date().toLocaleString()); }; }; ses.scheduleAtFixedRate(command, 1, 2, TimeUnit.SECONDS);