Skip to content

Commit b7c536d

Browse files
committed
Merge branch '2.1.x-stable'
2 parents cced914 + 36acb10 commit b7c536d

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/main/java/com/rabbitmq/perf/MulticastSet.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,17 @@ public void run(boolean announceStartup)
182182

183183
this.completionHandler.waitForCompletion();
184184

185-
int count = 1; // counting the threads
186-
for (int i = 0; i < producerStates.length; i++) {
187-
producerStates[i].task.cancel(true);
188-
if(count % params.getProducerChannelCount() == 0) {
189-
// this is the end of a group of threads on the same connection,
190-
// closing the connection
191-
try {
192-
producerConnections[count / params.getProducerChannelCount() - 1].close();
193-
} catch (Exception e) {
194-
// don't do anything, we need to close the other connections
195-
}
185+
for (AgentState producerState : producerStates) {
186+
producerState.task.cancel(true);
187+
}
196188

189+
for (Connection producerConnection : producerConnections) {
190+
try {
191+
producerConnection.close();
192+
} catch (Exception e) {
193+
// don't do anything, we need to close the other connections
197194
}
198-
count++;
195+
199196
}
200197

201198
for (Connection consumerConnection : consumerConnections) {

0 commit comments

Comments
 (0)