activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r511073 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java
Date Fri, 23 Feb 2007 19:53:23 GMT
Author: rajdavies
Date: Fri Feb 23 11:53:23 2007
New Revision: 511073

URL: http://svn.apache.org/viewvc?view=rev&rev=511073
Log:
chekc if debug is enabled before calling debug

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=511073&r1=511072&r2=511073
==============================================================================
--- 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
Fri Feb 23 11:53:23 2007
@@ -54,6 +54,7 @@
 
     /** True if someone called setSendFailIfNoSpace() on this particular usage manager */
     private boolean sendFailIfNoSpaceExplicitySet;
+    private final boolean debug = log.isDebugEnabled();
 
     public UsageManager() {
         this(null);
@@ -242,22 +243,21 @@
         return (int)((((usage*100)/limit)/percentUsageMinDelta)*percentUsageMinDelta);
     }
     
-    private void fireEvent(int oldPercentUsage, int newPercentUsage) {
-        
-        log.debug("Memory usage change.  from: "+oldPercentUsage+", to: "+newPercentUsage);
-        
+    private void fireEvent(int oldPercentUsage,int newPercentUsage){
+        if (debug) {
+            log.debug("Memory usage change.  from: "+oldPercentUsage+", to: "+newPercentUsage);
+        }
         // Switching from being full to not being full..
-        if( oldPercentUsage >= 100 && newPercentUsage < 100 ) {
-            synchronized (usageMutex) {
+        if(oldPercentUsage>=100&&newPercentUsage<100){
+            synchronized(usageMutex){
                 usageMutex.notifyAll();
-            }            
+            }
         }
-//      Let the listeners know
-        for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-            UsageListener l = (UsageListener) iter.next();
-            l.onMemoryUseChanged(this, oldPercentUsage, newPercentUsage);
+        // 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