[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
BufferedContentMgr - Remove content after download automatically  XML
Forum Index -> Development
Author Message
brandt

Power User
[Avatar]

Joined: 12/03/2008 16:37:34
Messages: 45
Location: Bern
Offline

Hi Björn,

we have some problems with the BufferedContentMgr.

We see lots of BufferedContent objcects in our http-sessions, which consume a lot of server memory.

I know, as a user of the CapainCasa framework i am responsible for removing the content.

But i think the handling for removing content with the BufferedContentMgr is not very comfortable.

We used your standard way for removing content by adding a WorkpageDefaultLifecycleListener. But our PageBean with the download functionality was opened as a popup. So our WorkpageDefaultLifecycleListener was not called as the popup was closed. And our content was kept in the http-session.

As a CapainCasa developer i have to use the right event listener or a suitable jsf phase to remove the content depending on the context in which my Download PageBean is running. That is too complex and too difficult (at least for me).

So my question is:
Can you implement / extend the BufferedContentMgr class in a way, that the content is removed automatically, after the content was sent to the client?
May be you could create a corresponding flag "automaticContentRemoval" (true/false).

With "automaticContentRemoval=true" we have the constellation of a one-time-content. That is exactly what we need in our applications.

I would prefer to generate a certain content a second or third time before running into a memory problem on the application server.

Kind regards
Joe

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5526
Offline

Hi,

you can do this on your own - just remove the instance from the BufferedContentMgr when you get the download-success notification. But, please pay attention: if the user clicks the e.g. Download-link a second time, then there will be some problem, because the content was removed. So you would neet to e.g. disable the link after successful download.

AND: this removal mechanism only would work if the user downloads the content. If the content is not touched, then no one triggers the deletion...

It is the better way to really remove it when the page is no longer used - and this decision can only be made by the application.

In case of a popup: the one who opens the popup also has to close the popup (IModal/ModelessPopupListener. In the closing processing it's the correct point of time for removing the Buffered Content. When using PageBeans as popup this is quite simple: I would add a close() method to your page bean which needs to be called by the popup opener.

Regards, Björn

Björn Müller, CaptainCasa GmbH
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5526
Offline

...one idea which might be useful...(?): I could add a validity-duration as parameter to the DefaultBufferedContent. So that there is some time out for the buffered content intances. Maybe this would be some compromise?

Regards, Björn

Björn Müller, CaptainCasa GmbH
brandt

Power User
[Avatar]

Joined: 12/03/2008 16:37:34
Messages: 45
Location: Bern
Offline

Hi Björn,

a validity-duration as parameter sounds great. I like this idea.

Please implement this feature.

I have an additionally idea / requirement:
What do you think about an additionally (parameterless) method removeAll() in the BufferedContentMgr class?

The removeAll method iterates over all session attributes starting with "bufferedContent_" and removes them from the session.

By calling this method it is guarenteed that all BufferedContent is removed from the session.

Kind regards
Joe

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5526
Offline

removeAll() is no problem at all!

...will add both issues short term... (but am not 100% sure if it will be for next update)...

Regards, Björn

Björn Müller, CaptainCasa GmbH
brandt

Power User
[Avatar]

Joined: 12/03/2008 16:37:34
Messages: 45
Location: Bern
Offline

Hi Björn,

don' t harry.

Kind regards
Joe
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5526
Offline

Ha, I like the "harry" - I always use "harry" where others use "foo".
Was this by intention from your side? ;-)
Björn

Björn Müller, CaptainCasa GmbH
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5526
Offline

Update 20151207 (available in some hours) contains the methods:

BufferedContentMgr/UploadContentMgr.removeAllContentOlderThan(durationInMs). You may call the methods by e.g. some timer that you place in your outest page + which is called not too frequently (e.g. every 10 minutes).

Regards, Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team