public ConnectionInfo getConnectionInfo()

in alloydb-jdbc-connector/src/main/java/com/google/cloud/alloydb/LazyConnectionInfoCache.java [57:94]


  public ConnectionInfo getConnectionInfo() {
    synchronized (connectionInfoGuard) {
      if (closed) {
        throw new IllegalStateException(
            String.format("[%s] Lazy Refresh: Named connection closed.", instanceURI));
      }

      if (connectionInfo == null || needsRefresh(connectionInfo.getExpiration())) {
        logger.debug(
            String.format(
                "[%s] Lazy Refresh Operation: Client certificate needs refresh. Starting next "
                    + "refresh operation...",
                instanceURI));

        try {
          ListenableFuture<ConnectionInfo> infoFuture =
              connectionInfoRepo.getConnectionInfo(instanceURI, clientConnectorKeyPair);
          this.connectionInfo = infoFuture.get(CLIENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
        } catch (TerminalException e) {
          logger.debug(
              String.format(
                  "[%s] Lazy Refresh Operation: Failed with a terminal error.", instanceURI),
              e);
          throw e;
        } catch (Exception e) {
          throw new RuntimeException(
              String.format("[%s] Refresh Operation: Failed!", instanceURI), e);
        }
      }

      logger.debug(
          String.format(
              "[%s] Lazy Refresh Operation: Completed refresh with new certificate "
                  + "expiration at %s.",
              instanceURI, this.connectionInfo.getExpiration().toString()));
      return connectionInfo;
    }
  }