Changeset 11509
- Timestamp:
- 2006-03-28T11:40:28+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/WGet.java
r9646 r11509 107 107 } 108 108 109 110 109 /** This method is called to delete a certain job from the queue. 111 110 * This job may be pending, complete or even in progress. However … … 116 115 */ 117 116 public void deleteDownloadJob(DownloadJob delete_me) { 117 118 118 if (delete_me == job) { 119 119 // While this seems wasteful its only for the briefest moment. … … 263 263 public void run() { 264 264 while(true) { 265 265 266 // If there are jobs job_queue and we have more room. 266 267 if(job_queue.size() > 0) { 267 268 int index = 0; 268 269 while(job_queue.size() > 0 && index < job_queue.size()) { 269 // Get the first job that isn't stopped. 270 job = (DownloadJob) job_queue.get(index); 271 if(job.getState() == DownloadJob.RUNNING) { 272 DebugStream.println("DownloadJob " + job.toString() + " Begun."); 273 // A lock to prevent us deleting this job while its being 270 // Get the first job that isn't stopped. 271 synchronized(job_queue){ 272 job = (DownloadJob) job_queue.get(index); 273 if(job.getState() == DownloadJob.RUNNING) { 274 DebugStream.println("DownloadJob " + job.toString() + " Begun."); 275 // A lock to prevent us deleting this job while its being 274 276 // run, unless you want things to go really wrong. 275 busy = true; 276 if(simple) { 277 job.callWGet(); 277 busy = true; 278 if(simple) { 279 job.callWGet(); 280 } 281 else { 282 job.callWGetNative(); 283 } 284 busy = false; 285 DebugStream.println("DownloadJob " + job.toString() + " complete."); 286 // And if the user has requested that complete jobs 287 // be removed, then remove it from the list. 288 //deleteDownloadJob(job); 289 job = null; 278 290 } 279 else { 280 job.callWGetNative(); 281 } 282 busy = false; 283 DebugStream.println("DownloadJob " + job.toString() + " complete."); 284 // And if the user has requested that complete jobs 285 // be removed, then remove it from the list. 286 //deleteDownloadJob(job); 287 job = null; 291 index++; 288 292 } 289 index++;290 293 } 291 294 } … … 303 306 } 304 307 } 308 305 309 } // End While. 306 310 }
Note:
See TracChangeset
for help on using the changeset viewer.