Hi all,

I'm currently working on a publication application with complex database queries where we want to prefetch some of the pages linked to by the page currently being produced, in order to speed up response time on pages that are likely to be asked for by users.

To achieve this, we have a "PrefetchTransformer" that grabs elements having a prefetch="true" attribute and starts a background job to load the corresponding "src" or "href" URL using a "cocoon:".

At first I used JobScheduler.fireJob() to schedule for immediate execution, but went into *weird* bugs with strange NPEs all around in pipeline components. After analysis, it appeared that while the scheduler thread was processing the pipeline, the http thread was recycling the *background environment*, thus nulling the object model and other class attributes used by pipeline components.

I spent the *whole day* trying to find the cause for this, without success (how frustrating).

Then I decided to try another approach and use JobScheduler.fireJobAt(new Date()), meaning "schedule the job for later execution... now!". And it worked!

Weird, weird, weird! Anybody having a hint about why fireJob() is doing this environment mixture?

Sylvain

--
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director

Reply via email to