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.
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 | String |
getInstance()
public static synchronized InternalConnectorRegistry getInstance()
Returns the InternalConnectorRegistry singleton.
Returns | |
---|---|
Type | Description |
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 | String |
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 | String |
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 | ConnectionConfig used to configure the connection. |
Returns | |
---|---|
Type | Description |
Socket | the newly created Socket. |
Exceptions | |
---|---|
Type | Description |
IOException | if error occurs during socket creation. |
InterruptedException | 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 | ConnectionConfig |
Returns | |
---|---|
Type | Description |
ConnectionMetadata |
register(String name, ConnectorConfig config)
public void register(String name, ConnectorConfig config)
Register the configuration for a named connector.
Parameters | |
---|---|
Name | Description |
name | String |
config | ConnectorConfig |
shutdown()
public void shutdown()
Shutdown all connectors and remove the singleton instance.