You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by re...@neovera.com on 2005/05/04 15:37:39 UTC

Any holes in my Wizard pattern?

Hi there --

I've got a number of pages that are involved effectively in a multi-page form. 
These pages all inherit from the same base class -- the base class being a class
containing common methods necessary to all pages in this multi-page form flow.

Each page needs to be passed the "same" data object and attributes of this data
objects will get updated on each page in the flow.  This data object is
serializable and is stored in a hidden field on each page.  Just before the next
page in the flow is activated on the cycle, the data object is set on that next
page as a page property.

To simplify the setting of this object (in reality there are a few objects that
need to be passed to the subsequent page), I created an activate(MyBasePage
pCurrentPage) method on the pages' base class which will read the property from
the current page and set the data object on the page that's about to be
activated.  The method then calls pCurrentPage.getRequestCycle.activate(this).  

My question is -- does anyone see a problem with this?  I was just concered that
the method might not exit until the next page is rendered which I suppose could
lead to some scalability issues under heavy user load.  I have set the
pCurrentPage reference to null before calling activate to try to ensure that the
page can be returned to the pool and/or garbage collected, but I was just curious
if there might be any other issues with doing what I'm doing -- just to be on the
safe side. 

So here is my activate method on the pages' base class

    public void activate(MyPage pCurrentPage)
    {
        // set the data the page needs to matain
        this.setMyData(pCurrentPage.getMyData());
        this.setMyOtherData(pCurrentPage.getMyOtherData());
        
        IRequestCycle cycle = pCurrentPage.getRequestCycle();

        // setting page reference to null in case page can't be returned to pool 
        // and/or garbage collected if this method holds a reference to the page -- 
        // i simply dont know how much longer it will take for the method to exit 
        // once we call activate on the cycle (worst case not until the next page
        // fully renders?)
        pCurrentPage = null;
        
        // activate this page on the request cycle
        cycle.activate(this);
    }

Thanks,

Reid




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Any holes in my Wizard pattern?

Posted by Kent Tong <ke...@cpttm.org.mo>.
 <reid.badgett <at> neovera.com> writes:

> My question is -- does anyone see a problem with this?  I was just concered 
> that
> the method might not exit until the next page is rendered which I suppose 
> could
> lead to some scalability issues under heavy user load.  

No. The cycle.activate() method will exit almost immediately.
It just remembers that "this is the next page to render".
The actual rendering will occur after your listener is 
returned.






---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org