Skip to content

Commit 66a9df8

Browse files
chore: delete CloseableMonitor
errorprone is removing support for the annotation this uses
1 parent 5a05c3f commit 66a9df8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/SingleConnection.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,15 @@ protected synchronized void sendToStream(StreamRequestT request) {
103103
}
104104

105105
protected void sendToClient(ClientResponseT response) {
106-
if (isCompleted()) {
107-
log.atFine().log("Sent response after stream completion: %s", response);
108-
return;
106+
synchronized (this) {
107+
if (isCompleted()) {
108+
log.atFine().log("Sent response after stream completion: %s", response);
109+
return;
110+
}
111+
// This should be impossible to not have received the initial request, or be completed, and
112+
// the caller has access to this object.
113+
Preconditions.checkState(didReceiveInitial());
109114
}
110-
// This should be impossible to not have received the initial request, or be completed, and
111-
// the caller has access to this object.
112-
Preconditions.checkState(didReceiveInitial());
113115
// The upcall may be reentrant, possibly on another thread while this thread is blocked.
114116
clientStream.onResponse(response);
115117
}

0 commit comments

Comments
 (0)