File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -103,13 +103,15 @@ protected synchronized void sendToStream(StreamRequestT request) {
103
103
}
104
104
105
105
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 ());
109
114
}
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 ());
113
115
// The upcall may be reentrant, possibly on another thread while this thread is blocked.
114
116
clientStream .onResponse (response );
115
117
}
You can’t perform that action at this time.
0 commit comments