Double-checked lock in ChannelSendOperator#request

Closes gh-31865
This commit is contained in:
rstoyanchev 2024-01-12 17:15:06 +00:00
parent 2a43cc7574
commit 47779d6a53
2 changed files with 8 additions and 0 deletions

View File

@ -281,6 +281,10 @@ class ChannelSendOperator<T> extends Mono<Void> implements Scannable {
return;
}
synchronized (this) {
if (this.state == State.READY_TO_WRITE) {
s.request(n);
return;
}
if (this.writeSubscriber != null) {
if (this.state == State.EMITTING_CACHED_SIGNALS) {
this.demandBeforeReadyToWrite = n;

View File

@ -273,6 +273,10 @@ public class ChannelSendOperator<T> extends Mono<Void> implements Scannable {
return;
}
synchronized (this) {
if (this.state == State.READY_TO_WRITE) {
s.request(n);
return;
}
if (this.writeSubscriber != null) {
if (this.state == State.EMITTING_CACHED_SIGNALS) {
this.demandBeforeReadyToWrite = n;