Ignore:
Timestamp:
2017-05-31T18:05:11+12:00 (7 years ago)
Author:
ak19
Message:

Two more instances in GLI's Gatherer.java were using Java's Process instead of going through SafeProcess. I had a note in the tickets about this, but it was obscured by being an item in my todo list that was ticked off, because I hadn't originally intended to change these 2 instances to use SafeProcess, because SafeProcess didn't have a cancel feature back then. With the recent addition of the cancel feature, the changes became straightforward. Both remaining instances in Gatherer have been changed to use SafeProcess and it's tested on Linux. Updated the SafeProcess README.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/util/SafeProcess.java

    r31716 r31718  
    163163     * This method returns a boolean that you can call sentInterrupt. 
    164164     */
    165     public boolean cancelRunningProcess() { 
     165    public boolean cancelRunningProcess() {
    166166
    167167    boolean forceWaitUntilInterruptible = true;
     
    922922    */
    923923   
    924     if(pid == -1) {
     924    if(pid == -1) { // if the process has already terminated, or we can't get the pid for any reason:
    925925        p.destroy(); // at minimum. Will have no effect if the process had already terminated
    926926    } else {
     
    930930        if(!killUnixProcessWithID(pid, !forceKill, killEntireProcessTree)) { // send sig TERM (kill -15 or kill -TERM)
    931931        killUnixProcessWithID(pid, forceKill, killEntireProcessTree); // send sig KILL (kill -9 or kill -KILL)
    932         }       
     932        }
     933        // if both kill commands failed for whatever reason, can still at least end the top level process:
     934        p.destroy(); // no effect if the process has already terminated.   
    933935    }
    934936   
Note: See TracChangeset for help on using the changeset viewer.