in core/src/main/java/com/google/cloud/sql/core/Connector.java [220:238]
private ConnectionInfoCache createConnectionInfo(ConnectionConfig config) {
logger.debug(
String.format("[%s] Connection info added to cache.", config.getCloudSqlInstance()));
if (config.getConnectorConfig().getRefreshStrategy() == RefreshStrategy.LAZY) {
// Resolve the key operation immediately.
KeyPair keyPair = null;
try {
keyPair = localKeyPair.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
return new LazyRefreshConnectionInfoCache(
config, adminApi, instanceCredentialFactory, keyPair);
} else {
return new RefreshAheadConnectionInfoCache(
config, adminApi, instanceCredentialFactory, executor, localKeyPair, minRefreshDelayMs);
}
}