Bug 53492

Summary: Make JspC shell multithreaded
Product: Tomcat 7 Reporter: Dan Fabulich <dan>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement CC: marc.pompl
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   
Attachments: patch
patch

Description Dan Fabulich 2012-07-01 07:20:32 UTC
Created attachment 29016 [details]
patch

Jasper works great multi-threaded. Using two threads per core substantially improves throughput on my test machine, reducing the time it takes to build from 9 minutes to 2 minutes.

The attached patch adds a new -threadCount command-line argument to JspC, as well as a setThreadCount setter, suitable for use in an Ant task. It accepts a positive integer, or a core factor like "2.0C" which means two threads per core. 2.0C is the default.

Note that on my machine it didn't help that much unless JspC was also configured to -compile the classes.

I've attached a patch.
Comment 1 Dan Fabulich 2012-07-01 07:21:16 UTC
Created attachment 29017 [details]
patch

Bugzilla screwed up the mime type; trying again
Comment 2 Dan Fabulich 2012-07-01 07:22:55 UTC
I'd love to have this backported to Tomcat 7 as well. The patch should apply cleanly to the 7.0.x branch.
Comment 3 Mark Thomas 2018-07-02 20:41:46 UTC
Sorry it took so long.

Fixed in:
- trunk for 9.0.11 onwards
- 8.5.x for 8.5.33 onwards
- 7.0.x for 7.0.91 onwards
Comment 4 Mike Bryant 2018-09-04 19:55:16 UTC
I have found that if more than one thread is being used in 8.5.33 then the XML fragment that is created from an ant task can be corrupted. For example, there are multiple <servlet-class> elements for a <servlet> and they are empty. Sometimes there is a <servlet-class></servlet-name> element too.
Comment 5 Mark Thomas 2018-09-04 20:31:48 UTC
See bug 62662
Comment 6 Mike Bryant 2018-09-04 20:47:17 UTC
Thanks for adding that 62662 comment, Mark. My searching did not uncover it and it's nice to reference it here!