File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/main/java/com/rabbitmq/perf Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -122,14 +122,26 @@ public void run(boolean announceStartup)
122122 producerThread .start ();
123123 }
124124
125+ int count = 1 ; // counting the threads
125126 for (int i = 0 ; i < producerThreads .length ; i ++) {
126127 producerThreads [i ].join ();
127- producerConnections [i ].close ();
128+ if (count % params .getProducerChannelCount () == 0 ) {
129+ // this is the end of a group of threads on the same connection,
130+ // closing the connection
131+ producerConnections [count / params .getProducerChannelCount () - 1 ].close ();
132+ }
133+ count ++;
128134 }
129135
136+ count = 1 ; // counting the threads
130137 for (int i = 0 ; i < consumerThreads .length ; i ++) {
131138 consumerThreads [i ].join ();
132- consumerConnections [i ].close ();
139+ if (count % params .getConsumerChannelCount () == 0 ) {
140+ // this is the end of a group of threads on the same connection,
141+ // closing the connection
142+ consumerConnections [count / params .getConsumerChannelCount () - 1 ].close ();
143+ }
144+ count ++;
133145 }
134146 }
135147
You can’t perform that action at this time.
0 commit comments