Package com.squareup.okhttp.internal
Class RouteDatabase
- java.lang.Object
-
- com.squareup.okhttp.internal.RouteDatabase
-
public final class RouteDatabase extends Object
A blacklist of failed routes to avoid when creating a new connection to a target address. This is used so that OkHttp can learn from its mistakes: if there was a failure attempting to connect to a specific IP address or proxy server, that failure is remembered and alternate routes are preferred.
-
-
Constructor Summary
Constructors Constructor Description RouteDatabase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnected(Route route)Records success connecting tofailedRoute.voidfailed(Route failedRoute)Records a failure connecting tofailedRoute.intfailedRoutesCount()booleanshouldPostpone(Route route)Returns true ifroutehas failed recently and should be avoided.
-
-
-
Method Detail
-
failed
public void failed(Route failedRoute)
Records a failure connecting tofailedRoute.
-
connected
public void connected(Route route)
Records success connecting tofailedRoute.
-
shouldPostpone
public boolean shouldPostpone(Route route)
Returns true ifroutehas failed recently and should be avoided.
-
failedRoutesCount
public int failedRoutesCount()
-
-