I think Maven executes a System.exit at the end, which will terminate all
threads, regardless of daemon state.

With regards,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Thu, Oct 29, 2009 at 1:09 PM, James Russo <j...@halo3.net> wrote:

> Hello,
>
> Actually it is the other way around. Daemon threads will not hold up JVM
> from exiting, but non-deamon threads will.
>
> "Marks this thread as either a daemon thread or a user thread. The Java
> Virtual Machine exits when the only threads running are all daemon threads."
>
> The daemon flag will be set if the creating thread is a daemon thread.
> Maybe force the setDaemon to false on the newly created thread and that may
> give you desired effect.
>
> -jr
>
>
> Brian Fox wrote:
>
>> Maven just exits when it's done and then the jdk pulls everything
>> down. Isn't there a flag you can set on a thread to mark it as a
>> daemon thread, and then the system waits before killing it?
>>
>> On Wed, Oct 28, 2009 at 9:20 AM, Gajo Csaba <csaba.g...@cosylab.com>
>> wrote:
>>
>>
>>> Good idea! I was actually hoping there was some switch I can set in Maven
>>> to
>>> tell it not to terminate my thread, but I guess your idea would work fine
>>> as
>>> well. Thanks!
>>> Csaba
>>>
>>>
>>> Stephen Connolly wrote:
>>>
>>>
>>>> add a second goal
>>>>
>>>> the first goal will store some thread completion object in MavenSession
>>>> or
>>>> in a Class level static field
>>>>
>>>> When all threads are finished the completion object will be updated by
>>>> the
>>>> last thread
>>>>
>>>> The second goal blocks until the completion object is completed.
>>>>
>>>> Then add the second goal execution to your project at the appropriate
>>>> phase
>>>> where you need the execution to have completed...
>>>>
>>>> for example if you start the threads in the process-sources phase, you
>>>> might
>>>> be happy to let them run in the background until the test phase has
>>>> completed, but they must be finished by the time the package phase runs,
>>>> so
>>>> I would bind your execution of the second goal to the test phase
>>>>
>>>> -Stephen
>>>>
>>>> 2009/10/28 Gajo Csaba <csaba.g...@cosylab.com>
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>>> For additional commands, e-mail: users-h...@maven.apache.org
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to