From 4534299092d14459f849135186b2dc2d3ddcc9ac Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Fri, 10 Sep 2010 10:34:00 -0700 Subject: [PATCH] Improve SynchronizationEvent --- .../com/cloud/utils/concurrency/SynchronizationEvent.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/src/com/cloud/utils/concurrency/SynchronizationEvent.java b/utils/src/com/cloud/utils/concurrency/SynchronizationEvent.java index 93da2b093ef..e5f8416f1ab 100644 --- a/utils/src/com/cloud/utils/concurrency/SynchronizationEvent.java +++ b/utils/src/com/cloud/utils/concurrency/SynchronizationEvent.java @@ -45,7 +45,7 @@ public class SynchronizationEvent { } } - public boolean waitEvent() { + public boolean waitEvent() throws InterruptedException { synchronized(this) { if(signalled) return true; @@ -57,12 +57,13 @@ public class SynchronizationEvent { return signalled; } catch (InterruptedException e) { s_logger.debug("unexpected awaken signal in wait()"); + throw e; } } } } - public boolean waitEvent(long timeOutMiliseconds) { + public boolean waitEvent(long timeOutMiliseconds) throws InterruptedException { synchronized(this) { if(signalled) return true; @@ -73,7 +74,7 @@ public class SynchronizationEvent { } catch (InterruptedException e) { // TODO, we don't honor time out semantics when the waiting thread is interrupted s_logger.debug("unexpected awaken signal in wait(...)"); - return false; + throw e; } } }