Java 类com.squareup.okhttp.internal.RouteDatabase 实例源码
项目:boohee_v5.6
文件:OkHttpClient.java
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();
}
项目:boohee_v5.6
文件:ConnectionPool.java
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);
}
}
项目:spdymcsclient
文件:RouteSelector.java
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());
}
项目:boohee_v5.6
文件:OkHttpClient.java
public RouteDatabase routeDatabase(ConnectionPool connectionPool) {
return connectionPool.routeDatabase;
}
项目:boohee_v5.6
文件:OkHttpClient.java
RouteDatabase routeDatabase() {
return this.routeDatabase;
}
项目:boohee_v5.6
文件:RouteSelector.java
public RouteSelector(Address address, RouteDatabase routeDatabase) {
this.address = address;
this.routeDatabase = routeDatabase;
resetNextProxy(address.url(), address.getProxy());
}
项目:boohee_v5.6
文件:StreamAllocation.java
private RouteDatabase routeDatabase() {
return Internal.instance.routeDatabase(this.connectionPool);
}
项目:FMTech
文件:OkHttpClient.java
public OkHttpClient()
{
this.routeDatabase = new RouteDatabase();
this.dispatcher = new Dispatcher();
}
项目:spdymcsclient
文件:OkHttpClient.java
@Override public RouteDatabase routeDatabase(OkHttpClient client) {
return client.routeDatabase;
}
项目:spdymcsclient
文件:OkHttpClient.java
public OkHttpClient() {
routeDatabase = new RouteDatabase();
dispatcher = new Dispatcher();
}
项目:spdymcsclient
文件:OkHttpClient.java
RouteDatabase getRoutesDatabase() {
return routeDatabase;
}