Browse Source

Use CopyOnWriteArrayList for beforeCommit actions

Closes gh-27587
pull/31469/head
rstoyanchev 2 years ago
parent
commit
7271dfed68
  1. 6
      spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java

6
spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2022 the original author or authors. * Copyright 2002-2023 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@
package org.springframework.http.server.reactive; package org.springframework.http.server.reactive;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -69,7 +69,7 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
private final AtomicReference<State> state = new AtomicReference<>(State.NEW); private final AtomicReference<State> state = new AtomicReference<>(State.NEW);
private final List<Supplier<? extends Mono<Void>>> commitActions = new ArrayList<>(4); private final List<Supplier<? extends Mono<Void>>> commitActions = new CopyOnWriteArrayList<>();
@Nullable @Nullable
private HttpHeaders readOnlyHeaders; private HttpHeaders readOnlyHeaders;

Loading…
Cancel
Save