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

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

Hmm... first off, IoSessionDataStructureFactory is not a filter.  it creates a 
few important fields like WriteRequestQueue when a new session is created.  
It's a special extension point introduced due to user demand.  Therefore your 
first comment is not effective now.  I implemented as you requested mostly. :)

Implementation of comparison is up to you.  There's an interface called 
WriteRequestQueue, so you can do whatever you want with the message ordering.  
Typically you could maintain two or more queues internally (e.g. fast lane and 
other lanes).

It is true that the WriteRequest doesn't contain high-level information that 
helps you determine the priority of the request, although you can down-cast the 
write request to WriteRequestWrapper and get the original message, but I'm not 
sure it's a good way to determine the priority.  Let me think about this issue 
a little bit more...

> 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