[ 
https://issues.apache.org/jira/browse/DIRMINA-302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539504
 ] 

Trustin Lee commented on DIRMINA-302:
-------------------------------------

I thought about the following solution:

* Add WritePolicyViolationException
* Add IoService.writePolicy property and IoSession.config.writePolicy whose 
type is WritePolicy
* Add WritePolicy interface:
public interface WritePolicy {
     void enforcePolicy(IoSession session, Object message) throws 
WritePolicyViolationException;
}
* Add DefaultWritePolicy which provides what Martin suggested.

However, I found no reason to provide new types and properties because this 
also can be implemented as a much simplified filter, again, because MINA 
already provides related properties such as 
IoSession.scheduledWrite(Messages|Bytes).

Sorry for being fickle! :)

> Unbounded nature of writeRequestQueue can cause OutOfMemoryException
> --------------------------------------------------------------------
>
>                 Key: DIRMINA-302
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-302
>             Project: MINA
>          Issue Type: Bug
>          Components: Filter
>    Affects Versions: 1.0.0
>            Reporter: Martin Ritchie
>             Fix For: 2.0.0-M1
>
>         Attachments: WriteBufferLimitFilterBuilder.java
>
>
> As referenced in the following JIRAs:
>  DIRMINA-206 Prevent OutOfMemoryError when a server or a client is overloaded
>  DIRMINA-144 Traffic shaping filter
>  DIRMINA-262 Controlling rate of writes in Mina 0.8.2
> Raised to hightlight the problem. There are a number of approaches that have 
> been mentioned and could be used as an approach.
> Limiting the queue to number of requests or total size. 
> Then either blocking on a write or throwing an exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to