![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
多线程
asphalt_road
如果你看上去太费力气,说明你还不够努力!
展开
-
Callable与Future
Callable与Future 使用线程池来创建并行的任务: 这个一个简单的demo,可以在最后统一获取执行结果;以此类推ExecutorService threadPool = Executors.newFixedThreadPool(2); Future<Integer> future = threadPool.submit(new Callable<Integer>() {原创 2016-12-30 17:03:35 · 329 阅读 · 0 评论 -
使用Future接口进行多线程报表查询
报表查询中,可能涉及过多业务,在sql优化以后,仍然存在查询过慢,导致串行查询不适用情况,引入Future接口进行多线程查询,实现快速生成报表;//利用多线程查询数据 ThreadPoolExecutor threadPool = ImportDataThreadPoolUtil.getInstance(); //期初数 Rep原创 2017-02-10 17:19:12 · 736 阅读 · 0 评论 -
AtomicInteger线程安全的实现机制
java在concurrent包下提供了线程安全的int包装类,AtomicInteger,接下来我们就讲讲AtomicInteger的实现原理:public class AtomicInteger extends Number implements java.io.Serializable { private volatile int value;AtomicInteger 类中的valu原创 2017-03-24 22:28:25 · 3065 阅读 · 0 评论