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/gli/src/org/greenstone/gatherer/util/SafeProcess.java

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