Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6DA991892F for ; Mon, 3 Aug 2015 16:18:12 +0000 (UTC) Received: (qmail 3903 invoked by uid 500); 3 Aug 2015 16:18:12 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 3860 invoked by uid 500); 3 Aug 2015 16:18:12 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 3851 invoked by uid 99); 3 Aug 2015 16:18:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Aug 2015 16:18:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 38A38E0063; Mon, 3 Aug 2015 16:18:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: activemq git commit: https://issues.apache.org/jira/browse/AMQ-5558 change on producer / consumer - One session per thread Date: Mon, 3 Aug 2015 16:18:12 +0000 (UTC) Repository: activemq Updated Branches: refs/heads/master b64b8ba27 -> c5579ff73 https://issues.apache.org/jira/browse/AMQ-5558 change on producer / consumer - One session per thread I'm backporting a change I have made into Artemis for this. Each thread should have its own JMS Session Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/c5579ff7 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/c5579ff7 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/c5579ff7 Branch: refs/heads/master Commit: c5579ff73dfc0ef39976d6553f0f99c9ac598886 Parents: b64b8ba Author: Clebert Suconic Authored: Fri Jun 26 10:19:21 2015 -0400 Committer: Clebert Suconic Committed: Mon Aug 3 12:17:28 2015 -0400 ---------------------------------------------------------------------- .../activemq/console/command/ConsumerCommand.java | 13 ++++++------- .../activemq/console/command/ProducerCommand.java | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/c5579ff7/activemq-console/src/main/java/org/apache/activemq/console/command/ConsumerCommand.java ---------------------------------------------------------------------- diff --git a/activemq-console/src/main/java/org/apache/activemq/console/command/ConsumerCommand.java b/activemq-console/src/main/java/org/apache/activemq/console/command/ConsumerCommand.java index 9439f95..8c677cc 100644 --- a/activemq-console/src/main/java/org/apache/activemq/console/command/ConsumerCommand.java +++ b/activemq-console/src/main/java/org/apache/activemq/console/command/ConsumerCommand.java @@ -60,17 +60,16 @@ public class ConsumerCommand extends AbstractCommand { } conn.start(); - Session sess; - if (transacted) { - sess = conn.createSession(true, Session.SESSION_TRANSACTED); - } else { - sess = conn.createSession(false, ackMode); - } - CountDownLatch active = new CountDownLatch(parallelThreads); for (int i = 1; i <= parallelThreads; i++) { + Session sess; + if (transacted) { + sess = conn.createSession(true, Session.SESSION_TRANSACTED); + } else { + sess = conn.createSession(false, ackMode); + } ConsumerThread consumer = new ConsumerThread(sess, ActiveMQDestination.createDestination(destination, ActiveMQDestination.QUEUE_TYPE)); consumer.setName("consumer-" + i); consumer.setDurable(durable); http://git-wip-us.apache.org/repos/asf/activemq/blob/c5579ff7/activemq-console/src/main/java/org/apache/activemq/console/command/ProducerCommand.java ---------------------------------------------------------------------- diff --git a/activemq-console/src/main/java/org/apache/activemq/console/command/ProducerCommand.java b/activemq-console/src/main/java/org/apache/activemq/console/command/ProducerCommand.java index 8138a2c..ab1ad2b 100644 --- a/activemq-console/src/main/java/org/apache/activemq/console/command/ProducerCommand.java +++ b/activemq-console/src/main/java/org/apache/activemq/console/command/ProducerCommand.java @@ -60,16 +60,15 @@ public class ProducerCommand extends AbstractCommand { conn = factory.createConnection(user, password); conn.start(); - Session sess; - if (transactionBatchSize != 0) { - sess = conn.createSession(true, Session.SESSION_TRANSACTED); - } else { - sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - } - CountDownLatch active = new CountDownLatch(parallelThreads); for (int i = 1; i <= parallelThreads; i++) { + Session sess; + if (transactionBatchSize != 0) { + sess = conn.createSession(true, Session.SESSION_TRANSACTED); + } else { + sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); + } ProducerThread producer = new ProducerThread(sess, ActiveMQDestination.createDestination(destination, ActiveMQDestination.QUEUE_TYPE)); producer.setName("producer-" + i); producer.setMessageCount(messageCount);