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

Adrian Sandor commented on DIRMINA-428:
---------------------------------------

Hi, sorry for the late reply. I haven't looked at the changes yet, but I'd like 
to comment on what you said anyway.

> - at what point the Comparator/Comparable interface will be used (I think 
> anything before the writeRequestQueue will be useless)
>
> Before putting the message into writeRequestQueue. I think it's not useless 
> because the IoFilter implementation could maintain it's own writeRequestQueue

Well, that means the writeRequestQueue is effectively moved to the filter, and 
the original queue [almost] becomes a no-op. So the sorting is still not done 
before the queue, just that the queue changes its place. It can work, but I 
don't think it is very nice.

> I changed my mind. We could let user specify the internal write request queue 
> implementation

Ok, so the queue stays in place. The question remains - how to implement the 
comparison?
As I understand it, at this point the message to send has to be in the form of 
a ByteBuffer, and there's not much else to use in the WriteRequest. Or has it 
changed?

> Message priorities
> ------------------
>
>                 Key: DIRMINA-428
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-428
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Adrian Sandor
>            Assignee: Trustin Lee
>             Fix For: 2.0.0-M1
>
>
> I would like MINA to support sending messages with different priorities, so 
> that higher-priority messages will get sent out first (in the order that they 
> were added to the queue, if they have the same priority)
> Here's how I think this could be implemented:
> - define different priorities; I suggest using numeric constants, such as 
> LOWEST=0, LOW=25, NORMAL=50, HIGH=75, HIGHEST=100, allowing any custom values 
> from 0 to 100
> - add a priority field to WriteRequest, and implement Comparable using it
> - add a write(Object message, int priority) method to IoSession
> - make write(message) call write(message, NORMAL)
> - make the writeRequestQueue in the session implementations a priority queue, 
> but one that preserves the original order of "equal" elements
> - ensure that a higher priority message won't interrupt sending out another 
> message (if pending)
> - if desired, write an IoFilter that can manipulate the priority

-- 
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