[
https://issues.apache.org/jira/browse/MNG-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17251638#comment-17251638
]
Delany commented on MNG-4738:
-----------------------------
How can I see the default/effective value of maven.artifact.threads?
Changing the value in settings or from command line seems to have no effect on
the rate of resolution.
> DefaultArtifactResolver forks non-daemon threads
> ------------------------------------------------
>
> Key: MNG-4738
> URL: https://issues.apache.org/jira/browse/MNG-4738
> Project: Maven
> Issue Type: Bug
> Components: Embedding
> Affects Versions: 3.0-beta-1
> Environment: Ubuntu Lucid, JDK 6u21
> Reporter: Jesse N. Glick
> Assignee: Benjamin Bentmann
> Priority: Minor
> Fix For: 3.0-beta-2
>
> Attachments: MNG-4738-hanzelm.diff, MNG-4738-hanzelm2-reformat.diff,
> MNG-4738-hanzelm2.diff, MNG-4738.diff
>
>
> I am working on embedding Maven 3 (beta 1). I ran into a problem with Maven
> execution hanging at the end.
> When we run a "process" in-VM, we try to emulate a forked Java as much as is
> reasonable. A new thread group is created, whatever work needs to be done is
> done from a new thread in that group, and then we wait for the "process" to
> end by checking that all non-daemon threads in the group have exited.
> In the case of Maven execution, typically DefaultArtifactResolver is called
> at some point. By default, this creates a ThreadPoolExecutor with 5
> non-daemon threads in it (which are created inside the thread group of the
> caller). Although all tasks are certainly completed by the end of the Maven
> run, these 5 threads remain alive, and so the thread group cannot be
> considered dead.
> It seems to me that DefaultArtifactResolver is at fault here. It should not
> be spawning non-daemon threads. Although it shuts down the executor upon
> being finalized, there is no guarantee of this happening in a timely manner.
> Since the tasks being run in the threads are only active within the dynamic
> scope of calls to resolve, it should be safe to mark the executor threads as
> daemon. I would be happy to supply a patch incl. test case if you agree with
> the premise.
> The workaround is to set maven.artifact.threads=1 before starting Maven
> execution, so that no threads need be spawned at all.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)