Package com.google.cloud.alloydb
Class ConnectorRegistry
java.lang.Object
com.google.cloud.alloydb.ConnectorRegistry
Configure the AlloyDB JDBC Connector.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddArtifactId(String artifactId) Adds an external application name to the user agent string for tracking.static voidClose a named connector.static voidregister(String name, ConnectorConfig config) Register a named connection so that it can later be referenced by name in a JDBC or R2DBC URL.static voidreset()Resets the entire AlloyDB JDBC Connector.static voidshutdown()Shutdown the entire AlloyDB JDBC Connector.
-
Constructor Details
-
ConnectorRegistry
public ConnectorRegistry()
-
-
Method Details
-
register
Register a named connection so that it can later be referenced by name in a JDBC or R2DBC URL.- Parameters:
name- the named connection name.config- the full configuration of the connection.
-
close
Close a named connector. This will stop all background credential refresh processes. All future attempts to connect via this named connection will fail.- Parameters:
name- the name of the connector to close.
-
reset
public static void reset()Resets the entire AlloyDB JDBC Connector. This will stop all background threads. The next attempt to open a connection or register a configuration will start a new ConnectorRegistry. -
shutdown
public static void shutdown()Shutdown the entire AlloyDB JDBC Connector. This will stop all background threads. All future attempts to connect to the database will fail. -
addArtifactId
Adds an external application name to the user agent string for tracking. This is known to be used by the spring-cloud-gcp project.- Throws:
IllegalStateException- if the AlloyDB Admin client has already been initialized
-