Changeset 17665 for gli


Ignore:
Timestamp:
2008-10-31T19:27:01+13:00 (15 years ago)
Author:
ak19
Message:

In the case of OAIDownloads, GLI and WgetDownload.pm no longer uses sockets for terminating wget. The original GS2 2.80 did a better job in terminating the multiple wgets launched, by just letting the Java code do a process.destroy() on the perl script which--although it would let the current wget download finish--would not launch further wget instances.

File:
1 edited

Legend:

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

    r17548 r17665  
    230230
    231231    public void callDownload() {
    232    
     232
    233233    ArrayList command_list = new ArrayList();
    234234        if (Utility.isWindows()) {
     
    305305
    306306        // To be able to stop Wget, we use sockets to communicate with the perl process that launched wget
    307         if (!mode.equals("Z3950") && !mode.equals("SRW")) { // wget-based Download modes (OAI, MediaWiki and Web download)
     307        if (mode.equals("Web") || mode.equals("MediaWiki")) { // wget download modes other than OAI
    308308       
    309309        // Need to find an available (unused) port within the range we're looking for to pass it
     
    445445        }
    446446        }
     447
    447448        if(state == STOPPED) {
    448449        boolean terminatePerlScript = true;
    449 
    450         // When GLI is working with wget-based download modes (OAI, MediaWiki and Web download)
    451         // and the STOP button has been pressed, wget needs to be prematurely terminated.
    452         // The presence of the tmpfile will indicate to the perl script that it's time to kill wget.
    453         if(prcs != null && !mode.equals("Z3950") && !mode.equals("SRW")) {
    454            
     450       
     451        // When GLI is working with wget-based download modes other than OAI (MediaWiki and Web
     452        // download) and the STOP button has been pressed, wget needs to be prematurely terminated.
     453        // Only wget download modes Web and MediaWiki require the use of sockets to communicate
     454        // with the perl script in order to get wget to terminate. Other download modes, including
     455        // wgetdownload mode OAI, can terminate in the traditional manner: close process inputstream
     456        // and kill perl process. OAI launches many wgets. So that when the perl process is terminated,
     457        // the currently running wget will finish off but other wgets are no longer launched.
     458        if(prcs != null && (mode.equals("Web") || mode.equals("MediaWiki"))) {
     459
    455460            // create a socket to the perl child process and communicate the STOP message
    456461            Socket clientSocket = null;
     
    494499        //prcs.getInputStream().close();
    495500        prcs.getErrorStream().close();
     501        br.close();
     502        br = null;
    496503        if(terminatePerlScript) {
    497504            prcs.destroy(); // This doesn't always work, but it's worth a try       
    498505            prcs = null;
    499506        }
    500         br.close();
    501         br = null;
    502507
    503508        // Notify the DownloadScrollPane which is waiting on this job to complete that we are ready
Note: See TracChangeset for help on using the changeset viewer.