Mantis - Resin
Viewing Issue Advanced Details
1352 minor always 09-18-06 09:23 06-18-07 10:11
ferg  
ferg  
normal  
closed  
fixed  
none    
none 3.1.2  
0001352: JSPCompiler multithreaded
(rep by Caleb Richardson)

I have quite a large number of JSPs to precompile, and these JSPs share
many interdependent tag files. I am currently programatically invoking
the JSPCompiler.main() method, my question is whether or not it is safe
to fork multiple threads that in turn call JSPCompiler.main(), each
thread handling a subset of the JSPs.

Presumably JSPCompiler uses the same internal code as on demand JSP
compilation post deployment, so I would expect it to be thread safe with
regard to only compiling a given tag file once, even if it is shared
among many JSPs.

So is this safe, and does JSPCompiler already perform this optimization
on SMP machines by checking Runtime.getAvailableProcessors (or checking
via some other technique)?

Notes
(0002059)
ferg   
06-18-07 10:11   
The JspCompiler API has been refactored. You could use:

JspCompiler compiler = new JspCompiler();
compiler.configureFromArgs(args);

ArrayList<String> pending = new ArrayList<String>();
for (int i = 0; i < filenames.length; i++) {
  compiler.compilePath(pending, filenames[i]);

compile.compileBatch(pending);