public void removeDownload(DownloadInfo downloadInfo) throws DbException { HttpHandler<File> handler = downloadInfo.getHandler(); if (handler != null && !handler.isCancelled()) { handler.cancel(); } downloadInfoList.remove(downloadInfo); db.delete(downloadInfo); }
public void stopDownload(DownloadInfo downloadInfo) throws DbException { HttpHandler<File> handler = downloadInfo.getHandler(); if (handler != null && !handler.isCancelled()) { handler.cancel(); } else { downloadInfo.setState(HttpHandler.State.CANCELLED); } db.saveOrUpdate(downloadInfo); }