Subject: [xsl] XSL with multiple-threaded architecture..?? From: "Kevin Duffey" <kevin.duffey@xxxxxxxx> Date: Mon, 26 Feb 2001 23:33:44 -0800 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Using xsl:include when conver, Tim Watts | Thread | RE: [xsl] XSL with multiple-threade, Michael Kay |
[xsl] Using xsl:include when conver, Tim Watts | Date | Re: [xsl] Concat ( Again ), Eric van der Vlist |
Month |