Hi Mark, the rationale behind "initialising" after use is aiming for minimal response time, I think: When a page is needed for a request it's always ready, properly initialised. Then, after the response is rendered, and the user is happily watching it, the cleanup is done in the background - thus not blocking any thread that does something for the user. That's a good thing, most of the time, I think. If you really need the value from right when the request comes in, you'll have to override pageBeginRender(), or implement the getter yourself as Ron proposed.
-----Original Message----- From: Mark [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 31, 2006 6:22 PM To: Tapestry users Subject: Re: List loaded twice from DB Hi Marcus, Ok, I start to understand now. Are you sure that under production settings (with cache turned on) it will re-initialize the property when the page is put back in the pool, and not when it is checked out of the pool? I understand the thing about "putting a pristine instance of the page back to the pool" so that no data of one user gets carried over to another user, but if the list is loaded when it is returned to the pool it may be outdated by the time the page is used the next time. Thanks, MARK Schulte Marcus wrote: do you have caching disabled? I suspect the following? Tap inits your prop 1. whenever your page is built from the spec/template 2. whenever it's put back into the pool after use. With caching disabled 1. and 2. will occur in each request-cycle. With production settings, 1 *and* 2 will only occur in the first cycle, subsequent cycles will only have 2. btw: I don't disable caching anymore since I discoved the invaluable reset-Service -----Original Message----- From: Mark [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] Sent: Wednesday, May 31, 2006 7:28 AM To: Tapestry users Subject: Re: List loaded twice from DB Hi Ron, it sounds like this would work, but isn't this just a workaround for something that really should not happen this way in the first place? Thanks, MARK Ron Piterman wrote: just an idea: try to implement the 'roomlist' property yourself, as I described in my previous postings, instead of letting tapestry do it. may be this will help. don't forget to implement a pageDetachListener which sets the property to null. I always had good experience when doing it like this. Cheers, Ron Mark wrote: Hi Ron, I don't understand what you mean by "instead of doing it on finishLoad()". I did not do anything with finishLoad(), I don't know why it calls the getList. Here is my .page file: <page-specification class="com.mark_arnold.sample.rbs1.web.tapestry.page.admin.Roo mListPage"> <inject property="administrationService" object="spring:rbsRoomAdminService" /> <inject property="pageService" object="engine-service:page"/> <inject property="messageResource" object="spring:applicationContext"/> <property name="roomList">ognl:administrationService.getAllRooms()</property> <property name="debug">true</property> <property name="room"/> <property name="editPageName" initial-value="literal:admin/RoomAdminPage"/> </page-specification> My Page class extends BasePage, but only overwrites pageAttached() (nothing related to the list in here). MARK Ron Piterman wrote: use lazy initialization for the list instead of doing it on finishLoad() : public List getXXXList() { if (this.xxxList == null ) this.xxxList = readXXXList(); return this.xxxList; } + pageDetachListener -> this.xxxList = null. Cheers, Ron Mark wrote: Hi, I have a simple CRUD scenario with a "ListPage" and a "ModifyPage". The ListPage gets all records from the DB by calling the method "getAllRooms()" of a "RoomAdminService" and lists them in a table. For some reason the query "select * from rooms" is executed twice every time the page is accessed. getAllRooms() is only referenced once in the .page file to plug a page property, the .html file then references that property I compared the StackTraces of the two calls, they have identical tops and bottoms, but differ somwhere in the middle: at $RoomListPage_3.finishLoad($RoomListPage_3.java) at org.apache.tapestry.pageload.PageLoader.constructComponent(Pag eLoader.java:439) at org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:613) at $IPageLoader_10b79e6e7bf.loadPage($IPageLoader_10b79e6e7bf.java) at $IPageLoader_10b79e6e7c0.loadPage($IPageLoader_10b79e6e7c0.java) at org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:120) at $IPageSource_10b79e6e724.getPage($IPageSource_10b79e6e724.java) at org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle. java:268) at org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:251) at org.apache.tapestry.engine.RequestCycle.activate(RequestCycle. java:609) at org.apache.tapestry.engine.PageService.service(PageService.java:66) at $IEngineService_10b79e6e7af.service($IEngineService_10b79e6e7af.java) at org.apache.tapestry.services.impl.EngineServiceOuterProxy.serv ice(EngineServiceOuterProxy.java:66) and at $RoomListPage_3.pageDetached($RoomListPage_3.java) at org.apache.tapestry.AbstractPage.firePageDetached(AbstractPage .java:452) at org.apache.tapestry.AbstractPage.detach(AbstractPage.java:140) at org.apache.tapestry.pageload.PageSource.releasePage(PageSource .java:147) at $IPageSource_10b79e6e724.releasePage($IPageSource_10b79e6e724.java) at org.apache.tapestry.engine.RequestCycle.cleanup(RequestCycle.java:192) So it seems like the first call comes out of the finishLoad(), while the second call is caused by pageDetached() of my ListPage. Does anybody know why it would access the getAllRooms() twice? Thanks, MARK --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]