From: Christopher Oliver [mailto:[EMAIL PROTECTED] 

> Reinhard Pötz wrote:
> 
> >From: Jeremy Quinn
> >
> >  
> >
> >>What I do not grok ATM, how does the Hibernate Session automatically
> >>get closed at the appropriate time (ie. after the view layer has 
> >>completed)?
> >>    
> >>
> >
> >IIU the current flow implementation correctly you have no 
> chance but to 
> >use lazy initializiation as implemented by you because after reaching
> >sendPageAndWait() the flow interpreter has no chance to 
> react. Maybe we 
> >need something like a "finalize" in pipeline processing where those 
> >things (releasing of components) are done.
> >
> >HTH
> >Reinhard
> >
> >
> >  
> >
> Actually, although not particularly user-friendly, there is a 
> way to do 
> this, even now, with the extended "catch" syntax supported by Rhino 
> (which is intended to provide functionality similar to 
> "dynamic-wind" in 
> Scheme):
> 
> 
> var hibSession = null;
> 
> function getSession() {
>     if (hibSession == null) {
>         hibSession = cocoon.getComponent("hibernateSession");
>     }
> }
> 
> function releaseSession() {
>      if (hibSession != null) {
>           cocoon.releaseComponent(hibSession);
>           hibSession = null;
>      }
> }
> 
> catch (break) {
>           // a continuation is being captured,  
>           // code to handle that goes here
>          releaseSession();
> }

... and this is called after the pipeline has been processed? How is
this possible from a technical POV? If the view layer is called by
sendPageAndWait the flow interpreter isn't active until the response
returns from the client (map:call continuation="...").

Reinhard

> 
> catch (continue) {
>          // a continuation is being restored
>          // code to handle that goes here
> }
> 
> function myFlow() {
>      var custBean = getSession().blah;
>      sendPageAndWait("cust.xml", custBean);
>      var anotherBean = getSession().blahblah
> }
> 

Reply via email to