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