update percentUsage correctly

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@649551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-04-18 14:28:12 +00:00
parent 4a5454c39b
commit ce9255979b
1 changed files with 3 additions and 3 deletions

View File

@ -89,12 +89,12 @@ public abstract class Usage<T extends Usage> implements Service {
}
}
synchronized (usageMutex) {
caclPercentUsage();
percentUsage=caclPercentUsage();
if (percentUsage >= 100) {
long deadline = timeout > 0 ? System.currentTimeMillis() + timeout : Long.MAX_VALUE;
long timeleft = deadline;
while (timeleft > 0) {
caclPercentUsage();
percentUsage=caclPercentUsage();
if (percentUsage >= 100) {
usageMutex.wait(pollingTime);
timeleft = deadline - System.currentTimeMillis();
@ -112,7 +112,7 @@ public abstract class Usage<T extends Usage> implements Service {
return true;
}
synchronized (usageMutex) {
caclPercentUsage();
percentUsage=caclPercentUsage();
return percentUsage >= 100;
}
}