Sandeep,
Sorry, but the Wrapper does not currently exit with the correct exit
code. I added
a feature request for this last month and try to get it into the Wrapper
for a near future
version. You might want to monitor the feature request so you will get
notifications
on its progress.
http://sourceforge.net/tracker/index.php?func=detail&aid=852491&group_id=39428&atid=425190
One alternative for you would be to write a simple utility class
which you specify
as the main class (Ie the first parameter to WrapperSimpleApp) It
would start by
calling the WrapperManager.getJVMId() method to find out which
invocation number
the JVM was. If it is < 4 then call you real application's main
method. Otherwise
call a method that executes SendMail and then calls System.exit().
Alternatively you
could make use of the Java Mail API rather than using SendMail. It is
quite easy to
use.
I am also working on another feature that will allow you to run
arbitrary external
programs in response to various events in the Wrapper life cycles. Some
users have
needed this functionality so they could, for example, run an application
after a JVM
crashes, but before a new one is launched. I was planning to have
events for the
startup and shutdown of the Wrapper as well. This feature is still in
the design phase
so if you have any requirements you would like me to consider, go ahead
and post them.
http://sourceforge.net/tracker/index.php?func=detail&aid=837037&group_id=39428&atid=425190
Cheers,
Leif
Sandeep Khanna wrote:
>Hi All,
>
>We have been using Java Service Wrapper for the past several months to
>run a couple of Java programs as Windows services.
>
>Our current requirement needs us to use the Windows "service recovery
>options". In the Properties page of a service one can set 3 different
>actions to take when a service fails to start for 3 consecutive times.
>We needed this to be able to execute a restart the first 2 failures and
>execute a command-line SendMail.exe to send mail to support on the 3rd
>failure.
>
>Unfortunately, my investigation has revealed that the Java Service
>Wrapper does not return an exit code to the Windows Service manager to
>trigger the service recovery settings. I even tried using the 3
>integration technique as mentioned on the website, but to no success!
>
>Can somebody comment if this is possible using Java Service Wrapper and
>it's current feature set and/or I am missing something here?
>
>If YES, please explain how?
>If NO, please suggest alternatives?
>
>Thanks in advance,
>Sandeep Khanna
>
>
|