-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I'd like to access the org.zkoss.zss.ui.Spreadsheet object from a servlet filter.
Purpose for doing this is to create a quasi-timeout; after 5 minutes of inactivity, take that spreadsheet, and serialize it disk. That way memory is freed up in the heap for the VM, as the Spreadsheet object is large in heap.
Then when a user does something with the spreadsheet in a window beyond 5 minutes to the session timeout defined in web.xml, re-load that spreadsheet from disk. Yes I'm aware there will be performance implications on the reload, but I'm trying to keep the amount of heap down for loaded spreadsheets.
Anyways, any way to access a org.zkoss.zss.ui.Spreadsheet type object from HttpServletRequest?
How do I save the spreadsheet in session?
Is there a setting in
http://www.zkoss.org/javadoc/latest/zss/org/zkoss/zss/ui/Spreadsheet.html
Or the <spreadsheet> element?
Hi, phlogistic
on second thought, it seems that store spreadsheet component on session is not a good idea.
component stay on desktop scope, if save component to session, what if desktop get cleanup, the spreadsheet instance will not get cleanup, because session still alive.
so, I am think about another way, maybe using some cache system (for example Commons JCS, Ehcache etc...) to cache the spreadsheet component. and restore from it, it's just a idea, not sure how to implement it
Hi, phlogistic
after I discuss with my colleague, he mentioned another possible approach by using encache
1. use a timer on zul page, timer will send event to server after 3 min when user doesn't do anything at client, when server receive this event, AP will detach spreadshet from desktop, and put the spreadsheet to encache. The mask can be a div or borderlayout that has a label says "spreadsheet is idle or sleeping", and the mask has a button that will "wake spreadsheet", when user click the button, AP will need to get spreadsheet from encache and attache to desktop, replace the mask
2. how do we determinate that user does't do anything ? possible way is using client side programming or use piggyback event.
-> if use client side programming: override zk event fire API, when event occure, means user is doing something, so we can reset the timer at client
-> if use piggyback, when zk fire event to server, the piggyback will go with it, then it means user is doing something, server will maintain a timestamp; If user doesn't do anything, then after 3 min, zk will fire onTimer and piggyback event to server, then AP check the timestamp, if more then 3 min, then means user doesn't do anything
Asked: 2012-10-09 16:01:58 +0800
Seen: 150 times
Last updated: Oct 18 '12