Changeset 12310


Ignore:
Timestamp:
2006-07-27T13:52:26+12:00 (18 years ago)
Author:
davidb
Message:

Minor mods to Gatherer exit code to allow -- for the Windows case -- GLI
to restart in a different interface language. Windows case complicated
by threads used to monitor the external applications that have been launched
and still running.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r12225 r12310  
    7474
    7575    /** Has the exit flag been set? */
     76    static final public int EXIT_THEN_RESTART= 2;
    7677    static public boolean exit = false;
     78    static public int exit_status = 0;
    7779
    7880    static private String gli_directory_path = null;
     
    496498     * @see org.greenstone.gatherer.gui.GUIManager
    497499     */
    498     static public void exit(int exit_status)
     500    static public void exit(int new_exit_status)
    499501    {
    500502    DebugStream.println("In Gatherer.exit()...");
    501503    exit = true;
     504    if (new_exit_status != 0) {
     505        // default exit_status is already 0
     506        // only remember a new exit status if it is non-trivial
     507        exit_status = new_exit_status;
     508    }
    502509
    503510    // Save the file associations
     
    876883        // Call exit if we were the last outstanding child process thread.
    877884        if (apps.size() == 0 && exit == true) {
    878         System.exit(0);
     885        // In my opinion (DB) there is no need to exit here,
     886        // the 'run' method ending naturally brings this
     887        // thread to an end.  In fact it is potentially
     888        // dangerous to exit here, as the main thread in the
     889        // Gatherer class may be stopped prematurely.  As it so
     890        // happens the point at which the ExternalApplication thread
     891        // is asked to stop (Back in the main Gatherer thread) is after
     892        // various configuration files have been saved.
     893        //
     894        // A similar argument holds for BrowserApplication thread below.
     895        System.exit(exit_status);
    879896        }
    880897    }
     
    957974        // Call exit if we were the last outstanding child process thread.
    958975        if (apps.size() == 0 && exit == true) {
    959         System.exit(0);
     976        System.exit(exit_status);
    960977        }
    961978    }
  • trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java

    r12225 r12310  
    794794
    795795        if (restart_required) {
    796         Gatherer.exit(2);
     796        Gatherer.exit(Gatherer.EXIT_THEN_RESTART);
    797797        }
    798798    }
Note: See TracChangeset for help on using the changeset viewer.