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

UIComponent EventListenerWrapper optimizations

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.6, 2.1.0
    • 2.0.7, 2.1.1
    • JSR-314
    • None

    Description

      Our current implementation for EventListenerWrapper class inside UIComponent works well but it can be better.

      This wrapper is used by UIComponent.subscribeToEvent and unsubscribeFromEvent to handle the case when a listener is the same component, so when the state is restored, the component could be found using UIComponent.getCurrentComponent().

      The spec says that @ListenerFor annotations can be used for both components and renderers. Why EventListenerWrapper don't do the same trick for renderers? Since the rendererType does not change over component lifetime (just on init time), we can expect UIComponent.getCurrentComponent().getRenderer(facesContext) return the expected one without need to create it, right?

      Other reason to assume the previous trick for renderers, is renderer listeners are not registered for components that does not use the same renderer. This can be checked easily looking on ApplicationImpl.createComponent code.

      Additionally, EventListenerWrapper could take into account other cases where the listener implements StateHolde or PartialStateHolder, or even better it can assume on PSS it is not required to save info and restore the listener, because the listener is stateless.

      The effect of this optimization is h:outputScript and h:outputStylesheet will return null when saveState() is called and PSS is on, minimizing the state stored by state saving algorithm.

      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: