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

Thomas Mueller commented on JCR-1572:
-------------------------------------

Sorry for the delay. I can now reproduce the problem, re-connect is disabled at 
the wrong time. I don't actually see why auto-reconnect should be disabled at 
all: autoCommit is never disabled. I suggest to simply remove those lines:

Index: 
jackrabbit/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
===================================================================
--- 
jackrabbit/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
        (revision 698167)
+++ 
jackrabbit/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
        (working copy)
@@ -285,7 +285,6 @@
         TempFileInputStream fileInput = null;
         ConnectionRecoveryManager conn = getConnection();
         try {
-            conn.setAutoReconnect(false);
             String id = null, tempId = null;
             long now;
             for (int i = 0; i < ConnectionRecoveryManager.TRIALS; i++) {
@@ -362,7 +362,6 @@
             }
             usesIdentifier(identifier);
             DbDataRecord record = new DbDataRecord(this, identifier, length, 
now);
-            conn.setAutoReconnect(true);
             return record;
         } catch (Exception e) {
             throw convert("Can not insert new record", e);

I tested it and it works, and I don't see a reason why it shouldn't. Unless 
somebody sees a problem I will commit it to the trunk.

> DbDataStore connection does not always reconnect
> ------------------------------------------------
>
>                 Key: JCR-1572
>                 URL: https://issues.apache.org/jira/browse/JCR-1572
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Moshe Immerman
>            Assignee: Thomas Mueller
>         Attachments: jackrabbit-trunk.patch, jackrabbit1.4.patch
>
>
> If a DbDataStore connection is closed due to an error all subsequent 
> addRecord calls will fail with 'connection has been closed and autoReconnect 
> == false'
>  after getRecord is called and the connection is reconnected addRecord will 
> succeed.
> the connection should be validated before setting autoReconnect = false or on 
> retrieval from the pool.

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