Package 

Class RouteDatabase


  • 
    public final class RouteDatabase
    
                        

    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.

    • Method Summary

      Modifier and Type Method Description
      synchronized void failed(Route failedRoute) Records a failure connecting to {@code failedRoute}.
      synchronized void connected(Route route) Records success connecting to {@code route}.
      synchronized boolean shouldPostpone(Route route) Returns true if {@code route} has failed recently and should be avoided.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • failed

         synchronized void failed(Route failedRoute)

        Records a failure connecting to {@code failedRoute}.

      • connected

         synchronized void connected(Route route)

        Records success connecting to {@code route}.

      • shouldPostpone

         synchronized boolean shouldPostpone(Route route)

        Returns true if {@code route} has failed recently and should be avoided.