This is an automated email from the ASF dual-hosted git repository. gemmellr pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/artemis.git
commit d0426639124c58b79ecd20b2c6a0fd386e4ee36a Author: Domenico Francesco Bruscino <[email protected]> AuthorDate: Tue Apr 28 11:51:43 2026 +0200 ARTEMIS-6034 Close the connection factory when the CLI perf client command ends --- .../commands/messages/perf/PerfClientCommand.java | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java index dfb64c0dff..426a2d3513 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java @@ -31,6 +31,7 @@ import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.EventLoop; import org.apache.activemq.artemis.cli.commands.ActionContext; import org.apache.activemq.artemis.cli.commands.messages.ConnectionProtocol; +import org.apache.activemq.artemis.cli.factory.ConnectionFactoryClosable; import org.apache.activemq.artemis.jms.client.ActiveMQDestination; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -98,7 +99,6 @@ public class PerfClientCommand extends PerfCommand { protected void onExecuteBenchmark(final ConnectionFactory producerConnectionFactory, final Destination[] jmsDestinations, final ActionContext context) throws Exception { final ConnectionProtocol listenerProtocol = Objects.requireNonNullElse(this.consumerProtocol, protocol); final String listenerUrl = Objects.requireNonNullElse(this.consumerUrl, brokerURL); - final ConnectionFactory consumerConnectionFactory = createConnectionFactory(listenerUrl, user, password, null, listenerProtocol); if (consumerConnections == 0) { if (sharedSubscription > 0) { if (getClientID() == null) { @@ -122,17 +122,18 @@ public class PerfClientCommand extends PerfCommand { boolean warmingUp = warmup != 0; final LiveStatistics statistics; final StringBuilder skratchBuffer = new StringBuilder(); - try (MessageListenerBenchmark consumerBenchmark = new MessageListenerBenchmarkBuilder() - .setClientID(getClientID()) - .setDestinations(consumerProtocol != null ? lookupDestinations(consumerConnectionFactory) : jmsDestinations) - .setFactory(consumerConnectionFactory) - .setTransacted(transaction) - .setConsumers(consumersPerDestination) - .setConnections(consumerConnections) - .setTimeProvider(() -> TimeUnit.NANOSECONDS.toMicros(System.nanoTime())) - .setCanDelayMessageCount(true) - .setSharedSubscription(sharedSubscription) - .setDurableSubscription(durableSubscription) + try (ConnectionFactoryClosable consumerConnectionFactory = createConnectionFactory(listenerUrl, user, password, null, listenerProtocol); + MessageListenerBenchmark consumerBenchmark = new MessageListenerBenchmarkBuilder() + .setClientID(getClientID()) + .setDestinations(consumerProtocol != null ? lookupDestinations(consumerConnectionFactory) : jmsDestinations) + .setFactory(consumerConnectionFactory) + .setTransacted(transaction) + .setConsumers(consumersPerDestination) + .setConnections(consumerConnections) + .setTimeProvider(() -> TimeUnit.NANOSECONDS.toMicros(System.nanoTime())) + .setCanDelayMessageCount(true) + .setSharedSubscription(sharedSubscription) + .setDurableSubscription(durableSubscription) .createMessageListenerBenchmark()) { final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(threads) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
