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 fr...@apache.org on 2016/11/08 16:03:08 UTC
svn commit: r1768717 -
/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/standby/server/FileStoreUtil.java
Author: frm
Date: Tue Nov 8 16:03:07 2016
New Revision: 1768717
URL: http://svn.apache.org/viewvc?rev=1768717&view=rev
Log:
OAK-5087 - Use FileStore#containsSegment() when checking for the existence of a segment
Contribution by Timothee Maret.
Modified:
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/standby/server/FileStoreUtil.java
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/standby/server/FileStoreUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/standby/server/FileStoreUtil.java?rev=1768717&r1=1768716&r2=1768717&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/standby/server/FileStoreUtil.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/standby/server/FileStoreUtil.java Tue Nov 8 16:03:07 2016
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
import org.apache.jackrabbit.oak.segment.Segment;
import org.apache.jackrabbit.oak.segment.SegmentId;
-import org.apache.jackrabbit.oak.segment.SegmentNotFoundException;
import org.apache.jackrabbit.oak.segment.file.FileStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,10 +35,8 @@ class FileStoreUtil {
static Segment readSegmentWithRetry(FileStore store, SegmentId id) {
for (int i = 0; i < 160; i++) {
- try {
+ if (store.containsSegment(id)) {
return store.readSegment(id);
- } catch (SegmentNotFoundException e) {
- // Ignore this exception and wait
}
try {
log.trace("Unable to read segment, waiting...");