You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Hannum, Daniel" <Da...@PremierInc.com> on 2007/07/30 21:47:20 UTC

How to deal with big Trinidad table components in session

I have a few big Trinidad tables (UIXTable) that are stored in session
scoped backing beans. Unfortunately, they are causing memory problems,
so I'm trying to free the memory when you navigate away from the few
pages where they are used. I also know that request scope is too
short-lived for them.

 

First I cleared out the data lists backing the tables by setting the
references to null. However, they aren't garbage collected because the
SortableModel and the table components themselves still contain
references to the lists. I have tried setting setValue(null) on the
tables and even nulling out the components themselves, but there is
always another reference.

 

Since this is looking like a big hack at this point, here's my question.
Is there a way to programmatically tell a UIXTable (CoreTable) to delete
the data it's holding onto? I want to reset it to an empty state. This
seems to happen automatically if I change the backing list to an empty
list and redisplay the page, but I need it to happen without a page
redisplay (i.e. completely programmatically because this logic will be
in a method called at the top of other pages).

 

I hope that made sense. I haven't seen this asked before, and I hope
there's a clean way to do this.

Dan




-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  

RE: How to deal with big Trinidad table components in session

Posted by "Hannum, Daniel" <Da...@PremierInc.com>.
Ok, I'll try out just putting the DataModel in the bean (SortableModel
in my case). Then I imagine, I can clear out its data and the data will
hopefully be GC'd. I guess that means if a component is not bound to a
session bean, then that component object will automatically go away
after every request. Good to know.

 

As for pageFlowScope, I haven't found good documentation on it. I know I
can put values into it (setActionListener, I think) but I don't see how
to define what my page flows are. I'm also not using the dialog
framework (much). So overall, although I wish I had a page flow scope. I
don't know how to use the one in Trinidad. Any links you have would be
helpful.

 

Thanks.

 

________________________________

From: Simon Lessard [mailto:simon.lessard.3@gmail.com] 
Sent: Monday, July 30, 2007 3:56 PM
To: MyFaces Discussion
Subject: Re: How to deal with big Trinidad table components in session

 

Hello Daniel,

Firstly, never store a component in a session scoped bean, it's bad,
like crossing the streams in Ghostbusters. What you need to store in
session scope is the DataModel. If you need it to do some funny stuff
like lazy fetching, or something else, you can make your own
implementation to deal with data the way you want (maybe cache a good
chunk in as a singleton if the issue show up when there's many users
online?). Another option would be to use the pageFlowScope which is more
durable than request and less than session. 


Regards,

~ Simon

On 7/30/07, Hannum, Daniel <Da...@premierinc.com> wrote: 

I have a few big Trinidad tables (UIXTable) that are stored in session
scoped backing beans. Unfortunately, they are causing memory problems,
so I'm trying to free the memory when you navigate away from the few
pages where they are used. I also know that request scope is too
short-lived for them.

 

First I cleared out the data lists backing the tables by setting the
references to null. However, they aren't garbage collected because the
SortableModel and the table components themselves still contain
references to the lists. I have tried setting setValue(null) on the
tables and even nulling out the components themselves, but there is
always another reference.

 

Since this is looking like a big hack at this point, here's my question.
Is there a way to programmatically tell a UIXTable (CoreTable) to delete
the data it's holding onto? I want to reset it to an empty state. This
seems to happen automatically if I change the backing list to an empty
list and redisplay the page, but I need it to happen without a page
redisplay (i.e. completely programmatically because this logic will be
in a method called at the top of other pages).

 

I hope that made sense. I haven't seen this asked before, and I hope
there's a clean way to do this.

Dan

________________________________

***Note:The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, you
are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received this
communication in error, please notify the Sender immediately by replying
to the message and deleting it from your computer. Thank you. Premier
Inc. 

 




-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  

RE: How to deal with big Trinidad table components in session

Posted by "Hannum, Daniel" <Da...@PremierInc.com>.
This is also good to know. Thanks.

