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

Jonathan Valliere edited comment on DIRMINA-1095 at 10/2/18 12:07 AM:
----------------------------------------------------------------------

[~elecharny]

Adding the boolean gate somehow causes this in the 2.1.0 branch.

[ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 38.055 
s <<< FAILURE! - in 
org.apache.mina.filter.executor.PriorityThreadPoolExecutorTest
[ERROR] 
testPrioritisation(org.apache.mina.filter.executor.PriorityThreadPoolExecutorTest)
  Time elapsed: 38.054 s  <<< FAILURE!
java.lang.AssertionError: All other sessions should have finished later than 
the preferred session (but at least one did not).
        at 
org.apache.mina.filter.executor.PriorityThreadPoolExecutorTest.testPrioritisation(PriorityThreadPoolExecutorTest.java:214)




was (Author: johnnyv):
[~elecharny]


> Seems like the management f UDP sessions is really unneficient
> --------------------------------------------------------------
>
>                 Key: DIRMINA-1095
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1095
>             Project: MINA
>          Issue Type: Improvement
>    Affects Versions: 2.0.19
>            Reporter: Emmanuel Lecharny
>            Priority: Major
>             Fix For: 2.0.20
>
>
> When we process incoming UDP messages, we iterate over the activated 
> {{SelectionKey}}s. That's ok, but for each one of them, we read the data and 
> try to flush the scheduled messages. The loop where it's done seems to 
> iterate on *all* the managed sessions, for each keys we are processing :
> {code:java}
>    private void processReadySessions(Set<SelectionKey> handles) {
>         Iterator<SelectionKey> iterator = handles.iterator();
>         while (iterator.hasNext()) {
>             SelectionKey key = iterator.next();
>             DatagramChannel handle = (DatagramChannel) key.channel();
>             iterator.remove();
>             try {
>                 if (key.isValid() && key.isReadable()) {
>                     readHandle(handle);
>                 }
>                 if (key.isValid() && key.isWritable()) {
>                     for (IoSession session : getManagedSessions().values()) {
>                         scheduleFlush((NioSession) session);
> ...
> {code}
> There is no reason to do so. First, we should not iterate on all the managed 
> sessions (we may have thousands), but only the sessions which have something 
> to write, and we certainly should not do that for every active key...



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to