You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Daniel Stoch <da...@gmail.com> on 2014/02/14 15:55:57 UTC

Session size vs detached models

Hi,

In Wicket 1.4 the last page reference is hold in a session (is it in 6.x
also?). So after a request has been processed all components and models
should be detached, so this last page reference should not hold transient
LDM values. Is it true?

When we are using DebugBar with SessionSizeDebugPanel, it displays session
size and totalSize (by SessionTotalSizeModel). Does this totalSize includes
size of object loaded by LDM or it counts all components and models size in
detached state?

--
Daniel

Re: Session size vs detached models

Posted by Daniel Stoch <da...@gmail.com>.
On Fri, Feb 14, 2014 at 4:12 PM, Martin Grigorov <mg...@apache.org>wrote:

>
> > should be detached, so this last page reference should not hold transient
> > LDM values. Is it true?
> >
>
> LDM null-yfies its transien field explicitly:
>
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/model/LoadableDetachableModel.java?source=cc#L104
>
> But if your custom model uses transient that is not null-yfied in
> onDetach() then it will be kept alive in the http session.
>

You mean in detach(), not onDetach() ;)


>
> >
> > When we are using DebugBar with SessionSizeDebugPanel, it displays
> session
> > size and totalSize (by SessionTotalSizeModel). Does this totalSize
> includes
> > size of object loaded by LDM or it counts all components and models size
> in
> > detached state?
> >
>
> I have to check what is th difference between size and totalSize, but since
> https://issues.apache.org/jira/browse/WICKET-4867 the detachable is
> detached before measuring its size.
>
> Ok, great to know. So it looks in 1.4.x totalSize is measured before
detaching.


Thanks for the answer.

--
Daniel

Re: Session size vs detached models

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Fri, Feb 14, 2014 at 3:55 PM, Daniel Stoch <da...@gmail.com>wrote:

> Hi,
>
> In Wicket 1.4 the last page reference is hold in a session (is it in 6.x
> also?). So after a request has been processed all components and models
>

Yes. A live instance of the last used page is kept in the http session.
Actually it is a list of page instances.
All instantiated and "touched" pages in a request are saved for faster
retrieval for the next request.
https://cwiki.apache.org/confluence/display/WICKET/Page+Storage


> should be detached, so this last page reference should not hold transient
> LDM values. Is it true?
>

LDM null-yfies its transien field explicitly:
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/model/LoadableDetachableModel.java?source=cc#L104

But if your custom model uses transient that is not null-yfied in
onDetach() then it will be kept alive in the http session.


>
> When we are using DebugBar with SessionSizeDebugPanel, it displays session
> size and totalSize (by SessionTotalSizeModel). Does this totalSize includes
> size of object loaded by LDM or it counts all components and models size in
> detached state?
>

I have to check what is th difference between size and totalSize, but since
https://issues.apache.org/jira/browse/WICKET-4867 the detachable is
detached before measuring its size.


>
> --
> Daniel
>