File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ private static String nextDatabaseClientId(DatabaseId databaseId) {
9292

9393
private final CloseableExecutorProvider asyncExecutorProvider;
9494

95-
@GuardedBy("this")
96-
private final List<DatabaseClientImpl> invalidatedDbClients = new ArrayList<>();
97-
9895
@GuardedBy("this")
9996
private final Map<DatabaseId, SessionClient> sessionClients = new HashMap<>();
10097

@@ -204,9 +201,8 @@ public DatabaseClient getDatabaseClient(DatabaseId db) {
204201
checkClosed();
205202
String clientId = null;
206203
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());
210206
clientId = dbClients.get(db).clientId;
211207
dbClients.remove(db);
212208
}
@@ -253,8 +249,7 @@ void close(long timeout, TimeUnit unit) {
253249
checkClosed();
254250
closedException = new ClosedException();
255251
closureFutures = new ArrayList<>();
256-
invalidatedDbClients.addAll(dbClients.values());
257-
for (DatabaseClientImpl dbClient : invalidatedDbClients) {
252+
for (DatabaseClientImpl dbClient : dbClients.values()) {
258253
closureFutures.add(dbClient.closeAsync(closedException));
259254
}
260255
dbClients.clear();

0 commit comments

Comments
 (0)