[perf] cache Factories to prevent unnecessary FactoryFinder.getFactory() calls
------------------------------------------------------------------------------
Key: MYFACES-3486
URL: https://issues.apache.org/jira/browse/MYFACES-3486
Project: MyFaces Core
Issue Type: Improvement
Components: JSR-314
Reporter: Leonardo Uribe
Assignee: Leonardo Uribe
FactoryFinder.getFactory() contains some synchronized blocks. The code is fast
enough, but it could be good to prevent those calls if is not really necessary.
Checking this stuff I had an idea about how to prevent those calls. The idea is
call FactoryFinder.getFactory() in the factory itself, and then pass the
factory as a param for the object that uses it (FacesContext or
PartialViewContext or whatever). Also, we can replace
VisitContext.createVisitContext with calling the factory and then
getVisitContext() directly (note createVisitContext is an static method thought
for users). Additionally, add some volatile variables in some places to prevent
multiple initializations is a good idea too.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira