8000 Reduce the chance of hitting the same endpoint over and over when rec… · egolin/rabbitmq-java-client@12495f5 · GitHub 10000
[go: up one dir, main page]

Skip to content

Commit 12495f5

Browse files
Reduce the chance of hitting the same endpoint over and over when reconnecting
Constant re-shuffling produced confusing effects in that there was a chance of 3-4 re-connections to the same (often unreachable in practice) endpoint. Fixes rabbitmq#124.
1 parent 51cbfdf commit 12495f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public RecoveryAwareAMQConnectionFactory(ConnectionParams params, FrameHandlerFa
2929
*/
3030
RecoveryAwareAMQConnection newConnection() throws IOException, TimeoutException {
3131
IOException lastException = null;
32-
for (Address addr : shuffle(addrs)) {
32+
Address[] shuffled = shuffle(addrs);
33+
for (Address addr : shuffled) {
3334
try {
3435
FrameHandler frameHandler = factory.create(addr);
3536
RecoveryAwareAMQConnection conn = new RecoveryAwareAMQConnection(params, frameHandler);

0 commit comments

Comments
 (0)
0