I've attached a testcase (see included README) which I used to reproduce the issue with EAP 6 (Hibernate 4) and EAP 7 (Hibernate 5.0.11). The testcase uses Byteman rules to control which thread wins the race to initialize AnnotationBinder.DEFAULT_CACHE_CONCURRENCY_STRATEGY. Specifically, the EAP*AnnotationBinderDetermineCacheConcurrencyStrategyEnableSleep rule causes the thread deploying the cache enabled unit to sleep when it hits AnnotationBinder.determineCacheConcurrencyStrategy(). Consequently, the unit with cache disabled sets the default strategy and this determines the value subsequently returned on all threads. |