审查视图

src/main/java/com/sy/utils/XMLThreadPoolFactory.java 726 字节
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
package com.sy.utils;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class XMLThreadPoolFactory {

    private  static ThreadPoolExecutor threadPool;

    public static ThreadPoolExecutor instance(String busstype){
        if (threadPool==null){
            XMLThreadFactory xmlThreadFactory = new XMLThreadFactory(busstype);
            threadPool = new ThreadPoolExecutor(50, 200,
                    1L, TimeUnit.SECONDS,
                    new LinkedBlockingQueue<Runnable>(4000),
                    xmlThreadFactory,
                    new ThreadPoolExecutor.AbortPolicy());

        }
        return threadPool;
    }
}