码迷,mamicode.com
首页 > 其他好文 > 详细

ScheduledThreadPoolExecutor

时间:2015-06-26 23:57:26      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:scheduledthreadpoolexecutor

String time = new SimpleDateFormat("HH:mm:ss").format(new Date());

System.out.println("Start time : " + time);


ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(

5); // 创建5个执行线程


Runnable runnable = new Runnable() {


@Override

public void run() {

// TODO Auto-generated method stub

String time = new SimpleDateFormat("HH:mm:ss")

.format(new Date());

System.out.println("Now Time : " + time);

}

};


executor.scheduleWithFixedDelay(runnable, 2, 3, TimeUnit.SECONDS);


ScheduledThreadPoolExecutor

标签:scheduledthreadpoolexecutor

原文地址:http://1129254.blog.51cto.com/1119254/1666037

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!