You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2016/08/25 10:29:47 UTC

svn commit: r1757653 - in /jackrabbit/oak/trunk/oak-segment-tar/src: main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.java test/java/org/apache/jackrabbit/oak/segment/CheckpointTest.java

Author: mduerig
Date: Thu Aug 25 10:29:47 2016
New Revision: 1757653

URL: http://svn.apache.org/viewvc?rev=1757653&view=rev
Log:
OAK-4122: Replace the commit semaphore in the segment node store with a scheduler
Remove convenience variant of SegmentNodeStore.locked, which is only used from tests.

Modified:
    jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CheckpointTest.java

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.java?rev=1757653&r1=1757652&r2=1757653&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.java Thu Aug 25 10:29:47 2016
@@ -197,27 +197,6 @@ public class SegmentNodeStore implements
 
     /**
      * Execute the passed callable with trying to acquire this store's commit lock.
-     * @param c  callable to execute
-     * @return  {@code false} if the store's commit lock cannot be acquired, the result
-     *          of {@code c.call()} otherwise.
-     * @throws Exception
-     */
-    // FIXME OAK-4015: Expedite commits from the compactor
-    // FIXME OAK-4122: Replace the commit semaphore in the segment node store with a scheduler
-    // Replace by usage of expeditable lock or commit scheduler
-    boolean locked(Callable<Boolean> c) throws Exception {
-        if (commitSemaphore.tryAcquire()) {
-            try {
-                return c.call();
-            } finally {
-                commitSemaphore.release();
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Execute the passed callable with trying to acquire this store's commit lock.
      * @param timeout the maximum time to wait for the store's commit lock
      * @param unit the time unit of the {@code timeout} argument
      * @param c  callable to execute

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CheckpointTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CheckpointTest.java?rev=1757653&r1=1757652&r2=1757653&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CheckpointTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CheckpointTest.java Thu Aug 25 10:29:47 2016
@@ -18,6 +18,7 @@
  */
 package org.apache.jackrabbit.oak.segment;
 
+import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -122,7 +123,7 @@ public class CheckpointTest {
             @Override
             public void run() {
                 try {
-                    store.locked(block);
+                    store.locked(block, 10, SECONDS);
                 } catch (Exception e) {
                     //
                 }
@@ -159,7 +160,7 @@ public class CheckpointTest {
             public Boolean call() {
                 try {
                     semaphore.release();
-                    TimeUnit.SECONDS.sleep(blockTime);
+                    SECONDS.sleep(blockTime);
                 } catch (InterruptedException e) {
                     //
                 }
@@ -171,7 +172,7 @@ public class CheckpointTest {
             @Override
             public void run() {
                 try {
-                    store.locked(block);
+                    store.locked(block, 10, SECONDS);
                 } catch (Exception e) {
                     //
                 }