public OkHttpClient() { this.interceptors = new ArrayList(); this.networkInterceptors = new ArrayList(); this.followSslRedirects = true; this.followRedirects = true; this.retryOnConnectionFailure = true; this.connectTimeout = 10000; this.readTimeout = 10000; this.writeTimeout = 10000; this.routeDatabase = new RouteDatabase(); this.dispatcher = new Dispatcher(); }
public ConnectionPool(int maxIdleConnections, long keepAliveDuration, TimeUnit timeUnit) { this.executor = new ThreadPoolExecutor(0, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(), Util.threadFactory("OkHttp ConnectionPool", true)); this.cleanupRunnable = new Runnable() { public void run() { while (true) { long waitNanos = ConnectionPool.this.cleanup(System.nanoTime()); if (waitNanos != -1) { if (waitNanos > 0) { long waitMillis = waitNanos / 1000000; waitNanos -= waitMillis * 1000000; synchronized (ConnectionPool.this) { try { ConnectionPool.this.wait(waitMillis, (int) waitNanos); } catch (InterruptedException e) { } } } } else { return; } } } }; this.connections = new ArrayDeque(); this.routeDatabase = new RouteDatabase(); this.maxIdleConnections = maxIdleConnections; this.keepAliveDurationNs = timeUnit.toNanos(keepAliveDuration); if (keepAliveDuration <= 0) { throw new IllegalArgumentException("keepAliveDuration <= 0: " + keepAliveDuration); } }
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool, Dns dns, RouteDatabase routeDatabase) { this.address = address; this.uri = uri; this.proxySelector = proxySelector; this.pool = pool; this.dns = dns; this.routeDatabase = routeDatabase; this.postponedRoutes = new LinkedList<>(); resetNextProxy(uri, address.getProxy()); }
public RouteDatabase routeDatabase(ConnectionPool connectionPool) { return connectionPool.routeDatabase; }
RouteDatabase routeDatabase() { return this.routeDatabase; }
public RouteSelector(Address address, RouteDatabase routeDatabase) { this.address = address; this.routeDatabase = routeDatabase; resetNextProxy(address.url(), address.getProxy()); }
private RouteDatabase routeDatabase() { return Internal.instance.routeDatabase(this.connectionPool); }
public OkHttpClient() { this.routeDatabase = new RouteDatabase(); this.dispatcher = new Dispatcher(); }
@Override public RouteDatabase routeDatabase(OkHttpClient client) { return client.routeDatabase; }
public OkHttpClient() { routeDatabase = new RouteDatabase(); dispatcher = new Dispatcher(); }
RouteDatabase getRoutesDatabase() { return routeDatabase; }