#scheduleAtFixedRate

今天研究rocketmq的时候,发现ScheduledExecutorService这个类scheduleAtFixedRate方法可以让main方法一直运行

代码如下:packagecom.yuanqiao;importorg.apache.rocketmq.client.impl.factory.MQClientInstance;importjava.util.concurrent.Executors;importjava.util.concurrent.Schedule...

java定时器schedule和scheduleAtFixedRate区别

packagecn.lonecloud.test;importjava.util.Date;importjava.util.Timer;importjava.util.TimerTask;/****@Title:Test02.java*@Packagecn.lonecloud.test*@Description:*@a...

Timer TimerTask schedule scheduleAtFixedRate

 jdk自带的timer框架是有缺陷的,其功能简单,而且有时候它的api不好理解。importjava.util.Date;importjava.util.Timer;importjava.util.TimerTask;publicclassTestTimer{privatestaticfinalintdel...