Le 20/03/2017 à 07:37, Stefan Seelmann a écrit : > On 03/20/2017 02:10 AM, Emmanuel Lécharny wrote: >> public class BooleanSyntaxChecker extends SyntaxChecker >> { >> /** >> * A static instance of BooleanSyntaxChecker >> */ >> public static final BooleanSyntaxChecker INSTANCE = new >> BooleanSyntaxChecker( SchemaConstants.BOOLEAN_SYNTAX ); >> >> /** A static instance of the builder */ >> private static final Builder BUILDER_INSTANCE = new Builder(); >> /** >> * @return An instance of the Builder for this class >> */ >> public static Builder builder() >> { >> return BUILDER_INSTANCE; >> } > Hm, why a static builder? As it is not immutable there's a chance of > race condition in case two threads use it concurrently.
That can't happen, because we have : private static final Builder BUILDER_INSTANCE = new Builder(); that is guaranteed to be built during the class loading. -- Emmanuel Lecharny Symas.com directory.apache.org