jrmccluskey commented on code in PR #35752:
URL: https://github.com/apache/beam/pull/35752#discussion_r2246236462


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/CachingFactory.java:
##########
@@ -45,10 +45,16 @@ public CachingFactory(@UnknownInitialization 
Factory<CreatedT> innerFactory) {
   }
 
   private ConcurrentHashMap<TypeDescriptor<?>, CreatedT> getCache() {
-    if (cache == null) {
-      cache = new ConcurrentHashMap<>();
+    ConcurrentHashMap<TypeDescriptor<?>, CreatedT> value = cache;
+    if (value == null) {

Review Comment:
   The ideal double-check lock pattern seems to utilize a local temporary 
variable for performance reasons in Java. An internal outline of the pattern 
laid it out that way, and the Gemini code review re-iterated that usage



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to