# Class InternalConnectorRegistry (1.15.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.15.0 (latest)](https://docs.cloud.google.com/java/docs/reference/jdbc-socket-factory-parent/latest/com.google.cloud.sql.core.InternalConnectorRegistry)
- [1.14.1](https://docs.cloud.google.com/java/docs/reference/jdbc-socket-factory-parent/1.14.1/com.google.cloud.sql.core.InternalConnectorRegistry)

    public final class InternalConnectorRegistry

InternalConnectorRegistry keeps track of connectors. This class should not be used directly, but
only through the JDBC driver specific `SocketFactory` implementations.

WARNING: This is an internal class. The API is subject to change without notice.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> InternalConnectorRegistry

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### addArtifactId(String artifactId)

    public static void addArtifactId(String artifactId)

Internal use only: Sets the default string which is appended to the SQLAdmin API client
User-Agent header.

This is used by the specific database connector socket factory implementations to append
their database name to the user agent.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `artifactId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

### getInstance()

    public static synchronized InternalConnectorRegistry getInstance()

Returns the [InternalConnectorRegistry](https://docs.cloud.google.com/java/docs/reference/jdbc-socket-factory-parent/latest/com.google.cloud.sql.core.InternalConnectorRegistry) singleton.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/jdbc-socket-factory-parent/latest/com.google.cloud.sql.core.InternalConnectorRegistry` |   |

### resetInstance()

    public static synchronized void resetInstance()

Calls shutdown on the singleton and removes the singleton. After calling shutdownInstance(),
the next call to getInstance() will start a new singleton instance.

### setApplicationName(String applicationName)

    public static void setApplicationName(String applicationName)

Adds an external application name to the user agent string for tracking. This is known to be
used by the spring-cloud-gcp project.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `applicationName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

### shutdownInstance()

    public static synchronized void shutdownInstance()

Calls shutdown on the singleton and removes the singleton. After calling shutdownInstance(),
the next call to getInstance() will start a new singleton instance.

## Methods

### close(String name)

    public void close(String name)

Close a named connector, stopping the refresh process and removing it from the registry.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

### connect(ConnectionConfig config)

    public Socket connect(ConnectionConfig config)

Internal use only: Creates a socket representing a connection to a Cloud SQL instance.

Depending on the given properties, it may return either a SSL Socket or a Unix Socket.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `config` | `https://docs.cloud.google.com/java/docs/reference/jdbc-socket-factory-parent/latest/com.google.cloud.sql.core.ConnectionConfig` used to configure the connection. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html` | the newly created Socket. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if error occurs during socket creation. |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html` | if error occurs during socket creation. |

### getConnectionMetadata(ConnectionConfig config)

    public ConnectionMetadata getConnectionMetadata(ConnectionConfig config)

Internal use only: Returns ConnectionMetadata for a connection.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `config` | `https://docs.cloud.google.com/java/docs/reference/jdbc-socket-factory-parent/latest/com.google.cloud.sql.core.ConnectionConfig` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/jdbc-socket-factory-parent/latest/com.google.cloud.sql.core.ConnectionMetadata` |   |

### register(String name, ConnectorConfig config)

    public void register(String name, ConnectorConfig config)

Register the configuration for a named connector.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `config` | `https://docs.cloud.google.com/java/docs/reference/jdbc-socket-factory-parent/latest/com.google.cloud.sql.ConnectorConfig` |

### shutdown()

    public void shutdown()

Shutdown all connectors and remove the singleton instance.