You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ar...@apache.org on 2007/08/20 15:03:14 UTC

svn commit: r567678 - in /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms: MessageConsumerImpl.java SessionImpl.java

Author: arnaudsimon
Date: Mon Aug 20 06:03:14 2007
New Revision: 567678

URL: http://svn.apache.org/viewvc?rev=567678&view=rev
Log:
updated sync

Modified:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java?rev=567678&r1=567677&r2=567678&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java Mon Aug 20 06:03:14 2007
@@ -401,6 +401,7 @@
             // We now release any message received for this consumer
             _isReceiving = false;
             _isNoWaitIsReceiving = false;
+            getSession().testQpidException();            
         }
         return result;
     }
@@ -583,8 +584,7 @@
             RangeSet ranges = new RangeSet();
             ranges.add(message.getMessageTransferId());
             getSession().getQpidSession().messageRelease(ranges);
-            getSession().getQpidSession().sync();
-            testQpidException();
+            getSession().testQpidException();            
         }
     }
 
@@ -611,7 +611,7 @@
             {
                 result = true;
             }
-            testQpidException();
+            getSession().testQpidException();
         }
         return result;
     }
@@ -629,17 +629,7 @@
             RangeSet ranges = new RangeSet();
             ranges.add(message.getMessageTransferId());
             getSession().getQpidSession().messageAcknowledge(ranges);
-            getSession().getQpidSession().sync();
-            testQpidException();
-        }
-    }
-
-    private void testQpidException() throws QpidException
-    {
-        QpidException qe = getSession().getCurrentException();
-        if (qe != null)
-        {
-            throw qe;
+            getSession().testQpidException();
         }
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java?rev=567678&r1=567677&r2=567678&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java Mon Aug 20 06:03:14 2007
@@ -156,7 +156,7 @@
         {
             _qpidSession.txSelect();
         }
-
+        testQpidException();
         // init the message dispatcher.
         initMessageDispatcherThread();
     }
@@ -319,6 +319,14 @@
         }
         // commit the underlying Qpid Session
         _qpidSession.txCommit();
+        try
+        {
+            testQpidException();
+        }
+        catch (QpidException e)
+        {
+            throw ExceptionHelper.convertQpidExceptionToJMSException(e);
+        }
     }
 
     /**
@@ -342,6 +350,14 @@
         }
         // rollback the underlying Qpid Session
         _qpidSession.txRollback();
+        try
+        {
+            testQpidException();
+        }
+        catch (QpidException e)
+        {
+            throw ExceptionHelper.convertQpidExceptionToJMSException(e);
+        }
     }
 
     /**
@@ -401,6 +417,14 @@
             }
             // close the underlaying QpidSession
             _qpidSession.sessionClose();
+            try
+            {
+                testQpidException();
+            }
+            catch (QpidException e)
+            {
+                throw ExceptionHelper.convertQpidExceptionToJMSException(e);
+            }
         }
     }
 
@@ -1081,6 +1105,21 @@
     protected ConnectionImpl getConnection()
     {
         return _connection;
+    }
+
+    /**
+     * sync and return the potential exception
+     *
+     * @throws QpidException If an exception has been thrown by the broker.
+     */
+    protected void testQpidException() throws QpidException
+    {
+        _qpidSession.sync();
+        QpidException qe = getCurrentException();
+        if (qe != null)
+        {
+            throw qe;
+        }
     }
 
     //------ Private Methods