lhotari commented on issue #14436: URL: https://github.com/apache/pulsar/issues/14436#issuecomment-1064917458
In this case, one example of a class that is not thread safe is LedgerEntriesImpl. It has a single field `entries`: https://github.com/apache/bookkeeper/blob/7087fda4e91e9fe8974f9d36e01e275a08bf38f1/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/impl/LedgerEntriesImpl.java#L38 I'm not saying that full synchronization is required. In this case, it is sufficient to apply [the "golden rule" that Aleksey Shipilev presents](https://www.youtube.com/watch?v=TK-7GCCDF_I&t=2610s).  I'm thinking of an approach where there would be a base class for recycled objects with methods that should be called after writing fields and before reading fields in different threads. That would be sufficient to ensure thread safety without the need to have full synchronization. It could be implemented with a simple volatile field write and read. -- 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]
