[ 
https://issues.apache.org/jira/browse/DAEMON-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13798972#comment-13798972
 ] 

antonio castellón edited comment on DAEMON-306 at 10/18/13 10:06 AM:
---------------------------------------------------------------------

The issue only happens when the service is installed as a JAVA not as a JVM ( I 
attached a complete simple project to test it).

I created batch files into the dist folder to execute the service installation, 
unisntallation, start and stop calls. 

for example into the install-service.bat (it contains the installation, start 
and configuration to be restarted automatically if something wrong happens)

{code}
set SERVICE_NAME=Daemon-Example
set PR_TEMP=C:/logs
set JAVA_EXECUTION_SERVICE_MODE=0
set INSTALL_FOLDER=C:\DEV\test\my-daemon-example\dist
set JAR_FILE=my-daemon-example-1.0-SNAPSHOT-jar-with-dependencies.jar
set PR_CLASS=com.antonio.castellon.App
set PR_INSTALL=C:\DEV\test\my-daemon-example\dist\prunsrv.exe 
{code}

In this case, to test the installation as a JAVA needs to change the variable 
JAVA_EXECUTION_SERVICE_MODE to 1

When is executed as JVM all is fine (it's automatically restarted), but when it 
is executed as JAVA, then the application finalize but the service is not 
restarted.



was (Author: antonio.castellon):
The issue only happens when the service is installed as a JAVA not as a JVM ( I 
attached a complete simple project to test it).

I created batch files into the dist folder to execute the service installation, 
unisntallation, start and stop calls. 

for example into the install-service.bat

{code}
set SERVICE_NAME=Daemon-Example
set PR_TEMP=C:/logs
set JAVA_EXECUTION_SERVICE_MODE=0
set INSTALL_FOLDER=C:\DEV\test\my-daemon-example\dist
set JAR_FILE=my-daemon-example-1.0-SNAPSHOT-jar-with-dependencies.jar
set PR_CLASS=com.antonio.castellon.App
set PR_INSTALL=C:\DEV\test\my-daemon-example\dist\prunsrv.exe 
{code}

In this case, to test the installation as a JAVA needs to change the variable 
JAVA_EXECUTION_SERVICE_MODE to 1

> Service is not restarted when the exit code is non-zero
> -------------------------------------------------------
>
>                 Key: DAEMON-306
>                 URL: https://issues.apache.org/jira/browse/DAEMON-306
>             Project: Commons Daemon
>          Issue Type: Bug
>          Components: Procrun
>    Affects Versions: 1.0.15
>         Environment: Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
> Windows Server 2008 R2 Standard
> service created and configurated with automatic restart service as:
> {code}
> sc failure %SERVICE_NAME% reset= 30 actions= 
> restart/5000/restart/10000/restart/60000
> {code}
>            Reporter: antonio castellón
>         Attachments: my-daemon-example.zip
>
>
> I have a Java application that internally contains a throws, whe it success 
> it trace and ends the application using:
> {code} System.exit(-1); {code}
> or
> {code} System.exit(1); {code}
> The service is not automatically restarted, I suppose that the procrun 
> application catch correctly the exit from the java application, but it looks 
> that not inform correctly to the Services Manager from the O.S.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to