Class InternalConnectorRegistry (1.15.0)

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 > InternalConnectorRegistry

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
NameDescription
artifactIdString

getInstance()

public static synchronized InternalConnectorRegistry getInstance()

Returns the InternalConnectorRegistry singleton.

Returns
TypeDescription
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
NameDescription
applicationNameString

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
NameDescription
nameString

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
NameDescription
configConnectionConfig

used to configure the connection.

Returns
TypeDescription
Socket

the newly created Socket.

Exceptions
TypeDescription
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
NameDescription
configConnectionConfig
Returns
TypeDescription
ConnectionMetadata

register(String name, ConnectorConfig config)

public void register(String name, ConnectorConfig config)

Register the configuration for a named connector.

Parameters
NameDescription
nameString
configConnectorConfig

shutdown()

public void shutdown()

Shutdown all connectors and remove the singleton instance.