Skip to content

Commit 1a42370

Browse files
committed
ARTEMIS-6034 Close the connection factory when the CLI perf client command ends
1 parent 012e63b commit 1a42370

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import io.netty.channel.EventLoop;
3232
import org.apache.activemq.artemis.cli.commands.ActionContext;
3333
import org.apache.activemq.artemis.cli.commands.messages.ConnectionProtocol;
34+
import org.apache.activemq.artemis.cli.factory.ConnectionFactoryClosable;
3435
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
3536
import picocli.CommandLine.Command;
3637
import picocli.CommandLine.Option;
@@ -98,7 +99,6 @@ public class PerfClientCommand extends PerfCommand {
9899
protected void onExecuteBenchmark(final ConnectionFactory producerConnectionFactory, final Destination[] jmsDestinations, final ActionContext context) throws Exception {
99100
final ConnectionProtocol listenerProtocol = Objects.requireNonNullElse(this.consumerProtocol, protocol);
100101
final String listenerUrl = Objects.requireNonNullElse(this.consumerUrl, brokerURL);
101-
final ConnectionFactory consumerConnectionFactory = createConnectionFactory(listenerUrl, user, password, null, listenerProtocol);
102102
if (consumerConnections == 0) {
103103
if (sharedSubscription > 0) {
104104
if (getClientID() == null) {
@@ -122,7 +122,8 @@ protected void onExecuteBenchmark(final ConnectionFactory producerConnectionFact
122122
boolean warmingUp = warmup != 0;
123123
final LiveStatistics statistics;
124124
final StringBuilder skratchBuffer = new StringBuilder();
125-
try (MessageListenerBenchmark consumerBenchmark = new MessageListenerBenchmarkBuilder()
125+
try (ConnectionFactoryClosable consumerConnectionFactory = createConnectionFactory(listenerUrl, user, password, null, listenerProtocol);
126+
MessageListenerBenchmark consumerBenchmark = new MessageListenerBenchmarkBuilder()
126127
.setClientID(getClientID())
127128
.setDestinations(consumerProtocol != null ? lookupDestinations(consumerConnectionFactory) : jmsDestinations)
128129
.setFactory(consumerConnectionFactory)

0 commit comments

Comments
 (0)