Changeset 31721
- Timestamp:
- 2017-06-02T17:37:25+12:00 (7 years ago)
- Location:
- main/trunk/gli/src/org/greenstone/gatherer/download
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/download/DownloadJob.java
r31720 r31721 212 212 previous_state = getState(); 213 213 if (getState() == RUNNING) { 214 //setState(STOPPED); 215 stopDownload(); // cancels any running SafeProcess 214 stopDownload(); // cancels any running SafeProcess, will set the current state to STOPPED when the time is right 216 215 } else { 217 //previous_state = getState();218 216 setState(RUNNING); 219 217 mummy.resumeThread(); … … 225 223 if(getState() == RUNNING) { 226 224 previous_state = getState(); 227 //setState(STOPPED); // do we need to do anything else to stop this? YES, we do: 228 stopDownload(); // cancels any running SafeProcess 225 stopDownload(); // cancels any running SafeProcess, will set the current state to STOPPED when the time is right 229 226 } 230 227 mummy.deleteDownloadJob(this); … … 731 728 732 729 SafeProcess.log("@@@@ DONE callDownload()"); 733 734 /*735 // Regardless of whether state==STOPPED or ends up being COMPLETE, the process is at an end now.736 // Notify the DownloadScrollPane which is waiting on this job to complete that we are ready737 synchronized(this) {738 System.err.println("**************** Notifying download scrollpane");739 this.notify();740 }741 */742 730 743 731 // refresh the workspace tree … … 758 746 boolean hadToSendInterrupt = prcs.cancelRunningProcess(); // returns false if it was already terminating/terminated, true if interrupt sent 759 747 760 761 /*762 // if process terminating naturally but waiting for process' worker threads to join(),763 // shall we just remove the progress bar display for this download?764 // If so, do this section in place of the 2 calls to progress.enableCancelJob(boolean) below765 if(!hadToSendInterrupt && SwingUtilities.isEventDispatchThread()) {766 if(getState() == DownloadJob.RUNNING) {767 progress.mirrorComplete();768 previous_state = getState();769 setState(DownloadJob.COMPLETE);770 }771 mummy.deleteCurrentDownloadJob(this); // why wait for the cleanup which can't be interrupted anyway?772 }773 */774 748 } else { 775 749 System.err.println("@@@@ No process to interrupt"); … … 807 781 mummy.deleteCurrentDownloadJob(this); 808 782 } 809 } /*else { 810 // If we've got to here and the state isn't STOPPED then the 811 // job is complete. 812 System.err.println("**************** NOT Notifying download scrollpane"); 813 if(getState() == DownloadJob.RUNNING) { 814 progress.mirrorComplete(); 815 previous_state = getState(); 816 setState(DownloadJob.COMPLETE); 817 } 818 } 819 820 // Regardless of whether state==STOPPED or ends up being COMPLETE, the process is at an end now. 821 // Notify the DownloadScrollPane which is waiting on this job to complete that we are ready 822 synchronized(this) { 823 System.err.println("**************** Notifying download scrollpane"); 824 this.notify(); 825 }*/ 826 783 } 827 784 } 828 785 -
main/trunk/gli/src/org/greenstone/gatherer/download/DownloadScrollPane.java
r31692 r31721 79 79 } 80 80 81 82 83 84 85 86 81 /** 82 * To be used with DownloadJob.java's old_callDownload() and old_actionPerformed() 83 * OR by uncommenting the "synchronized(this)" section in Download.java at the end of 84 * its new callDownload() along with commenting out "mummy.deleteCurrentDownloadJob(this);" 85 * in Download.java's doneCleanup(). 86 */ 87 87 public void old_deleteDownloadJob(DownloadJob delete_me) { 88 88 if (delete_me == job) { … … 107 107 } 108 108 109 110 111 112 109 /** 110 * If called to delete the current download job, this method won't do anything. 111 * But if called on any inactive download job, its display is removed. 112 */ 113 113 public void deleteDownloadJob(DownloadJob delete_me) { 114 114 if (delete_me != job) { … … 121 121 } 122 122 123 124 125 126 123 /** 124 * To be called when we're ready to delete the current download job, 125 * else this method won't do anything 126 */ 127 127 public void deleteCurrentDownloadJob(DownloadJob delete_me) { 128 128 if (delete_me == job) {
Note:
See TracChangeset
for help on using the changeset viewer.