File tree 3 files changed +25
-4
lines changed
core/src/main/java/com/google/cloud/sql/core
3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,25 @@ class CloudSqlInstanceName {
35
35
private final String regionId ;
36
36
private final String instanceId ;
37
37
private final String connectionName ;
38
+ private final String domainName ;
38
39
39
40
/**
40
41
* Initializes a new CloudSqlInstanceName class.
41
42
*
42
43
* @param connectionName instance connection name in the format "PROJECT_ID:REGION_ID:INSTANCE_ID"
43
44
*/
44
45
CloudSqlInstanceName (String connectionName ) {
46
+ this (connectionName , null );
47
+ }
48
+
49
+ /**
50
+ * Initializes a new CloudSqlInstanceName class containing the domain name.
51
+ *
52
+ * @param connectionName
53
+ */
54
+ CloudSqlInstanceName (String connectionName , String domainName ) {
45
55
this .connectionName = connectionName ;
56
+ this .domainName = domainName ;
46
57
Matcher matcher = CONNECTION_NAME .matcher (connectionName );
47
58
checkArgument (
48
59
matcher .matches (),
@@ -71,6 +82,10 @@ String getInstanceId() {
71
82
return instanceId ;
72
83
}
73
84
85
+ String getDomainName () {
86
+ return domainName ;
87
+ }
88
+
74
89
@ Override
75
90
public String toString () {
76
91
return connectionName ;
Original file line number Diff line number Diff line change @@ -44,12 +44,15 @@ public LazyRefreshConnectionInfoCache(
44
44
ConnectionInfoRepository connectionInfoRepository ,
45
45
CredentialFactory tokenSourceFactory ,
46
46
KeyPair keyPair ) {
47
+
48
+ CloudSqlInstanceName instanceName =
49
+ new CloudSqlInstanceName (config .getCloudSqlInstance (), config .getDomainName ());
50
+
47
51
this .config = config ;
48
- this .instanceName = new CloudSqlInstanceName ( config . getCloudSqlInstance ()) ;
52
+ this .instanceName = instanceName ;
49
53
50
54
AccessTokenSupplier accessTokenSupplier =
51
55
DefaultAccessTokenSupplier .newInstance (config .getAuthType (), tokenSourceFactory );
52
- CloudSqlInstanceName instanceName = new CloudSqlInstanceName (config .getCloudSqlInstance ());
53
56
54
57
this .refreshStrategy =
55
58
new LazyRefreshStrategy (
Original file line number Diff line number Diff line change @@ -48,12 +48,15 @@ public RefreshAheadConnectionInfoCache(
48
48
ListeningScheduledExecutorService executor ,
49
49
ListenableFuture <KeyPair > keyPair ,
50
50
long minRefreshDelayMs ) {
51
+
52
+ CloudSqlInstanceName instanceName =
53
+ new CloudSqlInstanceName (config .getCloudSqlInstance (), config .getDomainName ());
54
+
51
55
this .config = config ;
52
- this .instanceName = new CloudSqlInstanceName ( config . getCloudSqlInstance ()) ;
56
+ this .instanceName = instanceName ;
53
57
54
58
AccessTokenSupplier accessTokenSupplier =
55
59
DefaultAccessTokenSupplier .newInstance (config .getAuthType (), tokenSourceFactory );
56
- CloudSqlInstanceName instanceName = new CloudSqlInstanceName (config .getCloudSqlInstance ());
57
60
58
61
this .refreshStrategy =
59
62
new RefreshAheadStrategy (
You can’t perform that action at this time.
0 commit comments