You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "jakubrauch (via GitHub)" <gi...@apache.org> on 2023/04/27 19:55:54 UTC

[GitHub] [beam] jakubrauch commented on a diff in pull request #25913: Add synchronized to getExtensionRegistry() lazy initialization

jakubrauch commented on code in PR #25913:
URL: https://github.com/apache/beam/pull/25913#discussion_r1179618259


##########
sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoCoder.java:
##########
@@ -275,7 +279,7 @@ public ExtensionRegistry getExtensionRegistry() {
   final Set<Class<?>> extensionHostClasses;
 
   // Transient fields that are lazy initialized and then memoized.
-  private transient ExtensionRegistry memoizedExtensionRegistry;
+  private transient volatile ExtensionRegistry memoizedExtensionRegistry;

Review Comment:
   Analyzer hinted at changing it to volatile after the synchronization. I suspect the analyzer worries it could still potentially read stale registry within the synchronization block.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org