mirror of https://github.com/apache/activemq.git
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:
parent
4a5454c39b
commit
ce9255979b
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue