Moritz Bechler created EXTVAL-157:
-------------------------------------

             Summary: Cleanup/Reduce/Remove static state
                 Key: EXTVAL-157
                 URL: https://issues.apache.org/jira/browse/EXTVAL-157
             Project: MyFaces Extensions Validator
          Issue Type: Improvement
    Affects Versions: 2.0.7
            Reporter: Moritz Bechler


ExtVal currently makes extensive use of global static state. This means that 
the library must be loaded separately for each application and prevents 
deployment as an OSGI bundle. It would be a major improvement to either
a) perform (or even only permit API-wise) proper cleanup of static state to 
allow application restart for a single application without leaking classloaders 
or retaining stale state
b) get rid of global static state and properly distinguish between multiple 
callers (maybe use JSF application context storage or index by TCCL).

A list of particularly hurtful instances found so far:
  * 
org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener@initializedListeners
  * 
org.apache.myfaces.extensions.validator.core.factory.DefaultFactoryFinder@factoryFinder
  * org.apache.myfaces.extensions.validator.core.ExtValContext@extValContext
  * 
org.apache.myfaces.extensions.validator.core.renderkit.ConvertedValueCache@value
  * 
org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration@extValContext
  * 
org.apache.myfaces.extensions.validator.beanval.ExtValBeanValidationModuleConfiguration@extValContext

The last two are really useless duplicate references to the ExtValContext and 
can be easily removed.
There are a few other instances where configuration data gets replicated into 
static variables. These are not that troublesome but need to be fixed to get 
proper multi-application support.
All of these statics are private, therefor fixing this should be possible 
without breaking the API.

So far, based on a) I have patched extval to properly behave in our custom OSGI 
environment for a single application but a proper solution would be really 
appreciated. 

Thoughts on this?



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to