Skip to content

Commit c770b77

Browse files
committed
feat: support option for setting client-id
1 parent 27c1d95 commit c770b77

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

google-cloud-spanner/clirr-ignored-differences.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,4 +957,11 @@
957957
<className>com/google/cloud/spanner/DatabaseClient</className>
958958
<method>com.google.cloud.spanner.Statement$StatementFactory getStatementFactory()</method>
959959
</difference>
960+
961+
<difference>
962+
<differenceType>7012</differenceType>
963+
<className>com/google/cloud/spanner/Spanner</className>
964+
<method>com.google.cloud.spanner.DatabaseClient getDatabaseClient(com.google.cloud.spanner.DatabaseId, java.lang.String)</method>
965+
<justification>Added as default method for JDBC client ID support. Default implementation throws UnsupportedOperationException to maintain binary compatibility for existing implementers.</justification>
966+
</difference>
960967
</differences>

google-cloud-spanner/src/main/java/com/google/cloud/spanner/Spanner.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ public interface Spanner extends Service<SpannerOptions>, AutoCloseable {
145145
*
146146
* <!--SNIPPET get_db_client-->
147147
*/
148-
DatabaseClient getDatabaseClient(DatabaseId db, String clientId);
148+
default DatabaseClient getDatabaseClient(DatabaseId db, String clientId) {
149+
throw new UnsupportedOperationException("getDatabaseClient with clientId is not supported by this default implementation.");
150+
}
149151

150152
/**
151153
* Returns a {@code BatchClient} to do batch operations on Cloud Spanner databases. Batch client

google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public DatabaseClient getDatabaseClient(DatabaseId db) {
257257
return getDatabaseClient(db, null);
258258
}
259259

260+
@Override
260261
public DatabaseClient getDatabaseClient(DatabaseId db, String clientId) {
261262
synchronized (this) {
262263
checkClosed();

0 commit comments

Comments
 (0)