[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] XSL with multiple-threaded architecture..??
Subject: RE: [xsl] XSL with multiple-threaded architecture..?? From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Date: Wed, 28 Feb 2001 03:57:50 -0000 |
Take a look at the SampleServlet.java code issued as a sample with the Saxon download. It's written to use the TrAX API. Mike Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of > Kevin Duffey > Sent: 27 February 2001 07:34 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] XSL with multiple-threaded architecture..?? > > > Hi there, > > I am hoping this can be answered. I want to have my simple > MVC framework > "cache" XSL stylesheets for faster runtime transformation. I > am using this > bit of code in my java application. This happens for EVERY > request coming > in. > > TransformerFactory tFactory = TransformerFactory.newInstance(); > Transformer transformer = tFactory.newTransformer(xslStream); > transformer.transform(xmlStream, new > StreamResult(response.getOutputStream())); > > The problem I am facing is that every request I read in the > XSL from the > file system. I want to pre-load XSL pages when the > application starts, then > apply them to the XML input (via JSP output of xml) upon each > request. Since > Servlets are threaded, I want to make sure the process I use > is thread-safe. > I have devised a simple Hashmap caching scheme where by when > the application > starts, it loads all XSL pages into the Hashmap. I know this > will use a > little bit of memory, but the performance gains should > warrant the use of > more memory (so long as system page swapping doesn't occur). > In general, > unless there are several hundred XSL files loaded, I am > really not worried. > I think each XSL page is between 1K and 20K, and we will > probably have only > a few hundred at most, if that. > > I was about to write some code that read in each file. I then > thought I > could just do something like: > > File f = new File(filename); > StreamSource xslStream = new StreamSource(f); > > Then I could store the xslStream. The problem I see is that I > don't think at > this point the XSL page is read in to memory. So I guess my > question is (for > those that do both Java programming and XSL), how would I > read in the XSL > page into memory BEFORE calling upon the > TransformerFactory.newTransformer(xslStream);?? Is it even possible to > "pre-compile" XSL pages and store that in memory, so that the > process is > merely taking an already pre-compiled XSL page and running it > through the > XSLT engine (Saxon in this case) with the XML input? > > The goals are to cache XSL pages (pre-compiled if possible for best > performance) and make it thread-safe so that multiple > threads/requests can > use the same XSL page. > > Thank you. > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSL with multiple-threaded ar, Kevin Duffey | Thread | Re: [xsl] Using xsl:include when co, Jeni Tennison |
RE: [xsl] Redirecting...Is is possi, Michael Kay | Date | RE: [xsl] Question on subtotaling, Michael Kay |
Month |