mirror of https://github.com/apache/activemq.git
Add some additional crude throttling. With cursors being limited by how much they can
can page into memory as well as the producer, you can get live locks around space usage - if the allocation reaches 100% git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@509575 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b0b602121e
commit
c74558bfde
|
@ -90,6 +90,9 @@ public class UsageManager {
|
|||
for( int i=0; percentUsage >= 100 ; i++) {
|
||||
usageMutex.wait();
|
||||
}
|
||||
for( int i=0; percentUsage > 90 ; i++) {
|
||||
usageMutex.wait(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,15 +249,16 @@ public class UsageManager {
|
|||
// Switching from being full to not being full..
|
||||
if( oldPercentUsage >= 100 && newPercentUsage < 100 ) {
|
||||
synchronized (usageMutex) {
|
||||
System.err.println("Memory usage change. from: "+oldPercentUsage+", to: "+newPercentUsage);
|
||||
usageMutex.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
// Let the listeners know
|
||||
// Let the listeners know
|
||||
for (Iterator iter = listeners.iterator(); iter.hasNext();) {
|
||||
UsageListener l = (UsageListener) iter.next();
|
||||
l.onMemoryUseChanged(this, oldPercentUsage, newPercentUsage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
Loading…
Reference in New Issue