qiurunze123 / threadandjuc Goto Github PK
View Code? Open in Web Editor NEW⭐⭐⭐⭐高并发-高可靠-高性能three-high-import导入系统-高并发多线程进阶
⭐⭐⭐⭐高并发-高可靠-高性能three-high-import导入系统-高并发多线程进阶
这块 还有第三种时间方式 是实现Callable接口 重写call函数 跟实现Runable不同的是call函数有返回值
内容的链接打开错误
感谢技术大佬的分享
线程池的核心讲解
核心参数
corePoolsize : 线程中允许的核心线程数
maximumPoolsize : 该线程所允许的最大线程数
keepAliveTime : 空余线程的存活时间并不会对所有的线程起作用 如果线程数大于corePoolsize 那么这些线程就不会因为被空闲太久而关闭 除非你调用 allowcorethreadtimeout 方法 这个方法可以使核心线程数也被回收
这个大于用错了 应该是小于
我按照教程创了三张表,改了sharding-databases里的数据库url
无论是运行 测试里的 createMillionData() 和importall 方法 都报这个错误
java.lang.IllegalStateException: Missing the data source name: 'null'
@Override
public List<Point> recordHandlePoints(List<ImportDataStep> steps) {
System.out.println("多线程查询======== start");
List<Point> points = new ArrayList<>();
for (ImportDataStep step : steps) {
Future<List<Point>> future = executorService.submit(new HighImportDataPointFuture(step, pointLogic));
try {
points.addAll(future.get());
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
System.out.println("多线程查询======== point " + points.size() + " 条数==============");
return points;
}
位于 HighImportDataServiceImpl 实现错误了吧,future.get()会阻塞线程 所以实际上是串行提交,没有线程并行
future.get()应该在任务提交之外的循环遍历获取吧
threadpool0001.md
RUNNING = 1
<< COUNT_BITS;
应该改为-1吧
希望更新下图片,无法显示。
能否修复下,图床连接404 not found
线程池地方,很多内容链接,指向同一个源文件,为什么不合并呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.