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(); } }
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(); } }