Hi guys, I have 2 requests on that one:
1. do you see any drawback I would have missed doing that (not rebuilding the whole mode when one of the config is set when creating the validator)? 2. if it looks good, anyone would have some cycles to release it to let it be part of tomee? I spotted it out using bval + hibernate-entitymanager which set a custom TraversableResolver and leads us to reparse all constraints. With this fix we would do it only for ParameterNameProvider which is acceptable I think. Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> ---------- Forwarded message ---------- From: <[email protected]> Date: 2016-09-27 15:43 GMT+02:00 Subject: svn commit: r1762479 - /bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java To: [email protected] Author: rmannibucau Date: Tue Sep 27 13:43:13 2016 New Revision: 1762479 URL: http://svn.apache.org/viewvc?rev=1762479&view=rev Log: BVAL-147 avoid to skip the cache when not needed Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ ApacheFactoryContext.java Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ ApacheFactoryContext.java URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/ java/org/apache/bval/jsr/ApacheFactoryContext.java?rev= 1762479&r1=1762478&r2=1762479&view=diff ============================================================ ================== --- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java (original) +++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java Tue Sep 27 13:43:13 2016 @@ -83,7 +83,7 @@ public class ApacheFactoryContext implem */ public ValidatorContext messageInterpolator(MessageInterpolator messageInterpolator) { this.messageInterpolator = messageInterpolator; - resetMeta(); + // resetMeta();, see traversableResolver() comment return this; } @@ -92,7 +92,8 @@ public class ApacheFactoryContext implem */ public ValidatorContext traversableResolver(TraversableResolver traversableResolver) { this.traversableResolver = traversableResolver; - resetMeta(); + // meta are not affected by this so don't call resetMeta(); + // implementor note: this is what does hibernate and loosing our cache cause of resetMeta() call makes it super slow! return this; } @@ -101,13 +102,13 @@ public class ApacheFactoryContext implem */ public ValidatorContext constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { this.constraintValidatorFactory = constraintValidatorFactory; - resetMeta(); + // same note as traversableResolver resetMeta(); return this; } public ValidatorContext parameterNameProvider(ParameterNameProvider parameterNameProvider) { this.parameterNameProvider = parameterNameProvider; - resetMeta(); + resetMeta(); // needed since param names are capture during processing return this; }
