Christopher Oliver wrote:
You can release components after sendPage(). It doesn't block.

How about adding an additional function parameter to sendPageAndWait()? In the supplied function you can provide code that will execute _after_ the pipeline is executed:

var comp = cocoon.getComponent(id);
...
cocoon.sendPageAndWait(uri, bizData, function() {
   cocoon.releaseComponent(comp);
   comp = null;
});

Here's the new implementation of sendPageAndWait()

FOM_Cocoon.prototype.sendPageAndWait = function(uri, bizData, fun) {
   this.sendPage(uri, bizData, new Continuation());
   if (arguments.length > 2) {
     fun();
   }
   FOM_Cocoon.suicide();
}

Regards,

Chris

+1, like it a lot.


-marc=


Tim Larson wrote:


I was talking with <tonyc> on #cocoon trying to figure out
if/when/how components needed to be released in flowscripts,
and we realized the docs need to be more enlightening.

Here is what we wrote so far:
All components obtained via getComponent must be explicitly
released via releaseComponent() in your flowscript before
calling sendPage() or sendPageAndWait(), otherwise a memory
leak will occur.  If these components have given you any
other components (such as a Source), they must be released
before the parent component is released.

We think this is overstating the releasing requirements for
sendPage().  Anybody want to help us improve this?

I would also like to put a simple example in the docs,
something like:
 function someFunction() {
     var resolver = cocoon.getComponent(..);
     var source = resolver.resolveURI(..);
     // Insert code here that uses source.
     resolver.release(source);
     cocoon.releaseComponent(resolver);
     cocoon.sendPage(..);
 }

Where in the docs/javadocs/wiki should all of this go?

--Tim Larson


__________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus






-- Marc Portier http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center Read my weblog at http://blogs.cocoondev.org/mpo/ [EMAIL PROTECTED] [EMAIL PROTECTED]



Reply via email to