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

Martin Grigorov commented on WICKET-6334:
-----------------------------------------

Sven has a good point that using LDM in Session is not thread-safe!

I think my proposed change is good because of the following reasons:
1) if the application uses 
org.apache.wicket.core.util.objects.checker.SessionChecker (I believe it is a 
very good thing to do!) then Session#getSizeInBytes() will always log an error.
With the change in 8.x the checkers will only be used when the root object is 
an instance of a Page and for all its fields and grand-fields. If a Session 
object is the root then the checkers are skipped
2) the second problem with #getSizeInBytes() was that it was calculating the 
size of attached Session, because Session was no IDetachable for some reason 
until now.
We started detaching the components and IDetachables with WICKET-4867 4 years 
ago to calculate their size as they would be when storing on the disk.
The Session should not be stored on the disk but still I think 
#getSizeInBytes() should show the numbers after the end of the request cycle.

[~ihorps] I see a workaround for 7.x - use "new 
NotDetachedModelChecker(Collections.singletonList(MySessionLDM.class))". This 
way NotDetachedModelChecker won't check this special session model at all.

> WicketObjects#sizeof() should detach Sessions
> ---------------------------------------------
>
>                 Key: WICKET-6334
>                 URL: https://issues.apache.org/jira/browse/WICKET-6334
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 7.6.0
>            Reporter: Martin Grigorov
>            Assignee: Martin Grigorov
>            Priority: Minor
>
> Report at users@ : http://markmail.org/message/mq5zs2veaj4q4psg
> Wicket should detach the Session before calculating its size as it does for 
> Component and IDetachable.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to