Open yvesdm opened 8 years ago
Solution proposed -> see pull request.
Don't know if it is the way you wanted to solve this as I changed the mode java to mode jvm. So open questions are
But I tested on my windows 7, 64 bits, and it works as expected.
Let me know if you have any remarks.
The main reason for java
was to allow running the application as a service under an account without the LogonAsService
privilege. Thanks for the PR, an alternative I was thinking about was to simply fix the documentation to state that start/stop methods don't apply to Windows.
What is your use case for start/stop methods under Windows?
My use case is : run an Apache Camel based application as a windows service. So I have a start method to launch Camel, and another one to stop it.
java
way requires to develop IPC
(inter process communication) as the main
method is called to start and stop the process. It means, one JVM
is launched to start the application,and another JVM
is launched to handle the stop request. We need an IPC
between both of them to notify the first one to shutdown.jvm
way, it starts only one JVM
it means start and stop will executes under the same context, and may use same object instances. It is more easyier in my use case. But you are true, it breaks the feature LogonAsService
. To provide both features (start/stop method
and LogonAsService
, the mode
should became configurable and the doc should be updated. But should be easy to do :)
Regarding the the feature LogonAsService
,
There are 2 options available in procrun
--User
: enables running applications as a service under an account without the LogonAsService privilege--ServiceUser
the name of the account under which the service should runNote : I see both of them are currently available in the capsule daemon.
If we choose for mode JVM, I guess the jvm will run under the user specified in ServiceUser
and then having the same feature.
Do you have any specific use case where an application should be run in Java
mode instead of in JVM
mode ?
No specific use case (yet) but I'd avoid dropping --User
without understanding the consequences, which I don't really understand; also, I can't test on a Windows system right now. Is the matter any clearer to you and do you have a chance of testing your PR with --ServiceUser
with an account lacking the LogonAsService
privilege?
I still think the best solution would be to add a mode
option as you suggested though.
Since the process is started/stopped in Java Mode : see DaemonCapsule.java
and according to the spec of procRun :
It will never works as expected.
Yves.