Rafal Krzewski wrote:
> 
> Santiago Gala wrote:
> 
> > Wouldn't it be better to mark all Threads started for Turbine like
> > daemon threads using setDaemon()?
> >
> > In this way, the VM could stop without hard measures like hitting CTRL-C
> > or calling exit().
> >
> > I don't know if it could bring any problem, but it looks simple to add a
> > setDaemon call to any service as it is started. Is it a bad idea?
> 
> This sounds like an excelent idea to me. WebMacro is outside of our
> control
> but the threads spawned by Turbine could use it right away.
> 
> I just made a quick grep -r that revealed a number of threads that may
> be started by Turbine:
> 
> GlobalCacheService (for items expiry/refresh)
> TurbineSchedulerService has its own thread, and also spawns
> WorkerThreads
> (the WorkerThreads should not be treated as daemon threads)
> IDBroker uses a thread
> LargeSelect class performs some operation in a separate thread, but it
> should be treated as user thread rather than daemon.
> 
> I'm +1 to making the threads of GlobalCache, Scheduler and IDBroker
> daemon threads.
> If there are no voices agains that I'll comit the changes in a few days.
> 

The reason why I care about it is because I have had plenty of problems
trying to have Server applications work like services/daemons, specially
under NT. If the program calls System.exit() it spoils any
logging/post-processing needed after server shutdown. If it exits
cleanly, my stub can wait for the threads to exit and/or kill them after
a timeout.

Having the proper threads as daemons is part of the clean behaviour.
Jdk1.3 also helps with the addShutdownHook() call.

In any case, I would have it as a low priority task. I will also look at
the threads in the Jetspeed Services.

For threads that need a finalization effort, a global shutting var could
be setup, so that they can check it from time to time and exit after
finalization.

> Rafal
> 
> PS. Thanks for the idea Santiago!
> 
> --
> Rafal Krzewski
> Senior Internet Developer
> mailto:[EMAIL PROTECTED]
> +48 22 8534830 http://e-point.pl
> 
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to