You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/01/28 13:54:55 UTC

qpid-jms git commit: add some notes/questions/comments

Repository: qpid-jms
Updated Branches:
  refs/heads/master 05fb16ec8 -> b91a2950b


add some notes/questions/comments


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/b91a2950
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/b91a2950
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/b91a2950

Branch: refs/heads/master
Commit: b91a2950b627b8d7ec012fc2cf2fc844cd009447
Parents: 05fb16e
Author: Robert Gemmell <ro...@apache.org>
Authored: Wed Jan 28 12:54:35 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Wed Jan 28 12:54:35 2015 +0000

----------------------------------------------------------------------
 .../apache/qpid/jms/JmsLocalTransactionContext.java  | 15 ++++++++++++++-
 .../java/org/apache/qpid/jms/JmsMessageConsumer.java |  1 +
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b91a2950/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java
index 886ac5f..a7dc974 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java
@@ -54,6 +54,8 @@ public class JmsLocalTransactionContext implements JmsTransactionContext {
     public void send(JmsConnection connection, JmsOutboundMessageDispatch envelope) throws JMSException {
         // TODO - Optional throw an exception here to give early warning that
         //        the transaction is in a failed state and must be rolled back.
+
+        //TODO: Is it worth holding the producer here (or earlier) while recovery is known to be in progress?
         if (!isFailed()) {
             begin();
             connection.send(envelope);
@@ -66,6 +68,13 @@ public class JmsLocalTransactionContext implements JmsTransactionContext {
         //        extended and new message arrive until commit or rollback is called.
         //        A quiet consumer could be misleading and prevent the code from doing
         //        its normal batched receive / commit.
+        //
+        //        Reply: I think at least we would want a way to replenish the credit,
+        //        even if we didn't call the ack method (avoiding using the provider or
+        //        pumping the proton transport), especially if it was a low-prefetch
+        //        consumer to begin with. I think we always 'consumed ack' transacted
+        //        messages currently, never 'delivered ack' since we don't need to do
+        //        session recover for them.
         if (!isFailed()) {
             // Consumed or delivered messages fall into a transaction so we must check
             // that there is an active one and start one if not.
@@ -87,6 +96,9 @@ public class JmsLocalTransactionContext implements JmsTransactionContext {
 
     @Override
     public void markAsFailed() {
+        //TODO: do we need to adjust this (or perhaps when we start the transaction?)
+        //      to handle an ack for a stale message delivery via onMessage starting
+        //      a transaction after this method was originally called?
         if (isInTransaction()) {
             failed = true;
         }
@@ -147,7 +159,8 @@ public class JmsLocalTransactionContext implements JmsTransactionContext {
         if (isFailed()) {
             failed = false;
             transactionId = null;
-            throw new TransactionRolledBackException("Transaction failed and must be rolled back.");
+            //TODO: we need to actually roll back if we have let any acks etc occur after the recovery.
+            throw new TransactionRolledBackException("Transaction failed and has been rolled back.");
         }
 
         if (isInTransaction()) {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b91a2950/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
index 0547440..1e537dc 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
@@ -491,6 +491,7 @@ public class JmsMessageConsumer implements MessageConsumer, JmsMessageAvailableC
 
     protected void onConnectionInterrupted() {
         messageQueue.clear();
+        //TODO: perhaps stop the queue here and clear+start it again once recovered?
     }
 
     protected void onConnectionRecovery(Provider provider) throws Exception {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org