Author: trustin
Date: Sun Nov  4 04:31:46 2007
New Revision: 591775

URL: http://svn.apache.org/viewvc?rev=591775&view=rev
Log:
Removed another restriction that should have been removed in the previous commit

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=591775&r1=591774&r2=591775&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
 Sun Nov  4 04:31:46 2007
@@ -64,9 +64,6 @@
     private static final Map<IoService, AtomicInteger> serviceBufferSizes =
         new CopyOnWriteMap<IoService, AtomicInteger>();
     
-    private static final AttributeKey STATE =
-        new AttributeKey(ReadThrottleFilter.class, "state");
-
     /**
      * Returns the current amount of data in the buffer of the [EMAIL 
PROTECTED] ExecuorFilter}
      * for all [EMAIL PROTECTED] IoSession} whose [EMAIL PROTECTED] 
IoFilterChain} has been configured by
@@ -104,21 +101,9 @@
         serviceBufferSizes.remove(service);
     }
     
-    /**
-     * Returns the current amount of data in the buffer of the [EMAIL 
PROTECTED] ExecutorFilter}
-     * for the specified [EMAIL PROTECTED] IoSession}.
-     */
-    public static int getSessionBufferSize(IoSession session) {
-        State state = (State) session.getAttribute(STATE);
-        if (state == null) {
-            return 0;
-        }
-        
-        synchronized (state) {
-            return state.sessionBufferSize;
-        }
-    }
-    
+    private final AttributeKey STATE =
+        new AttributeKey(ReadThrottleFilter.class, "state");
+
     private final Object logLock = new Object();
     private long lastLogTime = 0;
     
@@ -260,14 +245,24 @@
         return messageSizeEstimator;
     }
     
+    /**
+     * Returns the current amount of data in the buffer of the [EMAIL 
PROTECTED] ExecutorFilter}
+     * for the specified [EMAIL PROTECTED] IoSession}.
+     */
+    public int getSessionBufferSize(IoSession session) {
+        State state = (State) session.getAttribute(STATE);
+        if (state == null) {
+            return 0;
+        }
+        
+        synchronized (state) {
+            return state.sessionBufferSize;
+        }
+    }
+    
     @Override
     public void onPreAdd(
             IoFilterChain parent, String name, NextFilter nextFilter) throws 
Exception {
-        if (parent.contains(ReadThrottleFilter.class)) {
-            throw new IllegalStateException(
-                    "Only one " + ReadThrottleFilter.class.getName() + " is 
allowed.");
-        }
-        
         if (!parent.contains(AbstractExecutorFilter.class)) {
             throw new IllegalStateException(
                     "At least one " + ExecutorFilter.class.getName() + " must 
exist in the chain.");


Reply via email to