commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <>
Subject Re: Commons daemon - stop the service
Date Thu, 31 May 2012 18:15:53 GMT
On 05/31/2012 07:53 PM, James Wang wrote:
> Thanks for the comments.
> I set both start mode and stop mode to JVM.


> What will happen when a thread needs 20 more minutes to complete its job?

Well for something like that procrun is not the toolkit to use.
First of all, if you need to frequently start/stop service why using
the service at the first place?
The sole purpose of service concept is to start the application
at boot mode or on demand and to start them in correct order.

Then there is absolute limit which OS imposes on the service
shutdown timeout, and this is for all services on the system,

So the only clean solution is that your shutdown code does
the actual cleanup causing the clean exit.

By spec, JVM won't exit if you have non-daemon threads running,
so if you cant make them exit, then the only solution is
System.exit, which calls OS process _exit() which causes
the SCM to think service failed.

Also you should design your application differently for
service and command line mode.

Procrun does not need to call the main() method.
Take a look at Tomcat. We call Bootstrap start/stop methods
and main() calls Bootstrap.start (after setting correct mode)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message