jrmccluskey commented on code in PR #35752: URL: https://github.com/apache/beam/pull/35752#discussion_r2246082828
########## sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/FromRowUsingCreator.java: ########## @@ -102,11 +102,17 @@ public T apply(Row row) { return (T) creator.create(params); } - private synchronized void initFieldConverters(Schema schema) { + private synchronized void initFieldConverters(Schema schema) { + Function[] value = fieldConverters; if (fieldConverters == null) { - CachingFactory<List<FieldValueTypeInformation>> typeFactory = - new CachingFactory<>(schemaProvider::fieldValueTypeInformations); - fieldConverters = fieldConverters(typeDescriptor, schema, typeFactory); + synchronized (this) { + value = fieldConverters; + if (fieldConverters == null) { + CachingFactory<List<FieldValueTypeInformation>> typeFactory = + new CachingFactory<>(schemaProvider::fieldValueTypeInformations); + fieldConverters = value = fieldConverters(typeDescriptor, schema, typeFactory); + } + } } } Review Comment: okay the volatile keyword on fieldConverters did the trick -- 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-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org