-----Original Message-----
From: Hazem Saleh [mailto:hazem.saleh@gmail.com] 
Sent: Monday, July 30, 2007 4:02 PM
To: MyFaces Discussion
Subject: Re: How to deal with big Trinidad table components in session

Hi Daniel,
As simon says, It is not good to store the dataTable content in the
session because if you have many concurrent users access the server
then the application may get an OutOfMemory Error (Ask me about this I
had faced this before :) ).
You can simply loads your data on demand by just providing a backend
like CURSOR that retrieves your data of interest.
Cagatay really has written a wonderful article about this. You may check
this :
http://cagataycivici.wordpress.com/2006/07/10/jsf_datatable_with_custom_
paging/
Thanks

On 7/30/07, Simon Lessard <si...@gmail.com> wrote:
> Hello Daniel,
>
> Firstly, never store a component in a session scoped bean, it's bad,
like
> crossing the streams in Ghostbusters. What you need to store in
session
> scope is the DataModel. If you need it to do some funny stuff like
lazy
> fetching, or something else, you can make your own implementation to
deal
> with data the way you want (maybe cache a good chunk in as a singleton
if
> the issue show up when there's many users online?). Another option
would be
> to use the pageFlowScope which is more durable than request and less
than
> session.
>
>
> Regards,
>
> ~ Simon
>
>
> On 7/30/07, Hannum, Daniel <Da...@premierinc.com> wrote:
> >
> >
> >
> >
> > I have a few big Trinidad tables (UIXTable) that are stored in
session
> scoped backing beans. Unfortunately, they are causing memory problems,
so
> I'm trying to free the memory when you navigate away from the few
pages
> where they are used. I also know that request scope is too short-lived
for
> them.
> >
> >
> >
> > First I cleared out the data lists backing the tables by setting the
> references to null. However, they aren't garbage collected because the
> SortableModel and the table components themselves still contain
references
> to the lists. I have tried setting setValue(null) on the tables and
even
> nulling out the components themselves, but there is always another
> reference.
> >
> >
> >
> > Since this is looking like a big hack at this point, here's my
question.
> Is there a way to programmatically tell a UIXTable (CoreTable) to
delete the
> data it's holding onto? I want to reset it to an empty state. This
seems to
> happen automatically if I change the backing list to an empty list and
> redisplay the page, but I need it to happen without a page redisplay
(i.e.
> completely programmatically because this logic will be in a method
called at
> the top of other pages).
> >
> >
> >
> > I hope that made sense. I haven't seen this asked before, and I hope
> there's a clean way to do this.
> >
> > Dan
> >
> >
> > ________________________________
>
> >
> >
> >
> > ***Note:The information contained in this message may be privileged
and
> confidential and protected from disclosure. If the reader of this
message is
> not the intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are hereby
notified
> that any dissemination, distribution or copying of this communication
is
> strictly prohibited. If you have received this communication in error,
> please notify the Sender immediately by replying to the message and
deleting
> it from your computer. Thank you. Premier Inc.
>
>


-- 
Hazem Ahmed Saleh Ahmed
http://www.jroller.com/page/HazemBlog

-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  

Re: How to deal with big Trinidad table components in session

Posted by Hazem Saleh <ha...@gmail.com>.
Hi Daniel,
As simon says, It is not good to store the dataTable content in the
session because if you have many concurrent users access the server
then the application may get an OutOfMemory Error (Ask me about this I
had faced this before :) ).
You can simply loads your data on demand by just providing a backend
like CURSOR that retrieves your data of interest.
Cagatay really has written a wonderful article about this. You may check this :
http://cagataycivici.wordpress.com/2006/07/10/jsf_datatable_with_custom_paging/
Thanks

