Changeset 17548 for gli

Show
Ignore:
Timestamp:
15.10.2008 18:07:39 (11 years ago)
Author:
ak19
Message:

Takes the latest changes to WgetDownload?.pm into account: useWget waits for wget to launch before terminating it upon receiving the STOP message from GLI and will return a message once it has finally been able to kill wget. Based on whether this message was received, DownloadJob? will decide whether to kill the perl process (otherwise it may have to wait for it to terminate naturally).

Files:
1 modified

Legend:

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

    r17525 r17548  
    446446        } 
    447447        if(state == STOPPED) { 
     448        boolean terminatePerlScript = true; 
     449 
    448450        // When GLI is working with wget-based download modes (OAI, MediaWiki and Web download) 
    449451        // and the STOP button has been pressed, wget needs to be prematurely terminated. 
     
    469471                System.err.println("GLI sent STOP signal to perl to terminate wget."  
    470472                           + "\nGot response from perl: " + response); 
     473 
     474                response = clientReader.readLine(); // see whether the perl script is ready to be terminated 
     475                System.err.println("Got another response from perl: " + response); 
    471476                os.close(); 
    472477                 
     
    475480                clientReader = null; 
    476481                clientSocket = null; 
     482                 
     483                if(response == null) { 
     484                terminatePerlScript = false; 
     485                } 
    477486            } catch(IOException ex) { 
    478487                System.err.println("Tried to communicate through client socket - port " + this.port + ", but got exception: " + ex); 
     
    485494        //prcs.getInputStream().close(); 
    486495        prcs.getErrorStream().close(); 
    487         prcs.destroy(); // This doesn't always work, but it's worth a try        
    488         prcs = null; 
     496        if(terminatePerlScript) { 
     497            prcs.destroy(); // This doesn't always work, but it's worth a try        
     498            prcs = null; 
     499        } 
    489500        br.close(); 
    490501        br = null;