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 al...@apache.org on 2015/11/05 15:36:06 UTC
svn commit: r1712785 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
Author: alexparvulescu
Date: Thu Nov 5 14:36:06 2015
New Revision: 1712785
URL: http://svn.apache.org/viewvc?rev=1712785&view=rev
Log:
OAK-3588 SegmentNodeStore allow tweaking of lock fairness
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java?rev=1712785&r1=1712784&r2=1712785&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java Thu Nov 5 14:36:06 2015
@@ -90,7 +90,7 @@ public class SegmentNodeStore implements
* Only a single local commit is allowed at a time. When such
* a commit is in progress, no external updates will be seen.
*/
- private final Semaphore commitSemaphore = new Semaphore(1);
+ private final Semaphore commitSemaphore;
private long maximumBackoff = MILLISECONDS.convert(10, SECONDS);
@@ -101,6 +101,12 @@ public class SegmentNodeStore implements
private int checkpointsLockWaitTime = Integer.getInteger(
"oak.checkpoints.lockWaitTime", 10);
+ /**
+ * Flag controlling the commit lock fairness
+ */
+ private boolean commitFairLock = Boolean
+ .getBoolean("oak.segmentNodeStore.commitFairLock");
+
@Nonnull
public static SegmentNodeStoreBuilder newSegmentNodeStore(
@Nonnull SegmentStore store) {
@@ -117,6 +123,10 @@ public class SegmentNodeStore implements
}
SegmentNodeStore(SegmentStore store, boolean internal) {
+ if (commitFairLock) {
+ log.info("initializing SegmentNodeStore with the commitFairLock option enabled.");
+ }
+ this.commitSemaphore = new Semaphore(1, commitFairLock);
this.store = store;
this.head = new AtomicReference<SegmentNodeState>(store.getHead());
this.changeDispatcher = new ChangeDispatcher(getRoot());