Ignore:
Timestamp:
2017-04-06T20:33:36+12:00 (7 years ago)
Author:
ak19
Message:

GS3ServerThread now uses SafeProcess. And moved the code in Gatherer that stopped the GS3 server in the main thread into the GS3ServerThread as a static stopServer method. Hopefully the static is enough to indicate that it is not part of any specific thread other than the main GLI thread.

File:
1 edited

Legend:

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

    r30765 r31583  
    766766            //thread.start();
    767767
    768             try {
    769             String shellCommand = null;
    770             Process p = null;
    771             if (Utility.isWindows()) {
    772                 // cmd /C "cd "C:\path\to\greenstone3" && ant stop"
    773                 p = Runtime.getRuntime().exec("cmd /C \"cd \"" + Configuration.gsdl3_src_path + File.separator + "\" && ant stop\"");   
    774             } else {
    775                 p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "ant stop -f \"" + Configuration.gsdl3_src_path + File.separator + "build.xml\""});
    776             }
    777             // doing a p.waitFor() without processing the Process' IOstreams causes blocking with Java 6
    778             // (i.e. when JRE 6 included with GS binaries). However, p.waitFor() with Java 7 is fine.
    779             /*if(p != null && p.waitFor() == 0) {
    780                 DebugStream.println("********** SUCCESSFULLY stopped THE GS3 SERVER ON EXIT");
    781             }
    782             else {
    783                 System.err.println("********** FAILED TO SUCCESSFULLY stop THE GS3 SERVER ON EXIT");
    784                 //throw new Exception ("Failed to successfully stop the GS3 server on exit.");
    785             }*/
    786             } catch(Exception e) {
    787             System.err.println("Exception when trying to stop the tomcat web server: " + e);
    788             DebugStream.printStackTrace(e);
    789             }
     768            GS3ServerThread.stopServer();
    790769           
    791770        }
Note: See TracChangeset for help on using the changeset viewer.