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

Trustin Lee commented on DIRMINA-428:
-------------------------------------

- where and how the priority will be attached to a message

User will implement a Comparator or make the message Comparable so MINA can 
determine which message is more urgent.

- where the messages will be sorted by priority

In an IoFilter's internal heap probably.

- how the default priority will be handled

Once Comparator is used, there's no default priority.  Everything is relative.

- 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 
to maintain the size of the real writeRequestQueue minimal so that 
high-priority messages are pushed into the real writeRequestQueue earlier than 
other buffered requests.  This might decrease throughput in some degrees, but 
the trade-off should be configurable.

> Message priorities
> ------------------
>
>                 Key: DIRMINA-428
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-428
>             Project: MINA
>          Issue Type: New Feature
>            Reporter: Adrian Sandor
>
> 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