You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Lukas Eder (JIRA)" <ji...@apache.org> on 2013/04/15 18:14:16 UTC

[jira] [Commented] (JCR-3394) Use multiple sessions to calculate permissions

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

Lukas Eder commented on JCR-3394:
---------------------------------

The current implementation of SessionPoolFactory.Pool.getSession() will throw an ArrayIndexOutOfBoundsException, once "sindex" overflows. A possible solution:

            int n = (sindex = (sindex + 1) % sessions.length);

Or

            int n = sindex++;
            return sessions[(n & Integer.MAX_VALUE) % sessions.length];

These solutions aren't threadsafe, just as the current one. For the original purpose, that might be OK as a "non-perfect" round-robin algorithm is acceptable. As this SessionPoolFactory might be reused elsewhere, I still think that an AtomicInteger might be better here.
                
> Use multiple sessions to calculate permissions
> ----------------------------------------------
>
>                 Key: JCR-3394
>                 URL: https://issues.apache.org/jira/browse/JCR-3394
>             Project: Jackrabbit Content Repository
>          Issue Type: Sub-task
>            Reporter: angela
>         Attachments: JCR-3394_2.patch, JCR-3394.patch, pool-1-10-100.csv, pool-1-10-100-nocache.csv, pooled.csv, pooled.png
>
>
> see JCR-2950 for information. subtask to track changes related to that (potential) improvement

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira