package com.drivemode.spotify.rest;

import com.squareup.okhttp.OkHttpClient;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.client.OkClient;

/**
 * @author KeishinYokomaku
 */
public class RestAdapterFactory {
    public static final String TAG = RestAdapterFactory.class.getSimpleName();
    public static final String SPOTIFY_WEB_API_ENDPOINT = "https://api.spotify.com/v1";
    public static final String SPOTIFY_AUTHENTICATE_ENDPOINT = "https://accounts.spotify.com/";
    private final OkClient mOkClient;
    private final Executor mExecutor;

    public RestAdapterFactory() {
        mOkClient = new OkClient(new OkHttpClient());
        mExecutor = Executors.newSingleThreadExecutor();
    }

    public RestAdapter provideWebApiAdapter(RequestInterceptor interceptor) {
        return new RestAdapter.Builder()
                .setLogLevel(RestAdapter.LogLevel.FULL)
                .setClient(mOkClient)
                .setExecutors(mExecutor, mExecutor)
                .setEndpoint(SPOTIFY_WEB_API_ENDPOINT)
                .setRequestInterceptor(interceptor)
                .build();
    }

    public RestAdapter provideAuthenticateApiAdapter() {
        return new RestAdapter.Builder()
                .setLogLevel(RestAdapter.LogLevel.FULL)
                .setClient(mOkClient)
                .setExecutors(mExecutor, mExecutor)
                .setEndpoint(SPOTIFY_AUTHENTICATE_ENDPOINT)
                .build();
    }
}

@@ -76,86 +76,8 @@
 t;%0A%0A
-import java.util.concurrent.Executor;%0Aimport java.util.concurrent.Executors;%0A%0A
 impo
@@ -108,16 +108,16 @@
 ceptor;%0A
+
 import r
@@ -544,46 +544,8 @@
 ent;
-%0A    private final Executor mExecutor;
 %0A%0A  
@@ -634,65 +634,8 @@
 ));%0A
-        mExecutor = Executors.newSingleThreadExecutor();%0A
     
@@ -854,60 +854,8 @@
 nt)%0A
-                .setExecutors(mExecutor, mExecutor)%0A
     
@@ -1136,32 +1136,32 @@
 .LogLevel.FULL)%0A
+
                 
@@ -1186,60 +1186,8 @@
 nt)%0A
-                .setExecutors(mExecutor, mExecutor)%0A
     

Fix executors for retrofit request and callback