Module bus.http

Class RouteDatabase

java.lang.Object
org.miaixz.bus.http.accord.RouteDatabase

public final class RouteDatabase extends Object
A blacklist of failed routes to avoid when creating new connections to a target address. If a failure occurs when attempting to connect to a specific IP address or proxy server, that failure is remembered and alternate routes will be preferred.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • RouteDatabase

      public RouteDatabase()
  • Method Details

    • failed

      public void failed(Route route)
      Records a failure connecting to route.
      Parameters:
      route - The route that failed.
    • connected

      public void connected(Route route)
      Records a successful connection to route.
      Parameters:
      route - The route that successfully connected.
    • shouldPostpone

      public boolean shouldPostpone(Route route)
      Returns true if route has recently failed and should be avoided.
      Parameters:
      route - The route to check.
      Returns:
      true if the route should be postponed.