r1083061 On Fri, Mar 18, 2011 at 9:49 PM, Martin Grigorov <mgrigo...@apache.org>wrote:
> Heads down :-) > > Together with Pedro we made another brainstorm session in IRC and we > realised how 1.4 works. > I'll write it down here for the generations. If Matej still reads here I'd > love to hear his confirmation. > > In short: there is no need to change anything! > > In details: > Wicket stores the page instances in the session in > org.apache.wicket.page.PersistentPageManager.SessionEntry object. When the > http session has to be replicated or there are more pages in the memory than > the configured (see > org.apache.wicket.pageStore.DefaultPageStore.SerializedPagesCache.size) then > those pages has to be serialized. > > Case 1) Here if there is Application available (worker thread) then a > SerializedPage is created from a Page instance. A SerializedPage is as I > said earlier: > int pageId; > String sessionId; > byte[] data; // the page itself > > pageId and sessionId are used to be able to be able to find later the page > in the IDataStore (e.g. DiskDataStore) and cleaned if the session expires > from this store. > > Case 2) There is no Application (WicketFilter#destroy() thread) then the > http session is being serialized by the web container so that after restart > of the application/container the application can reload its sessions. In > this case we don't need the session id for our needs in IDataStore (because > it is not used in this case) and we can serialize just the Page instance > without the two additional slots. > > Later when > org.apache.wicket.page.PersistentPageManager.SessionEntry.readObject(ObjectInputStream) > is called we load just Serializable in an List > (org.apache.wicket.page.PersistentPageManager.SessionEntry.afterReadObject). > This Serializable can be either Page or SerializedPage. > Even later when the first > org.apache.wicket.page.PersistentPageManager.SessionEntry.getPage(int) comes > (this is always a worker thread, so there is Application available) the > entries from this List are passed to > org.apache.wicket.pageStore.IPageStore.convertToPage(Object) where they are > potentially converted from SerializedPage to Page. > > That's it. > This is how it works in 1.4 too. Just in 1.5 the related classes are either > renamed or completely rewritten. > > The fix is removal of two lines. I tested it with Tomcat7 and > wicket-examples -> compref -> TabbedPanel. > Scenario: > - start the app. > - click randomly on the tabs. > - stop the app > - start the app > - click on any tab > > Without the fix I get PageExpiredException at the last step and the > reported exception in the ticket when stopping the app > With the fix there are no exceptions at all and clicking on any tab works > just like there was no restart. > > > On Fri, Mar 18, 2011 at 7:19 PM, Igor Vaynberg <igor.vaynb...@gmail.com>wrote: > >> even if it were a singleton, some containers will load spooled >> sessions on startup before the filter is initialized, thus even the >> singleton would be not yet there. >> >> -igor >> >> On Fri, Mar 18, 2011 at 11:17 AM, Pedro Santos <pedros...@gmail.com> >> wrote: >> > PersistentPageManager$SessionEntry is the serializable piece of Wicket >> > inside the servlet session, IMO it should serialize/deserialize >> regardless >> > of the Wicket lifecycle. Can the DefaultPageStore be changed to be a >> > singleton an not a per application instance? >> > >> > On Fri, Mar 18, 2011 at 12:42 PM, Igor Vaynberg < >> igor.vaynb...@gmail.com>wrote: >> > >> >> i would say that the lack of response shows that people dont care >> >> about a couple more xml lines they have to add to web.xml once and >> >> forget about. >> >> >> >> -igor >> >> >> >> On Fri, Mar 18, 2011 at 7:47 AM, Martin Grigorov <mgrigo...@apache.org >> > >> >> wrote: >> >> > On Thu, Mar 17, 2011 at 10:54 PM, Martin Grigorov < >> mgrigo...@apache.org >> >> >wrote: >> >> > >> >> >> Hi, >> >> >> >> >> >> To solve https://issues.apache.org/jira/browse/WICKET-3470 we need >> to >> >> >> introduce ServletContextListener in Wicket. >> >> >> In comment >> >> >> >> >> >> https://issues.apache.org/jira/browse/WICKET-3470?focusedCommentId=13008166&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13008166Idescribeda >> proposal how we can change web.xml configuration to make it >> >> >> working. The proposal is based on a discussion between me and Igor >> in >> >> IRC. >> >> >> >> >> >> This is a rather big change and we need more opinions, so please >> share >> >> if >> >> >> you have ideas. >> >> >> >> >> > >> >> > By "big" here I mean conceptually, not code wise. Technically it >> doesn't >> >> > seem to be big or complex. >> >> > >> >> >> >> >> >> --martin-g >> >> >> >> >> >> P.S. I'm interested to understand why there is no such problem with >> >> Wicket >> >> >> 1.4? >> >> >> I guess sessions in 1.4 are cleared earlier and never persisted >> between >> >> web >> >> >> container restarts. >> >> >> >> >> >> -- >> >> >> Martin Grigorov >> >> >> jWeekend >> >> >> Training, Consulting, Development >> >> >> http://jWeekend.com <http://jweekend.com/> >> >> >> >> >> >> >> >> > >> >> > >> >> > -- >> >> > Martin Grigorov >> >> > jWeekend >> >> > Training, Consulting, Development >> >> > http://jWeekend.com <http://jweekend.com/> >> >> > >> >> >> > >> > >> > >> > -- >> > Pedro Henrique Oliveira dos Santos >> > >> > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com <http://jweekend.com/> > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>