G2ThreadPoolFactory.java
725 字节
package com.sy.utils;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class G2ThreadPoolFactory {
private static ThreadPoolExecutor threadPool;
public static ThreadPoolExecutor instance(String busstype){
if (threadPool==null){
XMLThreadFactory xmlThreadFactory = new XMLThreadFactory(busstype);
threadPool = new ThreadPoolExecutor(10, 200,
1L, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(4000),
xmlThreadFactory,
new ThreadPoolExecutor.AbortPolicy());
}
return threadPool;
}
}