activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-5558 change on producer / consumer - One session per thread
Date Mon, 03 Aug 2015 16:18:12 GMT
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 <clebertsuconic@apache.org>
Authored: Fri Jun 26 10:19:21 2015 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
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);


Mime
View raw message