Consistent volatile access to running flag in Lifecycle implementations
Issue: SPR-16488
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ public class JettyWebSocketClient extends WebSocketClientSupport implements WebS
|
||||
|
||||
private final boolean externallyManaged;
|
||||
|
||||
private boolean running = false;
|
||||
private volatile boolean running = false;
|
||||
|
||||
private final Object lifecycleMonitor = new Object();
|
||||
|
||||
@@ -135,9 +135,7 @@ public class JettyWebSocketClient extends WebSocketClientSupport implements WebS
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
synchronized (this.lifecycleMonitor) {
|
||||
return this.running;
|
||||
}
|
||||
return this.running;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -135,10 +135,6 @@ public class HandshakeWebSocketService implements WebSocketService, Lifecycle {
|
||||
return this.upgradeStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
@@ -168,6 +164,11 @@ public class HandshakeWebSocketService implements WebSocketService, Lifecycle {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Mono<Void> handleRequest(ServerWebExchange exchange, WebSocketHandler handler) {
|
||||
|
||||
Reference in New Issue
Block a user