Results 1 to 10 of 10

Thread: exiting a spring rich application

  1. #1

    Cool 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.

  2. #2

    Default

    anyone have an idea on how to close a spring rich app without exiting the JVM?

  3. #3
    Join Date
    Feb 2006
    Posts
    8

    Default

    any hints? I meet the same problem.

  4. #4
    Join Date
    Feb 2006
    Posts
    118

    Default Don't instantiate it, exec it

    Use Runtime.exec to create the app, and then System.exit() will not terminate your own application.

  5. #5

    Default

    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.

  6. #6
    Join Date
    Aug 2004
    Location
    San Francisco
    Posts
    423

    Default

    How about creating your own version of Application that override close to do whatever you want?

    Jonny

  7. #7

    Default

    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.

  8. #8
    Join Date
    Aug 2004
    Location
    San Francisco
    Posts
    423

    Default

    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?

    Jonny

    Quote Originally Posted by agent613
    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.

  9. #9

    Default

    Well, I think I've fixed it.

    All you need to do is in Application.close(), line 199, replace:

    System.exit(0);

    with:

    SOLE_INSTANCE = null;

  10. #10
    Join Date
    Jul 2006
    Location
    Canterbury, UK
    Posts
    22

    Default

    Hi ya,

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •