Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3486

[perf] cache Factories to prevent unnecessary FactoryFinder.getFactory() calls

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.13, 2.1.7
    • JSR-314
    • None

    Description

      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.

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: