in alloydb-jdbc-connector/src/main/java/com/google/cloud/alloydb/Connector.java [71:91]
Socket connect(ConnectionConfig config) throws IOException {
ConnectionInfoCache connectionInfoCache = getConnection(config);
ConnectionInfo connectionInfo = connectionInfoCache.getConnectionInfo();
try {
ConnectionSocket socket =
new ConnectionSocket(
connectionInfo, config, clientConnectorKeyPair, accessTokenSupplier, userAgents);
return socket.connect();
} catch (IOException e) {
logger.debug(
String.format(
"[%s] Socket connection failed! Trigger a refresh.", config.getInstanceName()));
connectionInfoCache.forceRefresh();
// The Socket methods above will throw an IOException or a SocketException (subclass of
// IOException). Catch that exception, trigger a refresh, and then throw it again so
// the caller sees the problem, but the connector will have a refreshed certificate on the
// next invocation.
throw e;
}
}