avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@legsem.com
Subject Re: Avro schema properties contention on multithread read
Date Thu, 06 Jul 2017 16:20:01 GMT
On 05.07.2017 21:53, Zoltan Farkas wrote:

> The synchronization in JsonProperties is curently inconsistent (see getObjectProps())
which makes current implementation @NotThreadSafe 
> I think it would be probably best to remove synchronization from those methods... and
add @NotThreadSafe to the class... 
> Utilities like Schemas.synchronizedSchema(...) and Schemas.unmodifiableSchema(...) could
be added to help with various use cases... 
> --Z

Thank you for your reply. I like your Schemas.unmodifiableSchema(...) a

While what you are describing would be ideal, a simpler solution might
be to change the LinkedHashMap that backs jsonProperties into something
like a ConcurrentHashMap, avoiding the need for synchronization. 

This being said ConcurrentHashMap itself does not preserve insertion
order, so its not a mere replacement to LinkedHashMap.
View raw message