Skip to content

Commit 85bd0cf

Browse files
authored
docs: close Spanner instance when it is no longer needed (#1116)
The CreateInstance example opened a Spanner instance without closing it. That was spamming the test logs with a lot of warnings.
1 parent 47f5965 commit 85bd0cf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

samples/snippets/src/main/java/com/example/spanner/CreateInstanceExample.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ static void createInstance(String projectId, String instanceId) {
6565
instanceInfo.getId(), e.getMessage());
6666
} catch (InterruptedException e) {
6767
System.out.println("Error: Waiting for createInstance operation to finish was interrupted");
68+
} finally {
69+
spanner.close();
6870
}
6971
}
7072
}

0 commit comments

Comments
 (0)