This repository was archived by the owner on Oct 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/com/binance/api/client/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import com .binance .api .client .constant .BinanceApiConstants ;
55import com .binance .api .client .exception .BinanceApiException ;
66import com .binance .api .client .security .AuthenticationInterceptor ;
7+ import okhttp3 .Dispatcher ;
78import okhttp3 .OkHttpClient ;
89import okhttp3 .RequestBody ;
910import okhttp3 .ResponseBody ;
2223 * Generates a Binance API implementation based on @see {@link BinanceApiService}.
2324 */
2425public class BinanceApiServiceGenerator {
25- private static final OkHttpClient sharedClient = new OkHttpClient .Builder ()
26- .pingInterval (20 , TimeUnit .SECONDS )
27- .build ();
2826
27+ private static final OkHttpClient sharedClient ;
2928 private static final Converter .Factory converterFactory = JacksonConverterFactory .create ();
3029
30+ static {
31+ Dispatcher dispatcher = new Dispatcher ();
32+ dispatcher .setMaxRequestsPerHost (500 );
33+ dispatcher .setMaxRequests (500 );
34+ sharedClient = new OkHttpClient .Builder ()
35+ .dispatcher (dispatcher )
36+ .pingInterval (20 , TimeUnit .SECONDS )
37+ .build ();
38+ }
39+
3140 @ SuppressWarnings ("unchecked" )
3241 private static final Converter <ResponseBody , BinanceApiError > errorBodyConverter =
3342 (Converter <ResponseBody , BinanceApiError >)converterFactory .responseBodyConverter (
You can’t perform that action at this time.
0 commit comments