Andreas Sewe created SUREFIRE-830:
-------------------------------------

             Summary: Provide sensible default if threadCount undefined (for 
example Runtime.getRuntime().availableProcessors())
                 Key: SUREFIRE-830
                 URL: https://jira.codehaus.org/browse/SUREFIRE-830
             Project: Maven Surefire
          Issue Type: Improvement
          Components: process forking
    Affects Versions: 2.12
         Environment: Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)

            Reporter: Andreas Sewe


Currently, when using {{forkMode=perthread}} with an undefined {{threadCount}} 
one gets an {{IllegalArgumentException}}:

{quote}
Caused by: java.lang.IllegalArgumentException
        at 
java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1275)
        at 
java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1163)
        at 
org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:142)
        at 
org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:122)
        at 
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:199)
        at 
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAllProviders(AbstractSurefireMojo.java:176)
        at 
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:135)
        at 
org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:98)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        ... 20 more
{quote}

Not only is this not an easy-to-read error message, but this also is somewhat 
unnecessary as, in the absence of an explicit value for {{threadCount}}, there 
is still a very sensible default: 
{{Runtime.getRuntime().availableProcessors()}}.

Having such a default would avoid hard-coding the number of threads to use in 
the POM (where it doesn't really belong, as a good value changes from machine 
to machine) or setting it explicitly using {{-DthreadCount}} on the command 
line (where it's just inconvenient).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to