Skip to content

Commit 3f9d479

Browse files
committed
Double-checked lock in ChannelSendOperator#request
Closes gh-31865
1 parent 338922f commit 3f9d479

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/ChannelSendOperator.java

+4
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ public void request(long n) {
281281
return;
282282
}
283283
synchronized (this) {
284+
if (this.state == State.READY_TO_WRITE) {
285+
s.request(n);
286+
return;
287+
}
284288
if (this.writeSubscriber != null) {
285289
if (this.state == State.EMITTING_CACHED_SIGNALS) {
286290
this.demandBeforeReadyToWrite = n;

Diff for: spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java

+4
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ public void request(long n) {
273273
return;
274274
}
275275
synchronized (this) {
276+
if (this.state == State.READY_TO_WRITE) {
277+
s.request(n);
278+
return;
279+
}
276280
if (this.writeSubscriber != null) {
277281
if (this.state == State.EMITTING_CACHED_SIGNALS) {
278282
this.demandBeforeReadyToWrite = n;

0 commit comments

Comments
 (0)