State variables shared across threads in the transport need to be marked
volatile.
(cherry picked from commit 629ee28568)
This commit is contained in:
Timothy Bish 2016-11-02 12:57:39 -04:00
parent 3642ab1c10
commit ba1eab20d2
1 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ public class FailoverTransport implements CompositeTransport {
private static final int DEFAULT_INITIAL_RECONNECT_DELAY = 10; private static final int DEFAULT_INITIAL_RECONNECT_DELAY = 10;
private static final int INFINITE = -1; private static final int INFINITE = -1;
private TransportListener transportListener; private TransportListener transportListener;
private boolean disposed; private volatile boolean disposed;
private final CopyOnWriteArrayList<URI> uris = new CopyOnWriteArrayList<URI>(); private final CopyOnWriteArrayList<URI> uris = new CopyOnWriteArrayList<URI>();
private final CopyOnWriteArrayList<URI> updated = new CopyOnWriteArrayList<URI>(); private final CopyOnWriteArrayList<URI> updated = new CopyOnWriteArrayList<URI>();
@ -92,7 +92,7 @@ public class FailoverTransport implements CompositeTransport {
private final AtomicReference<Transport> connectedTransport = new AtomicReference<Transport>(); private final AtomicReference<Transport> connectedTransport = new AtomicReference<Transport>();
private final TaskRunnerFactory reconnectTaskFactory; private final TaskRunnerFactory reconnectTaskFactory;
private final TaskRunner reconnectTask; private final TaskRunner reconnectTask;
private boolean started; private volatile boolean started;
private long initialReconnectDelay = DEFAULT_INITIAL_RECONNECT_DELAY; private long initialReconnectDelay = DEFAULT_INITIAL_RECONNECT_DELAY;
private long maxReconnectDelay = 1000 * 30; private long maxReconnectDelay = 1000 * 30;
private double backOffMultiplier = 2d; private double backOffMultiplier = 2d;
@ -127,7 +127,7 @@ public class FailoverTransport implements CompositeTransport {
private final ArrayList<URI> priorityList = new ArrayList<URI>(); private final ArrayList<URI> priorityList = new ArrayList<URI>();
private boolean priorityBackupAvailable = false; private boolean priorityBackupAvailable = false;
private String nestedExtraQueryOptions; private String nestedExtraQueryOptions;
private boolean shuttingDown = false; private volatile boolean shuttingDown = false;
public FailoverTransport() { public FailoverTransport() {
brokerSslContext = SslContext.getCurrentSslContext(); brokerSslContext = SslContext.getCurrentSslContext();