Author: kwall
Date: Thu Oct 16 10:34:03 2014
New Revision: 1632269

URL: http://svn.apache.org/r1632269
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.

Merged from trunk with command:
svn merge -c r1619813 https://svn.apache.org/repos/asf/qpid/trunk/

Modified:
    qpid/branches/kwall_030_tmp/   (props changed)
    qpid/branches/kwall_030_tmp/qpid/   (props changed)
    qpid/branches/kwall_030_tmp/qpid/python/   (props changed)
    qpid/branches/kwall_030_tmp/qpid/python/qpid/messaging/endpoints.py

Propchange: qpid/branches/kwall_030_tmp/
------------------------------------------------------------------------------
  Merged /qpid/trunk:r1619813

Propchange: qpid/branches/kwall_030_tmp/qpid/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid:r1619813

Propchange: qpid/branches/kwall_030_tmp/qpid/python/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/python:r1619813

Modified: qpid/branches/kwall_030_tmp/qpid/python/qpid/messaging/endpoints.py
URL: 
http://svn.apache.org/viewvc/qpid/branches/kwall_030_tmp/qpid/python/qpid/messaging/endpoints.py?rev=1632269&r1=1632268&r2=1632269&view=diff
==============================================================================
--- qpid/branches/kwall_030_tmp/qpid/python/qpid/messaging/endpoints.py 
(original)
+++ qpid/branches/kwall_030_tmp/qpid/python/qpid/messaging/endpoints.py Thu Oct 
16 10:34:03 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-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to