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

Przemo Pakulski commented on JCR-1825:
--------------------------------------

without doing major changes I suggest to change DBDataStore class as follow :

Index: src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
===================================================================
--- src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java   
(revision 706573)
+++ src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java   
(working copy)
@@ -519,6 +519,9 @@
                 if (copyWhenReading) {
                     File temp = moveToTempFile(result);
                     result = new TempFileInputStream(temp);
+                    DatabaseHelper.closeSilently(rs);
+                    putBack(conn);
+                    rs = null;
                 }
             }

and DbResources.java close method to do not free db resources twice :

    public void close() {
        if (!closed) {
            closed = true;
            if (rs!=null) {
              DatabaseHelper.closeSilently(rs);
              try {
                store.putBack(conn);
              } catch (Exception e) {
                log.info("Closing DbResources: ", e);
              }
            }
        }
    }

Is it ok ?

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>
> My understanding is that setting parameter copyWhenReading to true should 
> allow concurrent reads by spooling binary property to temporary file and free 
> database resources (connection) immediately to make it available for other 
> threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent 
> reads anymore, resultSet is kept open and db connection is blocked until the 
> stream is read and closed. When copyWhenReading is set to true db connection 
> should be released immediately, this is the reason i guess why temporary file 
> is used.

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