[ 
http://issues.apache.org/jira/browse/DIRMINA-262?page=comments#action_12434364 
] 
            
Hanson Char commented on DIRMINA-262:
-------------------------------------

Using the 3 messages/sec example, is it something as simple as the code below ?
...
    SocketConnector socketConnector = new SocketConnector();
    socketConnector.getFilterChain().addLast("writeThrottleFilter", new 
WriteThrottleFilter(333));
...
public class WriteThrottleFilter extends IoFilterAdapter 
{
    private final long delayMillis;
    
    public WriteThrottleFilter(long delayMillis) {
        this.delayMillis = delayMillis;
    }
    
    @Override
    public synchronized void filterWrite(NextFilter nextFilter, 
            IoSession session, ByteBuffer buf, Object marker) throws 
InterruptedException
    {
        nextFilter.filterWrite( session, buf, marker );
        Thread.sleep(delayMillis);
    }
}



> Controlling rate of writes in Mina 0.8.2
> ----------------------------------------
>
>                 Key: DIRMINA-262
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-262
>             Project: Directory MINA
>          Issue Type: New Feature
>    Affects Versions: 0.8.2
>            Reporter: Hanson Char
>
> Creates a filter that throttle the write request according to a given rate, 
> so one can control the rate of physical network write operations to not 
> exceeding a specific number of messages.
> For example, can I say for a particular socket connection session Mina should 
> write physically no more than 3 messages per second ?  Message here means the 
> argument that get passed to session.write(Object).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to