public void asyncDownload() {
    try {
      this_mon.enter();

      if (current_index == max_to_try || cancelled) {

        done_sem.release();

        informFailed((ResourceDownloaderException) result);

      } else {

        current_downloader = ((ResourceDownloaderBaseImpl) delegates[current_index]).getClone(this);

        informActivity(getLogIndent() + "Downloading: " + getName());

        current_index++;

        current_downloader.addListener(this);

        current_downloader.asyncDownload();
      }
    } finally {

      this_mon.exit();
    }
  }
  protected void addReportListener(ResourceDownloader rd) {
    rd.addListener(
        new ResourceDownloaderAdapter() {
          public void reportActivity(ResourceDownloader downloader, String activity) {
            informActivity(activity);
          }

          public void failed(ResourceDownloader downloader, ResourceDownloaderException e) {
            informActivity(downloader.getName() + ":" + e.getMessage());
          }
        });
  }
  public void cancel() {
    setCancelled();

    try {
      this_mon.enter();

      result = new ResourceDownloaderCancelledException(this);

      cancelled = true;

      informFailed((ResourceDownloaderException) result);

      done_sem.release();

      if (current_downloader != null) {

        current_downloader.cancel();
      }
    } finally {

      this_mon.exit();
    }
  }