On 7/30/07, Simon Lessard <si...@gmail.com> wrote:
> Hello Daniel,
>
> Firstly, never store a component in a session scoped bean, it's bad, like
> crossing the streams in Ghostbusters. What you need to store in session
> scope is the DataModel. If you need it to do some funny stuff like lazy
> fetching, or something else, you can make your own implementation to deal
> with data the way you want (maybe cache a good chunk in as a singleton if
> the issue show up when there's many users online?). Another option would be
> to use the pageFlowScope which is more durable than request and less than
> session.
>
>
> Regards,
>
> ~ Simon
>
>
> On 7/30/07, Hannum, Daniel <Da...@premierinc.com> wrote:
> >
> >
> >
> >
> > I have a few big Trinidad tables (UIXTable) that are stored in session
> scoped backing beans. Unfortunately, they are causing memory problems, so
> I'm trying to free the memory when you navigate away from the few pages
> where they are used. I also know that request scope is too short-lived for
> them.
> >
> >
> >
> > First I cleared out the data lists backing the tables by setting the
> references to null. However, they aren't garbage collected because the
> SortableModel and the table components themselves still contain references
> to the lists. I have tried setting setValue(null) on the tables and even
> nulling out the components themselves, but there is always another
> reference.
> >
> >
> >
> > Since this is looking like a big hack at this point, here's my question.
> Is there a way to programmatically tell a UIXTable (CoreTable) to delete the
> data it's holding onto? I want to reset it to an empty state. This seems to
> happen automatically if I change the backing list to an empty list and
> redisplay the page, but I need it to happen without a page redisplay (i.e.
> completely programmatically because this logic will be in a method called at
> the top of other pages).
> >
> >
> >
> > I hope that made sense. I haven't seen this asked before, and I hope
> there's a clean way to do this.
> >
> > Dan
> >
> >
> > ________________________________
>
> >
> >
> >
> > ***Note:The information contained in this message may be privileged and
> confidential and protected from disclosure. If the reader of this message is
> not the intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are hereby notified
> that any dissemination, distribution or copying of this communication is
> strictly prohibited. If you have received this communication in error,
> please notify the Sender immediately by replying to the message and deleting
> it from your computer. Thank you. Premier Inc.
>
>


-- 
Hazem Ahmed Saleh Ahmed
http://www.jroller.com/page/HazemBlog

Re: How to deal with big Trinidad table components in session

Posted by Simon Lessard <si...@gmail.com>.
Hello Daniel,

Firstly, never store a component in a session scoped bean, it's bad, like
crossing the streams in Ghostbusters. What you need to store in session
scope is the DataModel. If you need it to do some funny stuff like lazy
fetching, or something else, you can make your own implementation to deal
with data the way you want (maybe cache a good chunk in as a singleton if
the issue show up when there's many users online?). Another option would be
to use the pageFlowScope which is more durable than request and less than
session.


Regards,

~ Simon

On 7/30/07, Hannum, Daniel <Da...@premierinc.com> wrote:
>
>  I have a few big Trinidad tables (UIXTable) that are stored in session
> scoped backing beans. Unfortunately, they are causing memory problems, so
> I'm trying to free the memory when you navigate away from the few pages
> where they are used. I also know that request scope is too short-lived for
> them.
>
>
>
> First I cleared out the data lists backing the tables by setting the
> references to null. However, they aren't garbage collected because the
> SortableModel and the table components themselves still contain references
> to the lists. I have tried setting setValue(null) on the tables and even
> nulling out the components themselves, but there is always another
> reference.
>
>
>
> Since this is looking like a big hack at this point, here's my question.
> Is there a way to programmatically tell a UIXTable (CoreTable) to delete the
> data it's holding onto? I want to reset it to an empty state. This seems to
> happen automatically if I change the backing list to an empty list and
> redisplay the page, but I need it to happen without a page redisplay (i.e.
> completely programmatically because this logic will be in a method called at
> the top of other pages).
>
>
>
> I hope that made sense. I haven't seen this asked before, and I hope
> there's a clean way to do this.
>
> Dan
>
> ------------------------------
>
> * ***Note:The information contained in this message may be privileged and
> confidential and protected from disclosure. If the reader of this message is
> not the intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are hereby notified
> that any dissemination, distribution or copying of this communication is
> strictly prohibited. If you have received this communication in error,
> please notify the Sender immediately by replying to the message and deleting
> it from your computer. Thank you. Premier Inc. *
>