activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r439837 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
Date Sun, 03 Sep 2006 19:22:13 GMT
Author: rajdavies
Date: Sun Sep  3 12:22:12 2006
New Revision: 439837

URL: http://svn.apache.org/viewvc?view=rev&rev=439837
Log:
move setPercentUsage() out of synchronized blocks to prevent a deadlock in the journal
persistence adaptor

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

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java?view=diff&rev=439837&r1=439836&r2=439837
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
Sun Sep  3 12:22:12 2006
@@ -103,10 +103,12 @@
             return;
         if(parent!=null)
             parent.increaseUsage(value);
+        int percentUsage;
         synchronized(usageMutex) {
             usage+=value;
-            setPercentUsage(caclPercentUsage());
+            percentUsage = caclPercentUsage();  
         }
+        setPercentUsage(percentUsage);
     }
     
     /**
@@ -119,10 +121,12 @@
             return;
         if(parent!=null)
             parent.decreaseUsage(value);
+        int percentUsage;
         synchronized(usageMutex) {
             usage-=value;
-            setPercentUsage(caclPercentUsage());
+            percentUsage = caclPercentUsage();  
         }
+        setPercentUsage(percentUsage);
     }
     
     public boolean isFull() {
@@ -153,10 +157,12 @@
         if(percentUsageMinDelta < 0 ) {
             throw new IllegalArgumentException("percentUsageMinDelta must be greater or equal
to 0");
         }
+        int percentUsage;
         synchronized (usageMutex) {
             this.limit = limit;
-            setPercentUsage(caclPercentUsage());
+            percentUsage = caclPercentUsage();
         }
+        setPercentUsage(percentUsage);
     }
     
     /**
@@ -199,10 +205,12 @@
         if(percentUsageMinDelta < 1) {
             throw new IllegalArgumentException("percentUsageMinDelta must be greater than
0");
         }
+        int percentUsage;
         synchronized (usageMutex) {
             this.percentUsageMinDelta = percentUsageMinDelta;
-            setPercentUsage(caclPercentUsage());
-        }
+            percentUsage = caclPercentUsage();  
+        } 
+        setPercentUsage(percentUsage);
     }
 
     public long getUsage() {



Mime
View raw message