cshannon commented on PR #2188: URL: https://github.com/apache/activemq/pull/2188#issuecomment-4895661177
Using a Reentrant lock doesn't make sense because of the memory usage and the added complexity. I went ahead and reworked this a little bit to fix the race condition by ensuring the decision to sync or not is only checked after reading one variable and not two. For example, getText() only relies on whether text is null and will synchronize if it is. This eliminates the race condition of reading text and content and then trying to determine their state outside of a lock when another thread could be mutating both. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
