File tree
Expand file treeCollapse file tree1 file changed
+3
-8
lines changed google-cloud-spanner/src/main/java/com/google/cloud/spanner
Expand file treeCollapse file tree1 file changed
+3
-8
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -92,9 +92,6 @@ private static String nextDatabaseClientId(DatabaseId databaseId) {
|
92 | 92 |
|
93 | 93 | private final CloseableExecutorProvider asyncExecutorProvider;
|
94 | 94 |
|
95 |
| -@GuardedBy("this") |
96 |
| -private final List<DatabaseClientImpl> invalidatedDbClients = new ArrayList<>(); |
97 |
| - |
98 | 95 | @GuardedBy("this")
|
99 | 96 | private final Map<DatabaseId, SessionClient> sessionClients = new HashMap<>();
|
100 | 97 |
|
@@ -204,9 +201,8 @@ public DatabaseClient getDatabaseClient(DatabaseId db) {
|
204 | 201 | checkClosed();
|
205 | 202 | String clientId = null;
|
206 | 203 | if (dbClients.containsKey(db) && !dbClients.get(db).pool.isValid()) {
|
207 |
| -// Move the invalidated client to a separate list, so we can close it together with the |
208 |
| -// other database clients when the Spanner instance is closed. |
209 |
| -invalidatedDbClients.add(dbClients.get(db)); |
| 204 | +// Close the invalidated client and remove it. |
| 205 | +dbClients.get(db).closeAsync(new ClosedException()); |
210 | 206 | clientId = dbClients.get(db).clientId;
|
211 | 207 | dbClients.remove(db);
|
212 | 208 | }
|
@@ -253,8 +249,7 @@ void close(long timeout, TimeUnit unit) {
|
253 | 249 | checkClosed();
|
254 | 250 | closedException = new ClosedException();
|
255 | 251 | closureFutures = new ArrayList<>();
|
256 |
| -invalidatedDbClients.addAll(dbClients.values()); |
257 |
| -for (DatabaseClientImpl dbClient : invalidatedDbClients) { |
| 252 | +for (DatabaseClientImpl dbClient : dbClients.values()) { |
258 | 253 | closureFutures.add(dbClient.closeAsync(closedException));
|
259 | 254 | }
|
260 | 255 | dbClients.clear();
|
|
You can’t perform that action at this time.
0 commit comments