摘要: 一:在run()方法里写插入 1 package com.smartdata.pms.thread; 2 3 import com.smartdata.pms.entity.PmsProduct; 4 import com.smartdata.pms.mapper.PmsProductMapper; 阅读全文
posted @ 2020-03-22 17:54 陆伟 阅读(1654) 评论(1) 推荐(1) 编辑
摘要: 一:推荐使用 ThreadPoolExecutor 构造函数创建线程池 在《阿里巴巴 Java 开发手册》“并发处理”这一章节,明确指出线程资源必须通过线程池提供,不允许在应用中自行显示创建线程。 为什么呢? 使用线程池的好处是减少在创建和销毁线程上所消耗的时间以及系统资源开销,解决资源不足的问题。 阅读全文
posted @ 2020-03-22 09:27 陆伟 阅读(174) 评论(0) 推荐(0) 编辑