• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to thread a really computationally intensive page ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to thread a really computationally intensive page ?


  • Subject: Re: how to thread a really computationally intensive page ?
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 27 Mar 2008 12:48:56 -0700


On Mar 27, 2008, at 12:39 PM, Gavin Eadie wrote:
On Mar 27, 2008, at 3:30 PM, Mike Schrag wrote:
YourPage backgroundPage = ERXApplication.instantiatePage( YourPage.class.getName() );
You MAY want to go the context clone route, or you will lose the original context's headers, which might break links if you need virtual hosting info or whether or not the current request is HTTPS or not.

... actually, even a clone didn't help -- it had to be a new context, note new WOContext(null) below. Since I'm eventually dropping a string into a page with its own original context and not actually making a response any browser will see, I assume a 'null' context works fine since it doesn't get used anyway.
____________________________________


On Mar 27, 2008, at 2:20 PM, Mike Schrag wrote:
We're looking at various options -- improve the Java code, generate the reports off-line as static HTML, etc.
I would recommend probably computing the report in a long response, pushing the results into an intermediate model (not necessarily EO- based, maybe just POJO's) and then render that in your page. I've never tried actually RENDERING a page in a long response, but I suspect it's going to be sort of nasty to get it behaving properly. You should not be using your long response's context if you are -- you should make a new one (or clone your current context). This should be roughly equivalent to the docs for ERJavaMail where it talks about sending component-based emails.

ms

Many thanks, Mike. Your pointer to the notes in the ERJavaMail application was the perfect one -- the answer was there, I needed to provide a new context. Now the code is, in part (all the rest is the same as before):


   @Override
   public Object performAction() {
      logger.info("--> performAction");

WOContext calcCntx = new WOContext(null);
Calc calcPage = (Calc) WOApplication.application().
pageWithName(Calc.class.getName(), calcCntx);
return calcPage.generateResponse().contentString();
}


Other things to note, now I have my sample working.

You CAN render in a long response (at least with the simple HTML below).

The WebObjects parser is really fast! In order to get a page that took about 5 seconds to render, I used:

  <wo:WORepetition count = "200">
    <wo:WORepetition count = "2000">
      <wo:string value="[x]"/> </wo:WORepetition></wo:WORepetition>

and generated 1000 random numbers each time I satisfied the "[x]" binding! That makes me wonder just how awful the code must be in the real application .. as best I know it really can consume over 30 seconds mostly rendering its report.

Are you sure it is not firing faults, one by one by one...


Chuck

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: how to thread a really computationally intensive page ?
      • From: Mike Schrag <email@hidden>
References: 
 >Any way to "know" a "No instance available" has been answered to client? (From: Fabrice Pipart <email@hidden>)
 >how to thread a really computationally intensive page ? (From: Gavin Eadie <email@hidden>)
 >Re: how to thread a really computationally intensive page ? (From: Mike Schrag <email@hidden>)
 >Re: how to thread a really computationally intensive page ? (From: Gavin Eadie <email@hidden>)

  • Prev by Date: Re: how to thread a really computationally intensive page ?
  • Next by Date: Re: how to thread a really computationally intensive page ?
  • Previous by thread: Re: how to thread a really computationally intensive page ?
  • Next by thread: Re: how to thread a really computationally intensive page ?
  • Index(es):
    • Date
    • Thread