larksuite-oapi/src/main/java/com/larksuite/oapi/okhttp3_14/internal/connection/ExchangeFinder.java
private RealConnection findHealthyConnection(int connectTimeout, int readTimeout,
      int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled,
      boolean doExtensiveHealthChecks) throws IOException {
    while (true) {
      RealConnection candidate = findConnection(connectTimeout, readTimeout, writeTimeout,
          pingIntervalMillis, connectionRetryEnabled);

      // If this is a brand new connection, we can skip the extensive health checks.
      synchronized (connectionPool) {
        if (candidate.successCount == 0 && !candidate.isMultiplexed()) {
          return candidate;
        }
      }

      // Do a (potentially slow) check to confirm that the pooled connection is still good. If it
      // isn't, take it out of the pool and start again.
      if (!candidate.isHealthy(doExtensiveHealthChecks)) {
        candidate.noNewExchanges();
        continue;
      }

      return candidate;
    }
  }
/**
   * Finds a connection and returns it if it is healthy. If it is unhealthy the process is repeated
   * until a healthy connection is found.
   */
Finds a connection and returns it if it is healthy. If it is unhealthy the process is repeated
until a healthy connection is found.
Finds a connection and returns it if it is healthy . If it is unhealthy the process is repeated until a healthy connection is found .
private RealConnection findHealthyConnection(int connectTimeout, int readTimeout,
      int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled,
      boolean doExtensiveHealthChecks) throws IOException {
    while (true) {
      RealConnection candidate = findConnection(connectTimeout, readTimeout, writeTimeout,
          pingIntervalMillis, connectionRetryEnabled);
      synchronized (connectionPool) {
        if (candidate.successCount == 0 && !candidate.isMultiplexed()) {
          return candidate;
        }
      }
      if (!candidate.isHealthy(doExtensiveHealthChecks)) {
        candidate.noNewExchanges();
        continue;
      }
      return candidate;
    }
  }
private RealConnection findHealthyConnection ( int connectTimeout , int readTimeout , int writeTimeout , int pingIntervalMillis , boolean connectionRetryEnabled , boolean doExtensiveHealthChecks ) throws IOException { while ( true ) { RealConnection candidate = findConnection ( connectTimeout , readTimeout , writeTimeout , pingIntervalMillis , connectionRetryEnabled ) ; synchronized ( connectionPool ) { if ( candidate . successCount == 0 && ! candidate . isMultiplexed ( ) ) { return candidate ; } } if ( ! candidate . isHealthy ( doExtensiveHealthChecks ) ) { candidate . noNewExchanges ( ) ; continue ; } return candidate ; } }
Finds a connection and returns it if it is healthy.
Finds a connection and returns it if it is healthy .
// If this is a brand new connection, we can skip the extensive health checks. // Do a (potentially slow) check to confirm that the pooled connection is still good. If it // isn't, take it out of the pool and start again.