[
https://issues.apache.org/jira/browse/BVAL-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matt Benson closed BVAL-114.
----------------------------
Resolution: Won't Fix
BVal 2.0.0 includes a complete rewrite of BV metadata which is now cached in
association to the validation factory.
> ApacheValidatorFactory.getValidator() caching
> ---------------------------------------------
>
> Key: BVAL-114
> URL: https://issues.apache.org/jira/browse/BVAL-114
> Project: BVal
> Issue Type: Improvement
> Components: jsr303
> Affects Versions: 0.4, 0.5
> Reporter: Jarek Gawor
> Priority: Major
> Attachments: BVAL-114.patch
>
>
> We have a piece of code that's essentially doing:
> ValidatorFactory factory = ....;
> for (...) {
> Foo foo = ...;
> factory.getValidator().validate(foo);
> }
> With this pattern the Foo class is scanned for annotations on each loop
> iteration. The problem is that each getValidator() invocation on the same
> factory instance create a separate ApacheFactoryContext instance with own
> MetaBeanFinder. Therefore, the cache in MetaBeanFinder doesn't really get
> reused between loop iterations.
> One obvious solution is to use the same Validator object instance in the
> loop. However, in certain situations it might not be easy to change the code
> pattern in that way. So, I'm wondering whether getValidator() can be
> optimized in such a way that the MetaBeanFinder (and therefore its cache) can
> be reused between calls. From JavaDoc it sounds like some sort of caching
> might be allowed.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)