Dict.CN 在线词典, 英语学习, 在线翻译 ------------- MyGitee My腾云code

Happy_EveryDay

可以平凡 不可以平庸 无爱则无忧,无欲则无求,无怒而无敌,无怨才是佛。所有烦恼,都是放不下的执著 开源技群 328035181 MyGitee

ThreadPools .awardPoolAdd 启新线程

public class ThreadPools {
    private static Logger log = LoggerFactory.getLogger(ThreadPools.class);
    private static ThreadPoolExecutor awardPool = null;
    
    public static void awardPoolAdd(Runnable runnable){
        if(awardPool == null) awardPool = new ThreadPoolExecutor(8, 10, 30, TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>(), new ThreadPoolExecutor.AbortPolicy());
        awardPool.execute(runnable);
    }
    
    public static void main(String[] args) throws InterruptedException {

        ThreadPools.awardPoolAdd(new commonThread( "所有批次验证完成,处理用户信息",null){
            @Override
            public  void run(){
                try {
                    UserService   userServiceTemp=
                            (UserService  ) ContextUtils.getContext().getBean( "userServiceImpl");
                    userServiceTemp.updateUseInfo(userId);
                }catch (Exception e){
                    log.error("",e);
                }
            }
        });


}

 

ThreadPoolExecutor重要参数

https://www.cnblogs.com/caicz/p/10930461.html

 

posted on 2025-04-27 09:52  cn2025  阅读(12)  评论(0)    收藏  举报

导航