mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r593127 - /mina/trunk/core/src/main/java/org/apache/mina/filter/traffic/ReadThrottleFilter.java
Date Thu, 08 Nov 2007 10:54:52 GMT
Author: trustin
Date: Thu Nov  8 02:54:51 2007
New Revision: 593127

URL: http://svn.apache.org/viewvc?rev=593127&view=rev
Log:
Beautified debug log messages

Modified:
    mina/trunk/core/src/main/java/org/apache/mina/filter/traffic/ReadThrottleFilter.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/traffic/ReadThrottleFilter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/traffic/ReadThrottleFilter.java?rev=593127&r1=593126&r2=593127&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/traffic/ReadThrottleFilter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/traffic/ReadThrottleFilter.java Thu
Nov  8 02:54:51 2007
@@ -394,7 +394,7 @@
         }
 
         if (logger.isDebugEnabled()) {
-            logger.debug("Enter: " + sessionBufferSize);
+            logger.debug(getMessage(session, "  Entered - "));
         }
         
         if (enforcePolicy) {
@@ -422,7 +422,7 @@
         log(session, state);
         session.suspendRead();
         if (logger.isDebugEnabled()) {
-            logger.debug("Suspended: {}", getMessage(session));
+            logger.debug(getMessage(session, "Suspended - "));
         }
     }
     
@@ -465,13 +465,13 @@
         }
         
         if (logger.isDebugEnabled()) {
-            logger.debug("Exit: {}", state.sessionBufferSize);
+            logger.debug(getMessage(session, "   Exited - "));
         }
         
         if (enforcePolicy) {
             session.resumeRead();
             if (logger.isDebugEnabled()) {
-                logger.debug("Resumed");
+                logger.debug(getMessage(session, "  Resumed - "));
             }
         }
         
@@ -535,7 +535,7 @@
             session.resumeRead();
             Logger logger = IoSessionLogger.getLogger(session, getClass());
             if (logger.isDebugEnabled()) {
-                logger.debug("Resumed");
+                logger.debug(getMessage(session, "  Resumed - "));
             }
         }
     }
@@ -562,14 +562,19 @@
     private void raiseException(IoSession session) {
         throw new ReadFloodException(getMessage(session));
     }
-
+    
     private String getMessage(IoSession session) {
+        return getMessage(session, "Read buffer flooded - ");
+    }
+    
+    private String getMessage(IoSession session, String prefix) {
         int  sessionLimit = maxSessionBufferSize;
         int  serviceLimit = maxServiceBufferSize;
         int  globalLimit  = maxGlobalBufferSize;
 
         StringBuilder buf = new StringBuilder(512);
-        buf.append("Read buffer flooded - session: ");
+        buf.append(prefix);
+        buf.append("session: ");
         if (sessionLimit != 0) {
             buf.append(getSessionBufferSize(session));
             buf.append(" / ");



Mime
View raw message