public static synchronized InternalConnectorRegistry getInstance()

in core/src/main/java/com/google/cloud/sql/core/InternalConnectorRegistry.java [93:115]


  public static synchronized InternalConnectorRegistry getInstance() {
    if (shutdown) {
      throw new IllegalStateException("ConnectorRegistry was shut down.");
    }

    if (internalConnectorRegistry == null) {
      logger.debug("First Cloud SQL connection, generating RSA key pair.");

      CredentialFactoryProvider credentialFactoryProvider = new CredentialFactoryProvider();

      ListeningScheduledExecutorService executor = getDefaultExecutor();

      internalConnectorRegistry =
          new InternalConnectorRegistry(
              executor.submit(InternalConnectorRegistry::generateRsaKeyPair),
              new DefaultConnectionInfoRepositoryFactory(getUserAgents()),
              credentialFactoryProvider,
              DEFAULT_SERVER_PROXY_PORT,
              DEFAULT_CONNECT_TIMEOUT_MS,
              executor);
    }
    return internalConnectorRegistry;
  }