|
Btw. in the provider resolver used in WildFly we got rid of the caching altogether as per Brian's recommendation in this PR. The construct of WeakHashMap and SoftReferences allows for releasing the cache entries at some point but naturally there is no guarantee when this happens:
You should assume a SoftReference is equivalent to a regular hard reference, since it would only get cleared if the overall JVM memory state caused the VM to clear soft references. That may never happen or may happen well after the deployment is removed.
Maybe it should be done here in the same way? After all the validator factory should be cached at the application level, so the provider cache may not be worth the effort?
|