activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r509575 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
Date Tue, 20 Feb 2007 14:26:28 GMT
Author: rajdavies
Date: Tue Feb 20 06:26:27 2007
New Revision: 509575

URL: http://svn.apache.org/viewvc?view=rev&rev=509575
Log:
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%

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java?view=diff&rev=509575&r1=509574&r2=509575
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
Tue Feb 20 06:26:27 2007
@@ -90,6 +90,9 @@
             for( int i=0; percentUsage >= 100 ; i++) {
                 usageMutex.wait();
             }
+            for( int i=0; percentUsage > 90 ; i++) {
+                usageMutex.wait(100);
+            }
         }
     }
     
@@ -246,15 +249,16 @@
         // 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() {



Mime
View raw message