jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Jain (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (JCR-3852) [jackrabbit-aws-ext] Refactor code to open S3 service & consolidate testcases
Date Thu, 05 Mar 2015 08:48:38 GMT

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

Amit Jain edited comment on JCR-3852 at 3/5/15 8:48 AM:
--------------------------------------------------------

The following patch reliably passes tests for me. Can you check whether we can safely mark
the threads running as interrupted when the executor does not finish within 15 seconds.
Note: This is the change from code in trunk for these files and all other files are from your
patch.

{code}
Index: ../jackrabbit/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/CachingDataStore.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- ../jackrabbit/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/CachingDataStore.java
(date 1425388205000)
+++ ../jackrabbit/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/CachingDataStore.java
(revision )
@@ -1219,7 +1219,7 @@
                     logProgress();
                 }
             } catch (InterruptedException ie) {
-
+                executor.shutdownNow();
             }
             long endTime = System.currentTimeMillis();
             LOG.info(
Index: ../jackrabbit/jackrabbit-data/src/test/java/org/apache/jackrabbit/core/data/TestCaseBase.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- ../jackrabbit/jackrabbit-data/src/test/java/org/apache/jackrabbit/core/data/TestCaseBase.java
(date 1425388205000)
+++ ../jackrabbit/jackrabbit-data/src/test/java/org/apache/jackrabbit/core/data/TestCaseBase.java
(revision )
@@ -94,7 +94,18 @@
     @Override
     protected void setUp() throws Exception {
         dataStoreDir = TEST_DIR + "-"
+            + String.valueOf(randomGen.nextInt(dataLength)) + "-"
             + String.valueOf(randomGen.nextInt(dataLength));
+        // delete director if it exists
+        boolean delSuccessFul = FileUtils.deleteQuietly(new File(dataStoreDir));
+        int retry = 2, count = 0;
+        while (!delSuccessFul && count <= retry) {
+            // try once more
+            delSuccessFul = FileUtils.deleteQuietly(new File(dataStoreDir));
+            count++;
+        }
+        LOG.info("setup : directory [" + dataStoreDir + "] deleted ["
+            + delSuccessFul + "]");
     }
 
     /**
{code}


was (Author: amitjain):
The following patch reliably passes tests for me. Can you check whether we can safely mark
the threads running as interrupted when the executor does not finish within 15 seconds.

{code}
Index: ../jackrabbit/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/CachingDataStore.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- ../jackrabbit/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/CachingDataStore.java
(date 1425388205000)
+++ ../jackrabbit/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/CachingDataStore.java
(revision )
@@ -1219,7 +1219,7 @@
                     logProgress();
                 }
             } catch (InterruptedException ie) {
-
+                executor.shutdownNow();
             }
             long endTime = System.currentTimeMillis();
             LOG.info(
Index: ../jackrabbit/jackrabbit-data/src/test/java/org/apache/jackrabbit/core/data/TestCaseBase.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- ../jackrabbit/jackrabbit-data/src/test/java/org/apache/jackrabbit/core/data/TestCaseBase.java
(date 1425388205000)
+++ ../jackrabbit/jackrabbit-data/src/test/java/org/apache/jackrabbit/core/data/TestCaseBase.java
(revision )
@@ -94,7 +94,18 @@
     @Override
     protected void setUp() throws Exception {
         dataStoreDir = TEST_DIR + "-"
+            + String.valueOf(randomGen.nextInt(dataLength)) + "-"
             + String.valueOf(randomGen.nextInt(dataLength));
+        // delete director if it exists
+        boolean delSuccessFul = FileUtils.deleteQuietly(new File(dataStoreDir));
+        int retry = 2, count = 0;
+        while (!delSuccessFul && count <= retry) {
+            // try once more
+            delSuccessFul = FileUtils.deleteQuietly(new File(dataStoreDir));
+            count++;
+        }
+        LOG.info("setup : directory [" + dataStoreDir + "] deleted ["
+            + delSuccessFul + "]");
     }
 
     /**
{code}

> [jackrabbit-aws-ext] Refactor code to open S3 service & consolidate testcases
> -----------------------------------------------------------------------------
>
>                 Key: JCR-3852
>                 URL: https://issues.apache.org/jira/browse/JCR-3852
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-data
>    Affects Versions: 2.9.1
>            Reporter: Shashank Gupta
>            Priority: Minor
>             Fix For: 2.9.1
>
>         Attachments: JCR-3852.patch, JCR-3852_v_1.1.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message