Skip to content

Commit

Permalink
OAK-5034 - Set retry timeout to 20 seconds over 160 iterations
Browse files Browse the repository at this point in the history
Contribution by Timothee Maret.


git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1767246 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
francescomari committed Oct 31, 2016
1 parent 338cdcd commit c36317a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,26 @@
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;

class FileStoreUtil {

private static final Logger log = LoggerFactory.getLogger(FileStoreUtil.class);

FileStoreUtil() {
// Prevent instantiation
}

static Segment readSegmentWithRetry(FileStore store, SegmentId id) {
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 160; i++) {
try {
return store.readSegment(id);
} catch (SegmentNotFoundException e) {
// Ignore this exception and wait
}
try {
log.trace("Unable to read segment, waiting...");
TimeUnit.MILLISECONDS.sleep(125);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
Expand Down

0 comments on commit c36317a

Please sign in to comment.