Java Asynchronous Programming in Practice cover

Java Asynchronous Programming in Practice

Rating 3.9
Word count
168 words
Chapters
9
Series
Java Core Technology Series
ISBN
9787111642992

Tags

Summary

Java Asynchronous Programming in Practice is a systematic technical monograph by Zhai Luxu (known as "Jiaduo"), a senior Java engineer at Taobao, published in the "Java Core Technology Series" of China Machine Press. The book has nine chapters, built around a single thread: how to write asynchronous code correctly in high-concurrency, high-throughput scenarios. It proceeds layer by layer, from the language level to the JDK, frameworks, and middleware. The first two chapters clarify the concept, value, and typical use cases of asynchronous programming, then explain the most basic explicit threads and thread pools and analyze the costs and limitations behind implementations such as ThreadPoolExecutor. Chapter 3 goes deep into the JDK Future system, covering the usage and internals of Future, FutureTask, and CompletableFuture, and how to build asynchronous pipelines with Java 8 Stream. Chapter 4 turns to Spring's asynchronous execution capabilities, explaining the TaskExecutor abstraction, the @Async annotation, and the proxy and thread-pool mechanisms behind it. Chapter 5 introduces reactive programming, covering the Reactive Streams specification and the asynchronous implementations of RxJava and Reactor. Chapters 6 and 7 discuss asynchronous non-blocking processing in Web Servlet 3.0/3.1 and Spring WebFlux introduced in Spring 5.0, including concurrency models, the two programming models, and internal implementation principles. Chapter 8 surveys asynchronous design ideas in frameworks and middleware such as Netty, Apache Dubbo, Disruptor, Akka, and Apache RocketMQ. Chapter 9 uses Go's goroutines and channels as a reference to explain differences in native asynchronous capabilities at the language level. The book includes companion sample code (open-sourced on GitHub) and emphasizes combining principles with runnable code. It suits Java developers who want to move from using asynchronous APIs to understanding the essence of asynchrony.

Editor's review

异步编程是Java后端工程师绕不过去的一道坎:会写@Async、会调CompletableFuture的人很多,能说清“为什么这样写、底层发生了什么、什么时候不该用”的人却不多。本书的价值正在于此——它不满足于罗列API,而是沿着一条清晰的技术演进线:线程与线程池 → JDK Future与CompletableFuture → Spring TaskExecutor与@Async → 反应式(RxJava/Reactor)→ Servlet异步与WebFlux → Netty/Dubbo/Disruptor/Akka/RocketMQ等工业级框架,最后借Go语言的goroutine作横向对照,帮助读者建立完整的异步知识地图。 作者长期在淘宝一线做Java研发,对高并发场景下的线程模型、IO阻塞与资源开销有真实体感,因此书中对“显式线程池的缺点”“阻塞IO如何拖垮线程”等问题的讨论颇为务实。每章配有可运行的示例代码,读者可以边读边跑,把原理落到手上。篇幅约270页,节奏紧凑,不冗长。 需要说明的是,本书成书于2019—2020年,部分框架已迭代多个版本(如Spring Boot、Reactor),阅读时宜结合官方最新文档对照,但其中的线程模型、背压、非阻塞IO等核心思想并不过时。对于想从“会用”跨到“懂原理”的Java开发者,这是一本性价比很高的进阶读物。

Who it's for

A good fit for

  • 有1—3年Java开发经验、希望系统掌握异步编程的后端工程师
  • 正在使用或准备使用Spring WebFlux、Reactor做响应式改造的开发者
  • 需要理解线程模型、非阻塞IO与背压等原理,以应对高并发场景的架构人员
  • 准备Java中高级技术面试、需要梳理并发与异步知识体系的求职者

Not a good fit for

  • 完全没有Java基础、尚未掌握多线程基本概念的入门读者
  • 只想找一本速查手册、不愿阅读源码与原理分析的读者
  • 主要做前端、数据分析等与Java后端无关工作的读者

Reading tips

  1. 按章节顺序通读第1—4章打好地基,第5—7章可根据项目需要(响应式/WebFlux)重点精读
  2. 务必clone配套GitHub示例代码(zhailuxu/async-program-demo),边读边运行并打断点观察线程行为
  3. 阅读Spring与Reactor相关章节时,对照当前项目所用版本的最新官方文档,注意API变更
  4. 每章读完后用自己的业务场景复写一个最小示例,例如把一个同步接口改造为异步处理

About the publisher

China Machine Press China · Founded in 1950

In addition to science and technology and professional publishing, the books in our catalog from China Machine Press also reflect a sustained focus on psychology, computing, management, finance and economics, and social sciences. In psychology, the catalog includes works by C. G. Jung and introductions to analytical psychology, as well as applied topics such as stress and health, and addiction and healing. In computing, it features Structure and Interpretation of Computer Programs (JavaScript Edition). Management and finance titles include Administrative Behavior (4th Edition), The Price of Inequality (Collector's Edition), and This Time Is Different: Eight Centuries of Financial Folly (Commemorative Edition). In the philosophy and history of science, there is The Worldview: The Third Edition. Relevant authors include C. G. Jung, William McGuire, Sonu Shamdasani, and Gabor Maté. Public information is limited; the above summarizes the publisher's profile based solely on the books in our catalog.

Contents

  1. Chapter 1 Understanding Asynchronous Programming
  2. Chapter 2 Asynchronous Programming with Explicit Threads and Thread Pools
  3. Chapter 3 Asynchronous Programming with JDK Futures
  4. Chapter 4 Asynchronous Execution in the Spring Framework
  5. Chapter 5 Asynchronous Programming with Reactive Programming
  6. Chapter 6 Asynchronous Non-Blocking Processing in Web Servlet
  7. Chapter 7 Asynchronous Non-Blocking Processing in Spring WebFlux
  8. Chapter 8 High-Performance Asynchronous Programming Frameworks and Middleware
  9. Chapter 9 Asynchronous Programming Capabilities of Go

FAQ

这本书适合Java初学者吗?
不太适合。书中大量涉及线程池、CompletableFuture、Reactor操作符与框架源码,默认读者已具备Java基础和基本多线程知识。建议先掌握《Java并发编程实战》或同等基础内容再读,收获会大得多。
书中的示例代码在哪里获取?
作者在GitHub上开源了配套示例仓库(zhailuxu/async-program-demo),书中也给出了地址;勘误可通过华章网站或作者公众号反馈。建议边读边跑,效果远好于只看文字。
书中内容是否已经过时?
本书出版于2020年前后,Spring、Reactor等框架此后有多个版本迭代,个别API写法可能变化。但线程模型、Future原理、背压、非阻塞IO等核心内容依然成立,配合最新官方文档阅读即可。
这本书和《Java并发编程实战》有什么区别?
后者偏重并发基础与线程安全的理论体系,是经典教材;本书更偏“异步”这条主线,聚焦Future、@Async、响应式编程与WebFlux等实践框架,并延伸到Netty、Dubbo等中间件,属于进阶实战型读物,二者可互补。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category