core/src/main/java/com/google/cloud/sql/core/CoreSocketFactory.java
public static synchronized CoreSocketFactory getInstance() {
    if (coreSocketFactory == null) {
      logger.info("First Cloud SQL connection, generating RSA key pair.");
      KeyPair keyPair = generateRsaKeyPair();
      CredentialFactory credentialFactory;
      if (System.getProperty(CredentialFactory.CREDENTIAL_FACTORY_PROPERTY) != null) {
        try {
          credentialFactory =
              (CredentialFactory)
                  Class.forName(System.getProperty(CredentialFactory.CREDENTIAL_FACTORY_PROPERTY))
                      .newInstance();
        } catch (Exception err) {
          throw new RuntimeException(err);
        }
      } else {
        credentialFactory = new ApplicationDefaultCredentialFactory();
      }

      Credential credential = credentialFactory.create();

      SQLAdmin adminApi = createAdminApiClient(credential);
      coreSocketFactory =
          new CoreSocketFactory(
              new Clock(), keyPair, credential, adminApi, DEFAULT_SERVER_PROXY_PORT);
    }
    return coreSocketFactory;
  }
public static synchronized CoreSocketFactory getInstance() {
    if (coreSocketFactory == null) {
      logger.info("First Cloud SQL connection, generating RSA key pair.");
      KeyPair keyPair = generateRsaKeyPair();
      CredentialFactory credentialFactory;
      if (System.getProperty(CredentialFactory.CREDENTIAL_FACTORY_PROPERTY) != null) {
        try {
          credentialFactory =
              (CredentialFactory)
                  Class.forName(System.getProperty(CredentialFactory.CREDENTIAL_FACTORY_PROPERTY))
                      .newInstance();
        } catch (Exception err) {
          throw new RuntimeException(err);
        }
      } else {
        credentialFactory = new ApplicationDefaultCredentialFactory();
      }

      Credential credential = credentialFactory.create();

      SQLAdmin adminApi = createAdminApiClient(credential);
      coreSocketFactory =
          new CoreSocketFactory(
              new Clock(), keyPair, credential, adminApi, DEFAULT_SERVER_PROXY_PORT);
    }
    return coreSocketFactory;
  }
public static synchronized CoreSocketFactory getInstance ( ) { if ( coreSocketFactory == null ) { logger . info ( "First Cloud SQL connection, generating RSA key pair." ) ; KeyPair keyPair = generateRsaKeyPair ( ) ; CredentialFactory credentialFactory ; if ( System . getProperty ( CredentialFactory . CREDENTIAL_FACTORY_PROPERTY ) != null ) { try { credentialFactory = ( CredentialFactory ) Class . forName ( System . getProperty ( CredentialFactory . CREDENTIAL_FACTORY_PROPERTY ) ) . newInstance ( ) ; } catch ( Exception err ) { throw new RuntimeException ( err ) ; } } else { credentialFactory = new ApplicationDefaultCredentialFactory ( ) ; } Credential credential = credentialFactory . create ( ) ; SQLAdmin adminApi = createAdminApiClient ( credential ) ; coreSocketFactory = new CoreSocketFactory ( new Clock ( ) , keyPair , credential , adminApi , DEFAULT_SERVER_PROXY_PORT ) ; } return coreSocketFactory ; }
Returns the {@link CoreSocketFactory} singleton.
Returns the {