Skip to content

Commit 56d92ba

Browse files
committed
establish all connections before starting producer/consumer threads
...since connection establishment can be delayed significantly when there are busy producer/consumer threads.
1 parent 3c5e8a4 commit 56d92ba

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/src/com/rabbitmq/examples/MulticastMain.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ public static void main(String[] args) {
122122
consumerTxSize, autoAck,
123123
stats, timeLimit));
124124
consumerThreads[i] = t;
125-
t.start();
126125
}
127126
Thread[] producerThreads = new Thread[producerCount];
128127
Connection[] producerConnections = new Connection[producerCount];
@@ -144,7 +143,14 @@ public static void main(String[] args) {
144143
channel.addConfirmListener(p);
145144
Thread t = new Thread(p);
146145
producerThreads[i] = t;
147-
t.start();
146+
}
147+
148+
for (int i = 0; i < consumerCount; i++) {
149+
consumerThreads[i].start();
150+
}
151+
152+
for (int i = 0; i < producerCount; i++) {
153+
producerThreads[i].start();
148154
}
149155

150156
for (int i = 0; i < producerCount; i++) {

0 commit comments

Comments
 (0)