首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

ScheduledExecutorService和ScheduledThreadPoolExecutor的有关问题

2012-04-30 
ScheduledExecutorService和ScheduledThreadPoolExecutor的问题ScheduledExecutorService schedule Exec

ScheduledExecutorService和ScheduledThreadPoolExecutor的问题
ScheduledExecutorService schedule = Executors.newScheduledThreadPool(int corePoolSize);
请问,schedule创建完毕后,线程池的数量可以改变吗?
我现在想改变,想让线程数目随着ScheduledExecutorService里面添加Runnable任务的多少的变化而变化。
请问怎么弄?

如果直接用ScheduledThreadPoolExecutor schedulePool = new ScheduledThreadPoolExecutor(int corePoolSize,ThreadFactory factory);
那么,schedulePool里面线程的数量可以改变吗?
请问想改变的话怎么改变?


[解决办法]
http://dongxuan.iteye.com/blog/901689

http://dongxuan.iteye.com/blog/902571
[解决办法]
setCorePoolSize()

另外有两篇文章不错:
http://dongxuan.iteye.com/blog/901689

http://dongxuan.iteye.com/blog/902571

热点排行