Author: alexparvulescu
Date: Tue Sep 20 07:33:32 2016
New Revision: 1761534

URL: http://svn.apache.org/viewvc?rev=1761534&view=rev
Log:
OAK-4824 Deadlock in TarWriter

Modified:
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/TarWriter.java

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/TarWriter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/TarWriter.java?rev=1761534&r1=1761533&r2=1761534&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/TarWriter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/TarWriter.java
 Tue Sep 20 07:33:32 2016
@@ -365,11 +365,13 @@ class TarWriter implements Closeable {
      * internal {@link #writeIndex} counter. Otherwise it will return the
      * current instance.
      */
-    synchronized TarWriter createNextGeneration() throws IOException {
+    TarWriter createNextGeneration() throws IOException {
         checkState(writeIndex >= 0);
         // If nothing was written to this file, then we're already done.
-        if (access == null) {
-            return this;
+        synchronized (this) {
+            if (access == null) {
+                return this;
+            }
         }
         close();
         int newIndex = writeIndex + 1;


Reply via email to