Retrying the request using Retrofit 2

后端 未结 7 900
天涯浪人
天涯浪人 2020-12-12 17:35

How can I add retry functionality to the requests sent by Retrofit 2 library. Something like:

service.listItems().enqueue(new Callback>         


        
7条回答
  •  醉梦人生
    2020-12-12 18:09

    With Retrofit 2.5

    Now it's possible to make async sync calls through java.util.concurrent.CompletableFuture, the code waits for it's completion wich is very nice.

    Here's a gist with a working solution.

提交回复
热议问题