mirror of https://github.com/apache/activemq.git
move setPercentUsage() out of synchronized blocks to prevent a deadlock in the journal
persistence adaptor git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@439837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a7891c3dca
commit
e78edb1ea7
|
@ -103,10 +103,12 @@ public class UsageManager {
|
||||||
return;
|
return;
|
||||||
if(parent!=null)
|
if(parent!=null)
|
||||||
parent.increaseUsage(value);
|
parent.increaseUsage(value);
|
||||||
|
int percentUsage;
|
||||||
synchronized(usageMutex) {
|
synchronized(usageMutex) {
|
||||||
usage+=value;
|
usage+=value;
|
||||||
setPercentUsage(caclPercentUsage());
|
percentUsage = caclPercentUsage();
|
||||||
}
|
}
|
||||||
|
setPercentUsage(percentUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,10 +121,12 @@ public class UsageManager {
|
||||||
return;
|
return;
|
||||||
if(parent!=null)
|
if(parent!=null)
|
||||||
parent.decreaseUsage(value);
|
parent.decreaseUsage(value);
|
||||||
|
int percentUsage;
|
||||||
synchronized(usageMutex) {
|
synchronized(usageMutex) {
|
||||||
usage-=value;
|
usage-=value;
|
||||||
setPercentUsage(caclPercentUsage());
|
percentUsage = caclPercentUsage();
|
||||||
}
|
}
|
||||||
|
setPercentUsage(percentUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFull() {
|
public boolean isFull() {
|
||||||
|
@ -153,10 +157,12 @@ public class UsageManager {
|
||||||
if(percentUsageMinDelta < 0 ) {
|
if(percentUsageMinDelta < 0 ) {
|
||||||
throw new IllegalArgumentException("percentUsageMinDelta must be greater or equal to 0");
|
throw new IllegalArgumentException("percentUsageMinDelta must be greater or equal to 0");
|
||||||
}
|
}
|
||||||
|
int percentUsage;
|
||||||
synchronized (usageMutex) {
|
synchronized (usageMutex) {
|
||||||
this.limit = limit;
|
this.limit = limit;
|
||||||
setPercentUsage(caclPercentUsage());
|
percentUsage = caclPercentUsage();
|
||||||
}
|
}
|
||||||
|
setPercentUsage(percentUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,10 +205,12 @@ public class UsageManager {
|
||||||
if(percentUsageMinDelta < 1) {
|
if(percentUsageMinDelta < 1) {
|
||||||
throw new IllegalArgumentException("percentUsageMinDelta must be greater than 0");
|
throw new IllegalArgumentException("percentUsageMinDelta must be greater than 0");
|
||||||
}
|
}
|
||||||
|
int percentUsage;
|
||||||
synchronized (usageMutex) {
|
synchronized (usageMutex) {
|
||||||
this.percentUsageMinDelta = percentUsageMinDelta;
|
this.percentUsageMinDelta = percentUsageMinDelta;
|
||||||
setPercentUsage(caclPercentUsage());
|
percentUsage = caclPercentUsage();
|
||||||
}
|
}
|
||||||
|
setPercentUsage(percentUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getUsage() {
|
public long getUsage() {
|
||||||
|
|
Loading…
Reference in New Issue