Mar 1st, 2006, 01:27 PM
exiting a spring rich application
currently, when you exit the last window of an application, application.close() calls System.exit(0). this is a little bit harsh, I think. In my application, the ApplicationLauncher is actually being launched from inside an existing Java application. so, when I close the last spring rich window, it brings down my entire process.
is there perhaps a more elegant way to close down the application such that the process does not exit? I tried just removing the call to system.exit. that works,but I can never instantiate the application again since the Singleton still exists.
thanks in advance for your help.
Mar 6th, 2006, 02:28 PM
anyone have an idea on how to close a spring rich app without exiting the JVM?
Mar 10th, 2006, 12:33 AM
any hints? I meet the same problem.
Mar 10th, 2006, 01:16 AM
Don't instantiate it, exec it
Use Runtime.exec to create the app, and then System.exit() will not terminate your own application.
Mar 10th, 2006, 10:01 AM
thank you for your suggestion.
However, besides the fact that this a hack, my constraints are such that the spring rich application must be running in the same JVM as the application that spawns it as it will be making calls back into objects already loaded.
there needs to be a more elegant way to shut down spring rich.
Mar 10th, 2006, 11:39 AM
How about creating your own version of Application that override close to do whatever you want?
Mar 10th, 2006, 01:31 PM
I can do that. As I said though, I tried to have the application close all the windows without the call to System.exit.
It worked, but I could never start Spring rich again in that JVM. it seems that the problem is that spring rich is not cleaning up after itself but rather relying on the fact that the process is going to be terminated.
what I'm trying to determine it howto fix this so that the JVM is returned to its pre-spring rich state such that calling system.exit is not necessary.
Mar 10th, 2006, 03:52 PM
Got you, I missed that in the first message.
Well, it looks like the close method attempts to close the application context which should clean things up. Maybe the application launcher should be modified to explicitly close out it's references also?
Originally Posted by agent613
Mar 20th, 2006, 03:59 PM
Well, I think I've fixed it.
All you need to do is in Application.close(), line 199, replace:
SOLE_INSTANCE = null;
Aug 9th, 2006, 03:52 AM
I too have same problem. Mine is a stand alone application and program finish the last line but it does not exit JVM.
It looks for some reason spring is not shutting down JVM and holding it.
I am forcing JVM to shut down by using System.exit(0) which is not a elegent way.
I could not understand the above soultion. Can anyone please help me understanding above solution.