List of usage examples for com.squareup.okhttp OkHttpClient setDispatcher
public OkHttpClient setDispatcher(Dispatcher dispatcher)
From source file:com.frostwire.http.HttpClient.java
License:Open Source License
private static OkHttpClient buildClient(Params params) { OkHttpClient c = Loader.DEFAULT_CLIENT.clone(); ExecutorService pool = params.pool != null ? params.pool : c.getDispatcher().getExecutorService(); Dispatcher d = new Dispatcher(pool); d.setMaxRequests(params.maxRequests); d.setMaxRequestsPerHost(params.maxRequestsPerHost); c.setDispatcher(d); return c;/* w w w .j av a2s. co m*/ }