use of org.apache.jackrabbit.oak.segment.SegmentOverflowException in project jackrabbit-oak by apache.
the class LockBasedScheduler method schedule.
@Override
public NodeState schedule(@Nonnull Commit commit, SchedulerOption... schedulingOptions) throws CommitFailedException {
boolean queued = false;
try {
long queuedTime = -1;
if (commitSemaphore.availablePermits() < 1) {
queuedTime = System.nanoTime();
stats.onCommitQueued();
queued = true;
}
commitSemaphore.acquire();
try {
if (queued) {
long dequeuedTime = System.nanoTime();
stats.dequeuedAfter(dequeuedTime - queuedTime);
stats.onCommitDequeued();
}
long beforeCommitTime = System.nanoTime();
SegmentNodeState merged = (SegmentNodeState) execute(commit);
commit.applied(merged);
long afterCommitTime = System.nanoTime();
stats.committedAfter(afterCommitTime - beforeCommitTime);
stats.onCommit();
return merged;
} finally {
commitSemaphore.release();
}
} catch (InterruptedException e) {
currentThread().interrupt();
throw new CommitFailedException("Segment", 2, "Merge interrupted", e);
} catch (SegmentOverflowException e) {
throw new CommitFailedException("Segment", 3, "Merge failed", e);
}
}
Aggregations