Skip to content

Commit b7f638c

Browse files
sagnghosrahul2393
andauthored
chore: enable experimentalHost support for pgAdapter (#3883)
Co-authored-by: rahul2393 <[email protected]>
1 parent f3b00b6 commit b7f638c

File tree

1 file changed

+9
-2
lines changed
  • google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection

1 file changed

+9
-2
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerPool.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ static class SpannerPoolKey {
163163
private final boolean enableEndToEndTracing;
164164
private final String clientCertificate;
165165
private final String clientCertificateKey;
166+
private final boolean isExperimentalHost;
166167

167168
@VisibleForTesting
168169
static SpannerPoolKey of(ConnectionOptions options) {
@@ -196,6 +197,7 @@ private SpannerPoolKey(ConnectionOptions options) throws IOException {
196197
this.enableEndToEndTracing = options.isEndToEndTracingEnabled();
197198
this.clientCertificate = options.getClientCertificate();
198199
this.clientCertificateKey = options.getClientCertificateKey();
200+
this.isExperimentalHost = options.isExperimentalHost();
199201
}
200202

201203
@Override
@@ -220,7 +222,8 @@ public boolean equals(Object o) {
220222
&& Objects.equals(this.enableApiTracing, other.enableApiTracing)
221223
&& Objects.equals(this.enableEndToEndTracing, other.enableEndToEndTracing)
222224
&& Objects.equals(this.clientCertificate, other.clientCertificate)
223-
&& Objects.equals(this.clientCertificateKey, other.clientCertificateKey);
225+
&& Objects.equals(this.clientCertificateKey, other.clientCertificateKey)
226+
&& Objects.equals(this.isExperimentalHost, other.isExperimentalHost);
224227
}
225228

226229
@Override
@@ -241,7 +244,8 @@ public int hashCode() {
241244
this.enableApiTracing,
242245
this.enableEndToEndTracing,
243246
this.clientCertificate,
244-
this.clientCertificateKey);
247+
this.clientCertificateKey,
248+
this.isExperimentalHost);
245249
}
246250
}
247251

@@ -405,6 +409,9 @@ Spanner createSpanner(SpannerPoolKey key, ConnectionOptions options) {
405409
if (key.clientCertificate != null && key.clientCertificateKey != null) {
406410
builder.useClientCert(key.clientCertificate, key.clientCertificateKey);
407411
}
412+
if (key.isExperimentalHost) {
413+
builder.setExperimentalHost(key.host);
414+
}
408415
if (options.getConfigurator() != null) {
409416
options.getConfigurator().configure(builder);
410417
}

0 commit comments

Comments
 (0)