异步亚马逊冰川下载 [英] Asynchronous amazon glacier download

查看:89
本文介绍了异步亚马逊冰川下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用线程池异步下载多个冰川文件。我当前的方法使用High Level API进行Glacier下载,但是每个线程都在等待下载方法,直到下载作业完成。以下是所有代码正在等待的代码

I want to asynchronously download multiple glacier files using thread pool. My current approach uses High Level API for Glacier download, but every thread waits at download method until the download job is complete. Below is the code where all the treads are waiting

            ArchiveTransferManager manager = new     ArchiveTransferManager(Amazon.RegionEndpoint.USEast1);
            DownloadOptions options = new DownloadOptions();
            manager.Download(vaultName, archiveId, downloadFilePath, options); 

有人可以建议我如何异步下载存档,以便我的线程在获得作业ID和某些事件应在下载完成后引发。

Can somebody please suggest me how to download archive asynchronously, so that my thread should come back after getting the job id and some event should get raised on download completion.

致谢,
Haseena

Regards, Haseena

推荐答案

如果Amazon不提供异步API,则您需要自己实现。您已经具有每次下载的线程,只需让下载线程在下载完成后通知您的主线程即可。

If Amazon doesn't offer an asynchronous API, you'll need to implement one yourself. You already have a thread for each download, just have your download thread notify your main thread when the download is done.

TPL可以帮助您自动执行此操作-创建一个任务下载文件,并在其上等待

TPL can help you do that automatically - create a Task that downloads a file, and await on it.

这篇关于异步亚马逊冰川下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