commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Wang <>
Subject RE: Commons daemon - stop the service
Date Thu, 07 Jun 2012 18:06:03 GMT
I have played with procrun a bit more and realized that SCM waits for at most two minutes.
After that, it shows a message saying it got no response from the process and displays "stopping"
as status on the service. But when the process finally ends, it shows "stopped" status (you
have to manually refresh the SCM). 
Procrun has a parameter "StopTimeout", which "Defines the timeout in seconds that procrun
waits for service to exit gracefully."  What happens after the timeout period? Does procrun
shut down the JVM?


-----Original Message-----
From: Mladen Turk [] 
Sent: Thursday, May 31, 2012 2:16 PM
Subject: Re: Commons daemon - stop the service

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
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, see

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:

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

View raw message