Consistent volatile access to running flag in Lifecycle implementations

Issue: SPR-16488
This commit is contained in:
Juergen Hoeller
2018-03-15 15:17:55 +01:00
parent b8d94f8a20
commit d4a8f76bf9
18 changed files with 97 additions and 136 deletions

View File

@@ -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.
@@ -80,7 +80,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
private boolean active = false;
private boolean running = false;
private volatile boolean running = false;
private final List<Object> pausedTasks = new LinkedList<>();
@@ -350,9 +350,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
*/
@Override
public final boolean isRunning() {
synchronized (this.lifecycleMonitor) {
return (this.running && runningAllowed());
}
return (this.running && runningAllowed());
}
/**