MyFaces CODI
  1. MyFaces CODI
  2. EXTCDI-208

CodiFacesContextWrapper.getExceptionHandler() tries to inject many times during one request/response

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.0.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      codi 1.0.0

      Description

      org.apache.myfaces.extensions.cdi.jsf2.impl.listener.request.CodiFacesContextWrapper.getExceptionHandler() tries to inject field always - in every method call.

      ExceptionHandler instance has request scoped lifespan and it cannot change - I think is suitable to inject fields only once.

      1. EXTCDI-208.patch
        5 kB
        Gerhard Petracek

        Activity

        Hide
        Gerhard Petracek added a comment -

        thx to martin for testing it

        Show
        Gerhard Petracek added a comment - thx to martin for testing it
        Hide
        Martin Kočí added a comment -

        Thanks Gerhard, it works for me.

        Show
        Martin Kočí added a comment - Thanks Gerhard, it works for me.
        Hide
        Gerhard Petracek added a comment -

        that would be the version with lazy injection

        Show
        Gerhard Petracek added a comment - that would be the version with lazy injection
        Hide
        Martin Kočí added a comment -

        My test is is pretty virtual - no real performance problem. I only noticed unexpected number of invocation of CodiUtils.injectFields - in my test case I call facesContext.getExceptionHandler() 1000x

        Show
        Martin Kočí added a comment - My test is is pretty virtual - no real performance problem. I only noticed unexpected number of invocation of CodiUtils.injectFields - in my test case I call facesContext.getExceptionHandler() 1000x
        Hide
        Gerhard Petracek added a comment -

        it was done that way because you need to inject something in DefaultErrorViewExceptionHandler which has to dyn. wrap the created exception-handler. however, we could do that lazily if you noticed a big impact.

        Show
        Gerhard Petracek added a comment - it was done that way because you need to inject something in DefaultErrorViewExceptionHandler which has to dyn. wrap the created exception-handler. however, we could do that lazily if you noticed a big impact.

          People

          • Assignee:
            Unassigned
            Reporter:
            Martin Kočí
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development