It turns out EventListenerGroupImpl allows to dynamically change the registered listeners at runtime, but when doing so it’s not using adequate memory barriers to ensure such changes are consistently applied across all threads. I’ll fix the memory requirements and, while at it, avoid for method listeners() to allocate a new List at each use; this method was deprecated but it appears it’s still being used in varies event processors, which is showing as a performance issue. As 6.2 is nearly ready I’ve refrained from a more consistent refactoring, proposing a plan for further actions here: https://github.com/hibernate/hibernate-orm/discussions/5956 |