File tree Expand file tree Collapse file tree
branches/lesv-patch-1/google-cloud-spanner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ refs/tags/v0.22.0: 18b298fe4bfe8ec2f20b0e0bf7ffdcce5cc3c5fe
6666refs/heads/vam-google-patch-1: d0c8fee3a4074d0bf7360ce8c4f7f7223d0ee7b9
6767refs/heads/vam-google-patch-CODEOWNERS: 2ac1616e25229e51d08a984708ef1918f91a35ee
6868refs/heads/danoscarmike-patch-1: 7342a9916bce4ed00002c7202e2a16c5d46afaea
69- refs/heads/lesv-patch-1: 029b8da8df914135807ae8104adcb2f56634c67a
69+ refs/heads/lesv-patch-1: a93e3e37f94822ec60e49f53f0d40421005e739d
7070refs/heads/ml-update-branch: 079dd6610017f5c51b9d1938c12d6d55b61513cf
7171refs/heads/vkedia-patch-2: 7d8241388a9769a5c069334761b06c7012c878e7
7272refs/heads/vkedia-patch-3: 4d128043acaa7db9160faf439d2ca6104e8a88cb
Original file line number Diff line number Diff line change @@ -85,14 +85,15 @@ try {
8585 DatabaseClient dbClient = spanner. getDatabaseClient(
8686 DatabaseId . of(options. getProjectId(), instance, database));
8787 // Queries the database
88- ResultSet resultSet = dbClient. singleUse(). executeQuery(Statement . of(" SELECT 1" ));
89- // Prints the results
90- while (resultSet. next()) {
91- System . out. printf(" %d\n " , resultSet. getLong(0 ));
88+ try (ResultSet resultSet = dbClient. singleUse(). executeQuery(Statement . of(" SELECT 1" ))) {
89+ // Prints the results
90+ while (resultSet. next()) {
91+ System . out. printf(" %d\n " , resultSet. getLong(0 ));
92+ }
9293 }
9394} finally {
9495 // Closes the client which will free up the resources used
95- spanner. closeAsync() . get ();
96+ spanner. close ();
9697}
9798```
9899
You can’t perform that action at this time.
0 commit comments