[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Asynchronous transformation in a (Java) Web app

Subject: Re: Asynchronous transformation in a (Java) Web app
From: Martynas Jusevicius <martynas.jusevicius@xxxxxxxxx>
Date: Sat, 11 Sep 2010 17:37:44 +0200
Re:  Asynchronous transformation in a (Java) Web app
But is creating threads directly from servlets considered a
normal/safe practice?
Some sources on asynchronous servlets I've been reading through
suggest that it is bad (or J2EE non-compliant) design, and provide
more complex solutions, involving JMS for example, like here:
http://www.javaranch.com/journal/2004/03/AsynchronousProcessingFromServlets.h
tml
So I'm confused regarding the implementation of the job queue itself.

On Sat, Sep 11, 2010 at 5:08 PM, Andrew Welch <andrew.j.welch@xxxxxxxxx>
wrote:
> On 11 September 2010 15:02, Martynas Jusevicius
> <martynas.jusevicius@xxxxxxxxx> wrote:
>> Hey list,
>>
>> while asynchronous processing is a broad subject, I hope my question
>> is not off-topic as it applies directly to XSLT.
>>
>> The scenario is pretty simple, and I guess not uncommon: user uploads
>> a (potentially heavy) file, then XSLT transformation(s) process it,
>> and the result is presented back to the user. The program runs as a
>> Java Servlet web application.
>>
>> The problem is, that the transformations can take quite some time, up
>> to one minute for example. Therefore I started looking into ways of
>> running them asynchronously, not blocking the servlet and presenting
>> the result later.
>> I guess I need some kind of thread-based subsystem to run and
>> transform in the background, but my knowledge ends pretty much there.
>>
>> Any advice on approaches/techniques or specific tools/libraries would
>> be appreciated.
>
> In JAXP, the TransformerFactory and the compiled stylesheet (the
> "Templates" object) are both thread safe, but the Transformer is not.
> So for each request create a new thread passing in the source, the
> TransformerFactory, the Templates object and the response writer, then
> create the Transformer in the thread and run the transform (although
> its been a while since did any coding at the servlet level...
> hopefully that's a point in the right direction).
>
>
>
> --
> Andrew Welch
> http://andrewjwelch.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.