Skip to content

Commit 44662ca

Browse files
fix(bigtable): resolve circular deadlock on close in SwitchingChannelPool
1 parent fe81dfe commit 44662ca

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

  • java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/channels

java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/channels/SwitchingChannelPool.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,18 @@ public synchronized void start() {
162162
}
163163

164164
@Override
165-
public synchronized void close() {
166-
if (isClosed) {
167-
return;
168-
}
169-
165+
public void close() {
170166
configListener.close();
171-
delegate.close();
172-
isClosed = true;
167+
ChannelPool cp;
168+
synchronized (this) {
169+
if (isClosed) {
170+
return;
171+
}
172+
173+
cp = delegate;
174+
isClosed = true;
175+
}
176+
cp.close();
173177
}
174178

175179
@Override

0 commit comments

Comments
 (0)