废话少说,上代码
package com.sinosoft;import java.util.concurrent.*;/** * Created by xushuyi on 2017/4/9. */public class ThreadPoolQueue { /** * 定义线程池中最大的线程数量 */ private static final Integer THREADPOOLSIZE = 100; /** * 创建线程队列 */ private static final BlockingQueue
真正项目中,就不会再使用static来初始化任务,而是定义一个方法,比如:public void runnbaleInit(),那么在配置文件中需要将本方法注入到Bean中
例如: