Making Bloch's builder pattern thread-safe: Rechecking necessary in enclosing constructor if NEVER invalid?
问题 I have recently learned Joshua Bloch's builder pattern for creating objects with many optional fields. I've been using something like it for years, but never used an inner-class until Bloch's book suggested it to me. I love it. I understand that another thread may alter the bulider's configuration, before it's actually built (with build() ), such that it may be necessary to re-validate all values in the constructor of the enclosing class. Below is an example of a builder class that optionally