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-19 16:31:54 -07:00 committed by Sébastien Deleuze
parent 051adf267f
commit e834a3a80c
8 changed files with 10 additions and 9 deletions

View File

@ -137,7 +137,7 @@ final class OutputStreamPublisher<T> implements 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;

View File

@ -72,7 +72,7 @@ final class SubscriberInputStream extends InputStream implements Subscriber<Data
private final Queue<DataBuffer> queue;
private final AtomicReference<Object> parkedThread = new AtomicReference<>();
private final AtomicReference<@Nullable Object> parkedThread = new AtomicReference<>();
private final AtomicInteger workAmount = new AtomicInteger();

View File

@ -73,7 +73,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory
private @Nullable Boolean autoCommit;
/** Wrapped Connection. */
private final AtomicReference<Connection> target = new AtomicReference<>();
private final AtomicReference<@Nullable Connection> target = new AtomicReference<>();
/** Proxy Connection. */
private @Nullable Connection connection;

View File

@ -54,7 +54,7 @@ class DefaultMvcResult implements MvcResult {
private @Nullable Exception resolvedException;
private final AtomicReference<Object> asyncResult = new AtomicReference<>(RESULT_NONE);
private final AtomicReference<@Nullable Object> asyncResult = new AtomicReference<>(RESULT_NONE);
private @Nullable CountDownLatch asyncDispatchLatch;

View File

@ -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;

View File

@ -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) {

View File

@ -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();

View File

@ -256,7 +256,7 @@ class ReactiveTypeHandler {
private @Nullable Subscription subscription;
private final AtomicReference<Object> elementRef = new AtomicReference<>();
private final AtomicReference<@Nullable Object> elementRef = new AtomicReference<>();
private @Nullable Throwable error;