11-12-2010 06:29 AM
My autostart application has only one entry point and it creates a GUI on startup. The user can terminate the app whenever they want. So no matter it is autostarted or user initiated (re-launched after exiting), it goes through the same chunk of code. If it is user initiated, I need to ignore the autostart flag, so it doesn't call System.exit(0) if false.
Is there any way to tell the difference?
11-12-2010 07:16 AM
use two entry points
12-01-2010 11:48 AM
The problem with alternate entry points is that you can hardly terminate the background process (and make it possible to be restarted).
I want to do the following:
-Startup, system module started
-Alternate entry point entered - launch GUI, system module already running
-(!) Exit, both processes killed
-Alternate entry point entered - (!) System module not running, start system module, then launch GUI (not possible because you will need to enterEventDispatcher() twice?)
In this case, should I just call close() on the GUI component so the icon disappears, giving the illusion it is closed? (Will also need to unregister some listeners too)
12-01-2010 12:21 PM
why do you want to restart the background process? it is possible, of course, to do so, for example by posting a global event and calling System.exit on reception in the process.
you can run an alternate entry point process by using the correct applicationdescriptor in applicationmanager.
would be easier to cease processing though and just resume it on event reception.
i usually just put my GUI to the background or ask the user about it.
i am not concerned about my background processes running, they usually have a very low footprint.