commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: [daemon] Can init() be called more than once in a single JVM session?
Date Wed, 29 Nov 2017 15:54:47 GMT
On 29/11/17 11:09, Andrea Lo Pumo wrote:
> Does anyone have an answer?

My expectation is that init() will be call once per JVM but that the
jsvc process may create multiple JVMs (sequentially, not concurrently)
and that init() will be called for each.

If jsvc detects that the JVM has aborted (OOME, crash, etc.) it uses
exit code 123 to signal a restart. You can call System.exit(123); to
achieve the same result.

Any other clean exit will be treated as a normal shutdown and there will
be no restart.



> Best regards.
> 2017-10-23 15:53 GMT+02:00 Andrea Lo Pumo <>:
>> Since now, I have always assumed that init() is called once, and no
>> more. Now I am not sure anymore. My doubt is that init() can be called
>> a second time, after destroy() has been called, for example, if the
>> program is restarted by Jsvc. Is this so? If yes, I should use a
>> static variable "alreadyInitialized" and do nothing in init() if it is
>> true, at least for things that have not to be done more than once.
>> A second question: when does Jsvc restart the program exactly? If I
>> kill the program, or use -stop. It simply stop()s and destroy()s and
>> exits. I have been able to simulate a restart using System.exit(123).
>> Are there other cases when Jsvc restarts the program?

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

View raw message