mirror of https://github.com/apache/activemq.git
use a separate mutex for building backups
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@636425 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
712254d5d2
commit
cb65470569
|
@ -68,6 +68,7 @@ public class FailoverTransport implements CompositeTransport {
|
||||||
private final CopyOnWriteArrayList<URI> uris = new CopyOnWriteArrayList<URI>();
|
private final CopyOnWriteArrayList<URI> uris = new CopyOnWriteArrayList<URI>();
|
||||||
|
|
||||||
private final Object reconnectMutex = new Object();
|
private final Object reconnectMutex = new Object();
|
||||||
|
private final Object backupMutex = new Object();
|
||||||
private final Object sleepMutex = new Object();
|
private final Object sleepMutex = new Object();
|
||||||
private final ConnectionStateTracker stateTracker = new ConnectionStateTracker();
|
private final ConnectionStateTracker stateTracker = new ConnectionStateTracker();
|
||||||
private final ConcurrentHashMap<Integer, Command> requestMap = new ConcurrentHashMap<Integer, Command>();
|
private final ConcurrentHashMap<Integer, Command> requestMap = new ConcurrentHashMap<Integer, Command>();
|
||||||
|
@ -633,6 +634,7 @@ public class FailoverTransport implements CompositeTransport {
|
||||||
if (!useExponentialBackOff) {
|
if (!useExponentialBackOff) {
|
||||||
reconnectDelay = initialReconnectDelay;
|
reconnectDelay = initialReconnectDelay;
|
||||||
}
|
}
|
||||||
|
synchronized(backupMutex) {
|
||||||
if (backup && !backups.isEmpty()) {
|
if (backup && !backups.isEmpty()) {
|
||||||
BackupTransport bt = backups.remove(0);
|
BackupTransport bt = backups.remove(0);
|
||||||
Transport t = bt.getTransport();
|
Transport t = bt.getTransport();
|
||||||
|
@ -654,6 +656,7 @@ public class FailoverTransport implements CompositeTransport {
|
||||||
LOG.debug("Backup transport failed",e);
|
LOG.debug("Backup transport failed",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<URI> iter = connectList.iterator();
|
Iterator<URI> iter = connectList.iterator();
|
||||||
while(iter.hasNext() && connectedTransport.get() == null && !disposed) {
|
while(iter.hasNext() && connectedTransport.get() == null && !disposed) {
|
||||||
|
@ -742,7 +745,7 @@ public class FailoverTransport implements CompositeTransport {
|
||||||
|
|
||||||
|
|
||||||
final boolean buildBackups() {
|
final boolean buildBackups() {
|
||||||
synchronized (reconnectMutex) {
|
synchronized (backupMutex) {
|
||||||
if (!disposed && backup && backups.size() < backupPoolSize) {
|
if (!disposed && backup && backups.size() < backupPoolSize) {
|
||||||
List<URI> connectList = getConnectList();
|
List<URI> connectList = getConnectList();
|
||||||
//removed disposed backups
|
//removed disposed backups
|
||||||
|
|
Loading…
Reference in New Issue