private void popAndDownload()
  {
    Downloadable downloadable;
    while ((downloadable = (Downloadable)this.remainingFiles.poll()) != null) {
      if (downloadable.getNumAttempts() > 5) {
        if (!this.ignoreFailures) this.failures.add(downloadable);
        //Launcher.getInstance().println("Gave up trying to download " + downloadable.getUrl() + " for job '" + this.name + "'");
      }
      else
      {
        try {
          String result = downloadable.download();
          this.successful.add(downloadable);
          //Launcher.getInstance().println("Finished downloading " + downloadable.getTarget() + " for job '" + this.name + "'" + ": " + result);
        } catch (Throwable t) {
          //Launcher.getInstance().println("Couldn't download " + downloadable.getUrl() + " for job '" + this.name + "'", t);
          this.remainingFiles.add(downloadable);
        }
      }
    }
    if (this.remainingThreads.decrementAndGet() <= 0)
      this.listener.onDownloadJobFinished(this);
  }