Announcement Announcement Module
Collapse
No announcement yet.
exiting a spring rich application Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    anyone have an idea on how to close a spring rich app without exiting the JVM?

    Comment


    • #3
      any hints? I meet the same problem.

      Comment


      • #4
        Don't instantiate it, exec it

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

        Comment


        • #5
          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.

          Comment


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

            Jonny

            Comment


            • #7
              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.

              Comment


              • #8
                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

                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.

                Comment


                • #9
                  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;

                  Comment


                  • #10
                    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.

                    Comment

                    Working...
                    X