directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvermill...@apache.org
Subject svn commit: r428401 - in /directory/trunks/mina/core/src/main/java/org/apache/mina: common/IoSession.java common/support/BaseIoSession.java filter/codec/ProtocolCodecFilter.java filter/codec/support/SimpleProtocolDecoderOutput.java
Date Thu, 03 Aug 2006 13:20:42 GMT
Author: jvermillard
Date: Thu Aug  3 06:20:42 2006
New Revision: 428401

URL: http://svn.apache.org/viewvc?rev=428401&view=rev
Log:
counting of encoded and decoded PDU (IoSession.getReadMessages and IoSession.getWrittenMessages)

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java?rev=428401&r1=428400&r2=428401&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java (original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java Thu Aug
 3 06:20:42 2006
@@ -262,7 +262,17 @@
      * Returns the total number of bytes which were written to this session.
      */
     long getWrittenBytes();
-    
+        
+    /**
+     * Returns the total number of messages which were read and decoded from this session.

+     */
+    long getReadMessages();
+
+    /**
+     * Returns the total number of messages which were written and encoded by this session.
+     */
+    long getWrittenMessages();
+
     /**
      * Returns the total number of write requests which were written to this session.
      */

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java?rev=428401&r1=428400&r2=428401&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java
Thu Aug  3 06:20:42 2006
@@ -61,6 +61,9 @@
     private long writtenBytes;
     private long writtenWriteRequests;
     
+    private long readMessages;
+    private long writtenMessages;
+    
     private long lastReadTime;
     private long lastWriteTime;
 
@@ -331,6 +334,16 @@
         return writtenWriteRequests;
     }
     
+    public long getReadMessages()
+    {
+        return readMessages;
+    }
+        
+    public long getWrittenMessages()
+    {
+        return writtenMessages;        
+    }
+    
     public void increaseReadBytes( int increment )
     {
         readBytes += increment;
@@ -350,6 +363,16 @@
     public void increaseWrittenWriteRequests()
     {
         writtenWriteRequests ++;
+    }
+    
+    public void increaseReadMessages()
+    {
+        readMessages++;
+    }
+    
+    public void increaseWrittenMessages()
+    {
+        writtenMessages++;
     }
     
     public long getCreationTime()

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java?rev=428401&r1=428400&r2=428401&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
Thu Aug  3 06:20:42 2006
@@ -25,6 +25,7 @@
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.WriteFuture;
+import org.apache.mina.common.support.BaseIoSession;
 import org.apache.mina.common.support.DefaultWriteFuture;
 import org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput;
 import org.apache.mina.filter.codec.support.SimpleProtocolEncoderOutput;
@@ -217,6 +218,8 @@
         try
         {
             encoder.encode( session, message, encoderOut );
+            
+            ((BaseIoSession)session).increaseWrittenMessages();
         }
         catch( Throwable t )
         {

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java?rev=428401&r1=428400&r2=428401&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
Thu Aug  3 06:20:42 2006
@@ -5,6 +5,7 @@
 
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoFilter.NextFilter;
+import org.apache.mina.common.support.BaseIoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
 import org.apache.mina.util.Queue;
 
@@ -30,6 +31,10 @@
     public void write( Object message )
     {
         messageQueue.push( message );
+        if( session instanceof BaseIoSession )
+        {
+            ( (BaseIoSession) session ).increaseReadMessages();
+        }
     }
 
     public void flush()



Mime
View raw message