directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvermill...@apache.org
Subject svn commit: r427972 - in /directory/sandbox/jvermillard/mina/java/org/apache/mina: common/ common/support/ filter/codec/ filter/codec/support/ transport/socket/nio/
Date Wed, 02 Aug 2006 13:13:07 GMT
Author: jvermillard
Date: Wed Aug  2 06:13:06 2006
New Revision: 427972

URL: http://svn.apache.org/viewvc?rev=427972&view=rev
Log:
* changed BaseIoSession.unclose() to prepareToReconnect()
* added getReadMessages and getWrittenMessages in IoSession and BaseIoSession
* implemented incrementing in ProtocolCodecFilter

Modified:
    directory/sandbox/jvermillard/mina/java/org/apache/mina/common/IoSession.java
    directory/sandbox/jvermillard/mina/java/org/apache/mina/common/support/BaseIoSession.java
    directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
    directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
    directory/sandbox/jvermillard/mina/java/org/apache/mina/transport/socket/nio/SocketConnector.java

Modified: directory/sandbox/jvermillard/mina/java/org/apache/mina/common/IoSession.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jvermillard/mina/java/org/apache/mina/common/IoSession.java?rev=427972&r1=427971&r2=427972&view=diff
==============================================================================
--- directory/sandbox/jvermillard/mina/java/org/apache/mina/common/IoSession.java (original)
+++ directory/sandbox/jvermillard/mina/java/org/apache/mina/common/IoSession.java Wed Aug
 2 06:13:06 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/sandbox/jvermillard/mina/java/org/apache/mina/common/support/BaseIoSession.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jvermillard/mina/java/org/apache/mina/common/support/BaseIoSession.java?rev=427972&r1=427971&r2=427972&view=diff
==============================================================================
--- directory/sandbox/jvermillard/mina/java/org/apache/mina/common/support/BaseIoSession.java
(original)
+++ directory/sandbox/jvermillard/mina/java/org/apache/mina/common/support/BaseIoSession.java
Wed Aug  2 06:13:06 2006
@@ -60,7 +60,10 @@
     private long readBytes;
     private long writtenBytes;
     private long writtenWriteRequests;
-    
+
+    private long readMessages;
+    private long writtenMessages;
+
     private long lastReadTime;
     private long lastWriteTime;
 
@@ -116,13 +119,13 @@
     /**
      * Uncloses this session immediately. Prepare the session for a reconnection
      */
-    public void unclose() {
+    public void prepareToReconnect() {
         synchronized( this )
         {
             if( isClosing() )
             {
             	closeFuture = new DefaultCloseFuture( this );
-            	closing=false;
+            	closing = false;
             }
         }
     }
@@ -340,6 +343,16 @@
         return writtenBytes;
     }
     
+    public long getReadMessages()
+    {
+        return readMessages;
+    }
+    
+    public long getWrittenMessages()
+    {
+        return writtenMessages;        
+    }
+    
     public long getWrittenWriteRequests()
     {
         return writtenWriteRequests;
@@ -361,6 +374,16 @@
         idleCountForWrite = 0;
     }
     
+    public void increaseReadMessages()
+    {
+        readMessages++;
+    }
+
+    public void increaseWrittenMessages()
+    {
+        writtenMessages++;
+    }
+
     public void increaseWrittenWriteRequests()
     {
         writtenWriteRequests ++;

Modified: directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java?rev=427972&r1=427971&r2=427972&view=diff
==============================================================================
--- directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
(original)
+++ directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
Wed Aug  2 06:13:06 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/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java?rev=427972&r1=427971&r2=427972&view=diff
==============================================================================
--- directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
(original)
+++ directory/sandbox/jvermillard/mina/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
Wed Aug  2 06:13:06 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,7 @@
     public void write( Object message )
     {
         messageQueue.push( message );
+        ((BaseIoSession)session).increaseReadMessages();
     }
 
     public void flush()

Modified: directory/sandbox/jvermillard/mina/java/org/apache/mina/transport/socket/nio/SocketConnector.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jvermillard/mina/java/org/apache/mina/transport/socket/nio/SocketConnector.java?rev=427972&r1=427971&r2=427972&view=diff
==============================================================================
--- directory/sandbox/jvermillard/mina/java/org/apache/mina/transport/socket/nio/SocketConnector.java
(original)
+++ directory/sandbox/jvermillard/mina/java/org/apache/mina/transport/socket/nio/SocketConnector.java
Wed Aug  2 06:13:06 2006
@@ -382,7 +382,7 @@
         
         if( reconnectingSession != null ) 
         {
-            reconnectingSession.unclose();
+            reconnectingSession.prepareToReconnect();
             session = reconnectingSession;
             reconnectingSession.setSocketChannel(ch);
         }



Mime
View raw message