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

Jukka Zitting commented on JCR-1456:
------------------------------------

I think the main concerns raised above are:

* The entire store(ChangeLog) operation needs to happen atomically

* Using ThreadLocal for the connection seems unnecessarily complex (from the 
perspective of someone new trying to understand the code), it's better to pass 
the connection around as a method argument or encapsulate it as a member 
variable of an object that performs the database operations

I also have some extra concerns:

* Could you implement this without introducing new configuration entries? We 
may consider adding that later, but it would be clearer if we first implemented 
connection pooling with the access configuration that we currently have.

* We should leverage something like Commons DBCP instead of implementing our 
own connection pooling logic. Commons DBCP is much better than anything that we 
could come up with.

* Related to the above, we should use the standard DataSource interface 
interface instead of a custom ConnectionManager class. This would nicely 
abstract away all the pooling logic and make the code much more familiar to 
people who already know JDBC. All top-level methods would look like something 
like this:

    public void doSomething() throws SQLException {
        Connection connection = dataSource.getConnection();
        try {
            // do something with the connection
        } finally {
            connection.close();
        }
    }

The above are of course just individual opinions. Feel free to argue otherwise 
if you have a better solution.

PS. The Jackrabbit sandbox is nowadays open to all Apache committers, so if you 
may want to create a development branch of Jackrabbit trunk (or the 1.x branch) 
in the sandbox for this work. The changes here are so extensive that it may be 
easier for us to work incrementally through svn.

PPS. Alternatively, if you know Git, you may want to clone 
git://git.apache.org/jackrabbit.git and publish your changes for example on 
Github.



> Database connection pooling
> ---------------------------
>
>                 Key: JCR-1456
>                 URL: https://issues.apache.org/jira/browse/JCR-1456
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>         Attachments: patch-1456-1.txt, patch-1456-2.txt, patch-1456-3.txt
>
>
> Jackrabbit should use database connection pools instead of a single 
> connection per persistence manager, cluster journal, or database data store.

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