mirror of
https://github.com/apache/activemq.git
synced 2025-02-28 13:19:07 +00:00
Merge pull request #741 from mattrpav/AMQ-8443
[AMQ-8443] Allow reconnect command to work
This commit is contained in:
commit
4ddb4ae6c6
@ -122,6 +122,7 @@ public class FailoverTransport implements CompositeTransport {
|
|||||||
private String updateURIsURL = null;
|
private String updateURIsURL = null;
|
||||||
private boolean rebalanceUpdateURIs = true;
|
private boolean rebalanceUpdateURIs = true;
|
||||||
private boolean doRebalance = false;
|
private boolean doRebalance = false;
|
||||||
|
private boolean doReconnect = false;
|
||||||
private boolean connectedToPriority = false;
|
private boolean connectedToPriority = false;
|
||||||
|
|
||||||
private boolean priorityBackup = false;
|
private boolean priorityBackup = false;
|
||||||
@ -751,6 +752,7 @@ public class FailoverTransport implements CompositeTransport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(boolean rebalance, URI u[]) {
|
public void remove(boolean rebalance, URI u[]) {
|
||||||
for (URI uri : u) {
|
for (URI uri : u) {
|
||||||
@ -943,7 +945,7 @@ public class FailoverTransport implements CompositeTransport {
|
|||||||
failure = new IOException("No uris available to connect to.");
|
failure = new IOException("No uris available to connect to.");
|
||||||
} else {
|
} else {
|
||||||
if (doRebalance) {
|
if (doRebalance) {
|
||||||
if (connectedToPriority || compareURIs(connectList.get(0), connectedTransportURI)) {
|
if (connectedToPriority || (!doReconnect && compareURIs(connectList.get(0), connectedTransportURI))) {
|
||||||
// already connected to first in the list, no need to rebalance
|
// already connected to first in the list, no need to rebalance
|
||||||
doRebalance = false;
|
doRebalance = false;
|
||||||
return false;
|
return false;
|
||||||
@ -958,6 +960,7 @@ public class FailoverTransport implements CompositeTransport {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.debug("Caught an exception stopping existing transport for rebalance", e);
|
LOG.debug("Caught an exception stopping existing transport for rebalance", e);
|
||||||
}
|
}
|
||||||
|
doReconnect = false;
|
||||||
}
|
}
|
||||||
doRebalance = false;
|
doRebalance = false;
|
||||||
}
|
}
|
||||||
@ -1256,6 +1259,8 @@ public class FailoverTransport implements CompositeTransport {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reconnect(URI uri) throws IOException {
|
public void reconnect(URI uri) throws IOException {
|
||||||
|
uris.clear();
|
||||||
|
doReconnect = true;
|
||||||
add(true, new URI[]{uri});
|
add(true, new URI[]{uri});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user