added better synchronization

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@550797 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2007-06-26 13:06:32 +00:00
parent 8a5387f6ad
commit 8a0157a506
1 changed files with 6 additions and 4 deletions

View File

@ -307,10 +307,12 @@ public class UsageManager implements Service{
}
private void setPercentUsage(int value) {
int oldValue = percentUsage;
percentUsage = value;
if( oldValue!=value ) {
fireEvent(oldValue, value);
synchronized (usageMutex) {
int oldValue = percentUsage;
percentUsage = value;
if( oldValue!=value ) {
fireEvent(oldValue, value);
}
}
}