【问题标题】:Retrofit - Parallel HTTP requests改造 - 并行 HTTP 请求
【发布时间】:2016-01-15 12:36:32
【问题描述】:

我有一个 Android 应用程序,它当前正在使用 Retrofit 库来发出网络请求。我有很多并行异步请求。 当所有请求都完成后,我现在该怎么做?

【问题讨论】:

    标签: java android retrofit retrofit2


    【解决方案1】:

    看看这篇 Retrofit — Synchronous and Asynchronous Requests – Asynchronous Requests 的帖子,它描述了如何通过提供回调来异步执行 HTTP 调用。

    如果您事先知道要执行多少次调用,您可以使用 CountDownLatch 和一组 count 来等待所有调用完成。

    【讨论】:

    • 该链接要求我登录!
    • 对不起,它在 2016 年 1 月开放。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多