最新文章

私有构造函数捕获模式

私有构造函数捕获模式

《Java并发编程实践》的注解中有提到这一概念。 The private constructor exists to avoid the race condition that would occur if the copy constructor were implemented as this (p.x, p.y); this is an example of the private constructor capture idiom (Bloch and Gafter, 2005). 结合原文代码: @ThreadSafe public class SafePoint{ @GuardedBy("this") private int x,y; private SafePoint (int [] a) { this (a[0], a[1]); } public SafePoint(SafePoint p) { this (p.

About Me

张晓辉

英文名 Addo。 资深程序员,LF APAC 开源布道师,CNCF Ambassador,云原生社区管委会成员,公众号“云原生指北”作者,微软 Azure MVP。 曾任职于汇丰软件、唯品会、数人云、小鹏汽车,有多年的微服务和基础架构实践经验,主要工作涉及微服务、容 …

进一步了解