android - Retrofit: How to resolve requests duplications -


After

Recently I started to develop using retrofit and could immediately note that it is in such a way Does not offer some important features - retries, authentication handling, priority and more.

I managed to apply priority and retry myself, but there was a difficult problem to solve.

I want to manage requests before the "Grip" network, they are coming in the Quebec queue to avoid the same request again and again.

Users can sometimes drag 5 times to refresh once again and I do not want to open 5 similar requests. The identical request is easy to check - the same domain with the same parameter

This is my implementation:

  // Thread pool's thread factory, we use it to indicate the priority of the thread Thread Factor ThreadFactor = New ThreadFaster () {@ Override Jan Thread Newtread (Runnabal R) {Thread T = New Thread (R); T.setPriority (threadPriority); Return T; }}; MQueue = new linking blocking Qualify & lt; Runnabel & gt; (); MExecuter = New ThreadPoolExecutor (CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE_TIME, KEEP_ALIVE_TIME_UNIT, mQueue); MExecuter.setThreadFactory (threadFactory); MRestAdapter = New RestAdapter.Builder (). SetClient (new AndroidApacheClient ()). SetExecutors (mExecuter, mExecuter) .setEndpoint (NetworkContants.DOMAIN) .setRequestInterceptor (mRequestInterceptor) .setConverter (New GsonConverter (New Gson ()) .build ();  

After

Why do not you allow the bridge to refresh it, refresh it for? Does not it mean that unless you receive any response in the form of money, do not allow any request?


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -