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

        Martin Kočí created issue -
        Gerhard Petracek made changes -
        Field Original Value New Value
        Comment [ it was done that way because i saw different instances even within a request. but i can't remember the setup. however, it shouldn't be called that often within a request and the injection process isn't expansive esp. due to the @Advanced check (which is the default behaviour). an alternative which would be safe as well is lazy injection directly in DefaultErrorViewExceptionHandler. ]
        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.
        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 -

        that would be the version with lazy injection

        Show
        Gerhard Petracek added a comment - that would be the version with lazy injection
        Gerhard Petracek made changes -
        Attachment EXTCDI-208.patch [ 12487184 ]
        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 -

        thx to martin for testing it

        Show
        Gerhard Petracek added a comment - thx to martin for testing it
        Gerhard Petracek made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.0.1 [ 12316527 ]
        Resolution Fixed [ 1 ]
        Gerhard Petracek made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development