qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1619813 - /qpid/trunk/qpid/python/qpid/messaging/endpoints.py
Date Fri, 22 Aug 2014 14:13:05 GMT
Author: aconway
Date: Fri Aug 22 14:13:05 2014
New Revision: 1619813

URL: http://svn.apache.org/r1619813
Log:
NO-JIRA: Fix timeout on python messaging.Session.commit and rollback

Fix both to take timeout arg and raise Timeout exception if timeout expires.

Modified:
    qpid/trunk/qpid/python/qpid/messaging/endpoints.py

Modified: qpid/trunk/qpid/python/qpid/messaging/endpoints.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/endpoints.py?rev=1619813&r1=1619812&r2=1619813&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/messaging/endpoints.py (original)
+++ qpid/trunk/qpid/python/qpid/messaging/endpoints.py Fri Aug 22 14:13:05 2014
@@ -732,13 +732,14 @@ class Session(Endpoint):
       raise NontransactionalSession()
     self.committing = True
     self._wakeup()
-    self._ecwait(lambda: not self.committing, timeout=timeout)
+    if not self._ecwait(lambda: not self.committing, timeout=timeout):
+      raise Timeout("commit timed out")
     if self.aborted:
       raise TransactionAborted()
     assert self.committed
 
   @synchronized
-  def rollback(self):
+  def rollback(self, timeout=None):
     """
     Rollback outstanding transactional work. This consists of all
     message sends and receives since the prior commit or rollback.
@@ -747,7 +748,8 @@ class Session(Endpoint):
       raise NontransactionalSession()
     self.aborting = True
     self._wakeup()
-    self._ecwait(lambda: not self.aborting)
+    if not self._ecwait(lambda: not self.aborting, timeout=timeout):
+      raise Timeout("rollback timed out")
     assert self.aborted
 
   @synchronized



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


Mime
View raw message