final class ExchangeFinder
extends java.lang.Object
RealConnection.isEligible(okhttp3.Address, java.util.List<okhttp3.Route>)
for details.
If the pool gains an eligible connection while DNS, TCP, or TLS work is in flight, this finder will prefer pooled connections. Only pooled HTTP/2 connections are used for such de-duplication.
It is possible to cancel the finding process.
Modifier and Type | Field and Description |
---|---|
private Address |
address |
private Call |
call |
private RealConnection |
connectingConnection |
private RealConnectionPool |
connectionPool |
private EventListener |
eventListener |
private boolean |
hasStreamFailure |
private Route |
nextRouteToTry |
private RouteSelector.Selection |
routeSelection |
private RouteSelector |
routeSelector |
private Transmitter |
transmitter |
Constructor and Description |
---|
ExchangeFinder(Transmitter transmitter,
RealConnectionPool connectionPool,
Address address,
Call call,
EventListener eventListener) |
Modifier and Type | Method and Description |
---|---|
(package private) RealConnection |
connectingConnection() |
ExchangeCodec |
find(OkHttpClient client,
Interceptor.Chain chain,
boolean doExtensiveHealthChecks) |
private RealConnection |
findConnection(int connectTimeout,
int readTimeout,
int writeTimeout,
int pingIntervalMillis,
boolean connectionRetryEnabled)
Returns a connection to host a new stream.
|
private RealConnection |
findHealthyConnection(int connectTimeout,
int readTimeout,
int writeTimeout,
int pingIntervalMillis,
boolean connectionRetryEnabled,
boolean doExtensiveHealthChecks)
Finds a connection and returns it if it is healthy.
|
(package private) boolean |
hasRouteToTry()
Returns true if a current route is still good or if there are routes we haven't tried yet.
|
(package private) boolean |
hasStreamFailure()
Returns true if there is a failure that retrying might fix.
|
private boolean |
retryCurrentRoute()
Return true if the route used for the current connection should be retried, even if the
connection itself is unhealthy.
|
(package private) void |
trackFailure() |
private final Transmitter transmitter
private final Address address
private final RealConnectionPool connectionPool
private final Call call
private final EventListener eventListener
private RouteSelector.Selection routeSelection
private final RouteSelector routeSelector
private RealConnection connectingConnection
private boolean hasStreamFailure
private Route nextRouteToTry
ExchangeFinder(Transmitter transmitter, RealConnectionPool connectionPool, Address address, Call call, EventListener eventListener)
public ExchangeCodec find(OkHttpClient client, Interceptor.Chain chain, boolean doExtensiveHealthChecks)
private RealConnection findHealthyConnection(int connectTimeout, int readTimeout, int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled, boolean doExtensiveHealthChecks) throws java.io.IOException
java.io.IOException
private RealConnection findConnection(int connectTimeout, int readTimeout, int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled) throws java.io.IOException
java.io.IOException
RealConnection connectingConnection()
void trackFailure()
boolean hasStreamFailure()
boolean hasRouteToTry()
private boolean retryCurrentRoute()