[ 
https://issues.apache.org/jira/browse/MYFACES-3562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289395#comment-13289395
 ] 

Leonardo Uribe commented on MYFACES-3562:
-----------------------------------------

MK >> Ah, I see ... in that case new 
_AttachedDeltaWrapper(_converter.getClass(), /* null */ attachedState); 
represent the change setConverter(null), right? 

No, the internal value represents the delta, the one who represent the null 
converter is the null blank in:

return new Object[]{parentSaved, converterSaved};

_isSetConverter() flag activates, _converter is null, so null value to store on 
the state, so we return a null blank in the array [parentSaved, null].

MK >> During saveView, for each converter a instance of _AttachedDeltaWrapper 
is created, but immediatelly GCed. In this case, _AttachedDeltaWrapper has 
attachedState null too. Is it possible to distinguish between these two cases? 

Maybe the solution is add something like this:

                //Delta
                StateHolder holder = (StateHolder) _converter;
                if (!holder.isTransient())
                {
                    Object attachedState = holder.saveState(facesContext);
                    if (attachedState != null)
                    {
                        nullDelta = false;
                    }
                    // create it only when it has sense to do it.
                    if ( !(parentSaved == null && nullDelta) )
                    {
                        converterSaved = new 
_AttachedDeltaWrapper(_converter.getClass(),
                             attachedState);
                    }
                }
                else
                {
                    converterSaved = null;
                }

Other option is change the semantic of the algorithm and do not use an 
AttachedDeltaWrapper, instead an AttachedNullWrapper or something like that. 
I'm not sure how to do it. 
                
> [perf] Optimize UIOutput.saveState(FacesContext)
> ------------------------------------------------
>
>                 Key: MYFACES-3562
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3562
>             Project: MyFaces Core
>          Issue Type: Improvement
>            Reporter: Martin Kočí
>            Priority: Trivial
>         Attachments: MYFACES-3562.patch
>
>
> 1) use converterSaved as delta change check
> 2)  remove nullDelta boolean
> 3) move  new _AttachedDeltaWrapper into if (attachedState != null) statement
> question: _AttachedDeltaWrapper used in this context provides Class of 
> Converter, but that info is not used in restoreState - can we remove usage of 
> that wrapper?

--
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


Reply via email to