Nullability fixes for AtomicReference variables

Closes gh-35514
Signed-off-by: Manu Sridharan <msridhar@gmail.com>
This commit is contained in:
Manu Sridharan
2025-09-25 07:39:44 +02:00
committed by Sébastien Deleuze
parent 051adf267f
commit e834a3a80c
8 changed files with 10 additions and 9 deletions
@@ -135,7 +135,7 @@ final class OutputStreamPublisher<T> implements Flow.Publisher<T> {
private final AtomicLong requested = new AtomicLong();
private final AtomicReference<Object> parkedThread = new AtomicReference<>();
private final AtomicReference<@Nullable Object> parkedThread = new AtomicReference<>();
private volatile @Nullable Throwable error;
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URI;
import java.time.Duration;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicReference;
@@ -131,13 +132,13 @@ final class ReactorClientHttpRequest extends AbstractStreamingClientHttpRequest
return Mono.empty();
}
AtomicReference<Executor> executorRef = new AtomicReference<>();
AtomicReference<@Nullable Executor> executorRef = new AtomicReference<>();
return outbound
.withConnection(connection -> executorRef.set(connection.channel().eventLoop()))
.send(FlowAdapters.toPublisher(new OutputStreamPublisher<>(
os -> body.writeTo(StreamUtils.nonClosing(os)), new ByteBufMapper(outbound),
executorRef.getAndSet(null), null)));
Objects.requireNonNull(executorRef.getAndSet(null)), null)));
}
static IOException convertException(RuntimeException ex) {
@@ -81,7 +81,7 @@ final class SubscriberInputStream<T> extends InputStream implements Flow.Subscri
private final Queue<T> queue;
private final AtomicReference<Object> parkedThread = new AtomicReference<>();
private final AtomicReference<@Nullable Object> parkedThread = new AtomicReference<>();
private final AtomicInteger workAmount = new AtomicInteger();