Hi,
In order to support non-admin installs of our product we're in the process of converting a Java based Windows service into a "normal" executable (what you call "Graphical User Interface" as Type under Java Products). Thinks have worked great so far but we've run into an issue with restarts of the application.
When there's an update available the process needs to restart (we've implemented our own auto update functionality because we needed some features not available AI). To restart itself in a graceful manner the process launches a bat-script which shuts down the process and starts a new one. When it was a service this was fairly straight forward:
net stop Degoo
:retry
timeout 3
net start Degoo
IF NOT %errorlevel%==0 GOTO RETRY
I.e. it shutdown the service and then try to start it again until it succeed. The shutdown happened gracefully via the stop() method which your service wrapper calls.
Unfortunately we've been unable to find a way to gracefully do the same thing for a "normal" executable. The problem is the graceful shutdown. We've tried taskkill /im DegooBackgroundService.exe but this gives us the following error message: "This process can only be terminated forcefully (with /F option)". Terminating the process forcefully is not an option for us because we would then risk losing data.
How do we gracefully shutdown the process when it's running as a normal executable and not as a service?
Thanks in advance!
FOLLOW US
Get the latest news in Application Packaging