Resolution: Won't Fix
Affects Version/s: 3.1M3
Fix Version/s: None
Component/s: Core Library
Environment:This affects all versions of Cayenne. The fix should go either in 3.1 or 3.2
EntityResolver contents normally don't change in runtime, yet it has a bunch of synchronized methods - lookupObjEntity, getClassDescriptor(), etc. (Surprisingly 'getObj/DbEntity' is not synchronized). All these methods are invoked very frequently and create contention points in highly concurrent apps. IIRC historically these methods were added for the benefit of the Modeler (as a user might add/remove DataMaps, and change their contents all the time).
The goal of this task is to provide a simple and efficient EntityResolver for the runtime.
However it may require deep refactoring which may push it to 3.2 release. Specifically:
1. Split the uses of EntityResolver between the Modeler and runtime (it is generally easy based on MappingNamespace interface, except when we are calling EJBQL validation API that requires EntityResolver)
2. Prevent DataMap from looking for objects in the parent namespace. This is confusing and was probably done for the modeler benefit too.
3. Remove DataMap change events (probably will require a special DataMap implementation for the Modeler that has those events)
4. Remove EntityResolver on-demand compilation features. If a user wants to change the mapping dynamically, it is probably safer and more efficient to create a new EntityResolver from scratch.