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 ju...@apache.org on 2013/07/17 15:54:19 UTC
svn commit: r1504139 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
Author: jukka
Date: Wed Jul 17 13:54:19 2013
New Revision: 1504139
URL: http://svn.apache.org/r1504139
Log:
OAK-788L File backend for the SegmentMK
Increase concurrency by avoiding too aggressive synchronization
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java?rev=1504139&r1=1504138&r2=1504139&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java Wed Jul 17 13:54:19 2013
@@ -21,6 +21,7 @@ import static com.google.common.base.Pre
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Lists.newArrayListWithCapacity;
import static com.google.common.collect.Lists.newLinkedList;
+import static com.google.common.collect.Maps.newConcurrentMap;
import static com.google.common.collect.Maps.newHashMap;
import static java.nio.channels.FileChannel.MapMode.READ_WRITE;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
@@ -124,7 +125,7 @@ public class FileStore implements Segmen
private final Map<String, Journal> journals = newHashMap();
- private final Map<UUID, SegmentReference> references = newHashMap();
+ private final Map<UUID, SegmentReference> references = newConcurrentMap();
private final Cache<UUID, Segment> segments =
CacheBuilder.newBuilder().maximumSize(1000).build();
@@ -237,7 +238,7 @@ public class FileStore implements Segmen
}
@Override
- public synchronized Segment readSegment(final UUID id) {
+ public Segment readSegment(final UUID id) {
try {
return segments.get(id, new Callable<Segment>() {
@Override
@@ -294,7 +295,7 @@ public class FileStore implements Segmen
}
@Override
- public synchronized void deleteSegment(UUID segmentId) {
+ public void deleteSegment(UUID segmentId) {
if (references.remove(segmentId) == null) {
throw new IllegalStateException("Missing segment: " + segmentId);
}