Commit 9c82d5c3 authored by Madhura Bhave's avatar Madhura Bhave

Make ApplicationContextServerWebExchangeMatcher and subclasses thread-safe

Fixes gh-14161
parent cafff430
...@@ -125,7 +125,7 @@ public final class EndpointRequest { ...@@ -125,7 +125,7 @@ public final class EndpointRequest {
private final boolean includeLinks; private final boolean includeLinks;
private ServerWebExchangeMatcher delegate; private volatile ServerWebExchangeMatcher delegate;
private EndpointServerWebExchangeMatcher(boolean includeLinks) { private EndpointServerWebExchangeMatcher(boolean includeLinks) {
this(Collections.emptyList(), Collections.emptyList(), includeLinks); this(Collections.emptyList(), Collections.emptyList(), includeLinks);
...@@ -246,7 +246,7 @@ public final class EndpointRequest { ...@@ -246,7 +246,7 @@ public final class EndpointRequest {
public static final class LinksServerWebExchangeMatcher public static final class LinksServerWebExchangeMatcher
extends ApplicationContextServerWebExchangeMatcher<WebEndpointProperties> { extends ApplicationContextServerWebExchangeMatcher<WebEndpointProperties> {
private ServerWebExchangeMatcher delegate; private volatile ServerWebExchangeMatcher delegate;
private LinksServerWebExchangeMatcher() { private LinksServerWebExchangeMatcher() {
super(WebEndpointProperties.class); super(WebEndpointProperties.class);
......
...@@ -70,8 +70,9 @@ public abstract class ApplicationContextServerWebExchangeMatcher<C> ...@@ -70,8 +70,9 @@ public abstract class ApplicationContextServerWebExchangeMatcher<C>
if (this.context == null) { if (this.context == null) {
synchronized (this.contextLock) { synchronized (this.contextLock) {
if (this.context == null) { if (this.context == null) {
this.context = createContext(exchange); Supplier<C> createdContext = createContext(exchange);
initialized(this.context); initialized(createdContext);
this.context = createdContext;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment