commit | 116723a65e0ec9638f53b0247484b359d9d7835b | [log] [tgz] |
---|---|---|
author | Richard S. Hall <rickhall@apache.org> | Fri Jun 26 20:04:21 2009 +0000 |
committer | Richard S. Hall <rickhall@apache.org> | Fri Jun 26 20:04:21 2009 +0000 |
tree | 860f1bb82854e1dd1afb6505e57bab329c5955f4 | |
parent | 75d107257481c80465d183999ff38d75330e9901 [diff] |
Properly monitor timeout on ThreadGate for Framework.waitForStop(). (FELIX-1279) git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@788845 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/util/ThreadGate.java b/framework/src/main/java/org/apache/felix/framework/util/ThreadGate.java index 9546f7a..158ee14 100644 --- a/framework/src/main/java/org/apache/felix/framework/util/ThreadGate.java +++ b/framework/src/main/java/org/apache/felix/framework/util/ThreadGate.java
@@ -43,9 +43,19 @@ **/ public synchronized void await(long timeout) throws InterruptedException { + long start = System.currentTimeMillis(); + long remaining = timeout; while (!m_open) { - wait(timeout); + wait(remaining); + if (timeout > 0) + { + remaining = timeout - (System.currentTimeMillis() - start); + if (remaining <= 0) + { + break; + } + } } } } \ No newline at end of file