use of com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException in project otter by alibaba.
the class Aria2cDownLoadIntegration method testDownLoad_ok.
@Test
public void testDownLoad_ok() {
DataRetriever retriever = new Aria2cRetriever("http://china.alibaba.com", tmp);
try {
retriever.connect();
retriever.doRetrieve();
} catch (DataRetrieveException ex) {
retriever.abort();
} finally {
retriever.disconnect();
}
}
use of com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException in project otter by alibaba.
the class AbstractCommandDownload method download.
public void download() throws IOException {
// 准备下载
notifyStatusChange(DownloadStatus.CONNECTING);
Exec.Result result = null;
try {
result = Exec.execute(cmd);
if (false == this.isSuccess(result.getExitCode())) {
aborted.set(true);
notifyException(new DataRetrieveException(result.toString()));
notifyStatusChange(DownloadStatus.EXCEPTION);
} else {
this.analyzeResult(result);
this.notifyMessage(result.toString());
if (aborted.get()) {
// 中断
notifyStatusChange(DownloadStatus.ABORT);
} else if (paused.get()) {
// 暂停
notifyStatusChange(DownloadStatus.PAUSED);
} else {
// 下载完成
notifyStatusChange(DownloadStatus.COMPLETE);
}
}
} catch (Exception ex) {
aborted.set(true);
notifyException(new DataRetrieveException((result != null) ? ex.getMessage() + SystemUtils.LINE_SEPARATOR + result.toString() : ex.getMessage(), ex));
}
}
use of com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException in project otter by alibaba.
the class Aria2cDownLoadIntegration method testDownLoad_failed.
@Test
public void testDownLoad_failed() {
DataRetriever retriever = new Aria2cRetriever("aaaaaaa/sssss", tmp);
try {
retriever.connect();
retriever.doRetrieve();
} catch (DataRetrieveException ex) {
retriever.abort();
} finally {
retriever.disconnect();
}
}
Aggregations