Better handlers exceptions handling

darcs-hash:20070321072742-86b55-56b0ae25d0a3e8835100a6b570aeb271ad912fe7.gz
This commit is contained in:
David Rousselie
2007-03-21 08:27:42 +01:00
parent 244a82f38a
commit 2791e3cd61
3 changed files with 33 additions and 43 deletions

View File

@@ -118,20 +118,14 @@ class JCLComponent(Component, object):
name = "TimerThread")
timer_thread.start()
try:
try:
while (self.running and self.stream \
and not self.stream.eof \
and self.stream.socket is not None):
self.stream.loop_iter(JCLComponent.timeout)
if self.queue.qsize():
raise self.queue.get(0)
except Exception, exception:
#self.__logger.exception("Exception cought:")
# put Exception in queue to be use by unit tests
self.queue.put(exception)
raise
while (self.running and self.stream \
and not self.stream.eof \
and self.stream.socket is not None):
self.stream.loop_iter(JCLComponent.timeout)
if self.queue.qsize():
raise self.queue.get(0)
finally:
# self.running = False
self.running = False
if self.stream and not self.stream.eof \
and self.stream.socket is not None:
current_user_jid = None
@@ -190,7 +184,6 @@ class JCLComponent(Component, object):
self.wait_event.wait(self.time_unit)
except Exception, exception:
self.queue.put(exception)
raise
self.__logger.info("Timer thread terminated...")
def authenticated(self):