directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r330399 - in /directory/network/trunk/src/java/org/apache/mina/common: IoSession.java support/BaseIoSession.java
Date Thu, 03 Nov 2005 00:55:00 GMT
Author: trustin
Date: Wed Nov  2 16:54:56 2005
New Revision: 330399

URL: http://svn.apache.org/viewcvs?rev=330399&view=rev
Log:
Related issue: DIRMINA-2 Traffic control
* Added convenient shortcut methods for setTrafficMask() as Niklas Therning requested.

Modified:
    directory/network/trunk/src/java/org/apache/mina/common/IoSession.java
    directory/network/trunk/src/java/org/apache/mina/common/support/BaseIoSession.java

Modified: directory/network/trunk/src/java/org/apache/mina/common/IoSession.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/IoSession.java?rev=330399&r1=330398&r2=330399&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/IoSession.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/IoSession.java Wed Nov  2 16:54:56
2005
@@ -189,6 +189,30 @@
     void setTrafficMask( TrafficMask trafficMask );
 
     /**
+     * A shortcut method for {@link #setTrafficMask(TrafficMask)} that
+     * suspends read operations for this session.
+     */
+    void suspendRead();
+    
+    /**
+     * A shortcut method for {@link #setTrafficMask(TrafficMask)} that
+     * suspends write operations for this session.
+     */
+    void suspendWrite();
+    
+    /**
+     * A shortcut method for {@link #setTrafficMask(TrafficMask)} that
+     * resumes read operations for this session.
+     */
+    void resumeRead();
+    
+    /**
+     * A shortcut method for {@link #setTrafficMask(TrafficMask)} that
+     * resumes write operations for this session.
+     */
+    void resumeWrite();
+    
+    /**
      * Returns the total number of bytes which were read from this session.
      */
     long getReadBytes();

Modified: directory/network/trunk/src/java/org/apache/mina/common/support/BaseIoSession.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/support/BaseIoSession.java?rev=330399&r1=330398&r2=330399&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/support/BaseIoSession.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/support/BaseIoSession.java Wed
Nov  2 16:54:56 2005
@@ -194,6 +194,26 @@
         this.trafficMask = trafficMask;
         updateTrafficMask();
     }
+    
+    public void suspendRead()
+    {
+        setTrafficMask( getTrafficMask().and( TrafficMask.READ.not() ) );
+    }
+
+    public void suspendWrite()
+    {
+        setTrafficMask( getTrafficMask().and( TrafficMask.WRITE.not() ) );
+    }
+
+    public void resumeRead()
+    {
+        setTrafficMask( getTrafficMask().or( TrafficMask.READ ) );
+    }
+
+    public void resumeWrite()
+    {
+        setTrafficMask( getTrafficMask().or( TrafficMask.WRITE ) );
+    }
 
     /**
      * Signals the {@link IoSessionManager} that the {@link TrafficMask} of this



Mime
View raw message