Cache ConstraintValidator instances per ValidatorFactory and not per ConstraintTree
-----------------------------------------------------------------------------------
Key: HV-242
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-242
Project: Hibernate Validator
Issue Type: Improvement
Components: engine
Affects Versions: 4.0.0.GA
Reporter: Emmanuel Bernard
Priority: Minor
Fix For: 4.1.0
Evaluate the possibility of caching initialized ConstraintValidator implementations at the
ValidatorFactory level instead of creating and initializing them for each ConstraintTree
(ie each constraint evaluation.
It should be uniquely identified by:
- the constraint declaration is belongs to (as it is initialized for a specific
constraint)
- the ConstraintValidatorFactory it belongs to as this is the CV provider
Note that by side effect we will be caching the findMatchingValidatorClass results. Since
types are the class types, we can cache the ConstraintValidator class expected to be used
for a given constraint declaration.
If we cache for all ConstraintValidatorFactory, then a concurrent identity based weak hash
map has to be used.as CVF instances provided by users could be discarded rapidly. An
alternative would be to cache only for the default VF CVF. In that case the map should
only be a concurrent hashmap.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira